/** * @return prefix for cache key that contains current controller's context (currently plugin and * namespace) */ protected String resolveCurrentControllerKeyPrefixes() { String pluginContextPath = null; String namespace = null; GrailsWebRequest webRequest = GrailsWebRequest.lookup(); if (webRequest != null) { namespace = webRequest.getControllerNamespace(); pluginContextPath = (webRequest.getAttributes() != null && webRequest.getCurrentRequest() != null) ? webRequest.getAttributes().getPluginContextPath(webRequest.getCurrentRequest()) : null; return (pluginContextPath != null ? pluginContextPath : "-") + "," + (namespace != null ? namespace : "-"); } else { return null; } }
protected View createGrailsView(String viewName) throws Exception { // try GSP if res is null GroovyObject controller = null; GrailsWebRequest webRequest = GrailsWebRequest.lookup(); if (webRequest != null) { HttpServletRequest request = webRequest.getCurrentRequest(); controller = webRequest.getAttributes().getController(request); } GroovyPageScriptSource scriptSource; if (controller == null) { scriptSource = groovyPageLocator.findViewByPath(viewName); } else { scriptSource = groovyPageLocator.findView(controller, viewName); } if (scriptSource != null) { return createGroovyPageView(scriptSource.getURI(), scriptSource); } return createFallbackView(viewName); }
public EncodingStateRegistry lookup() { GrailsWebRequest webRequest = GrailsWebRequest.lookup(); return webRequest == null ? null : webRequest.getEncodingStateRegistry(); }
private void inheritEncodingStateRegistry() { GrailsWebRequest parentRequest = GrailsWebRequest.lookup(getRequest()); if (parentRequest != null) { this.encodingStateRegistry = parentRequest.getEncodingStateRegistry(); } }