Search in sources :

Example 31 with GrailsWebRequest

use of org.grails.web.servlet.mvc.GrailsWebRequest in project grails-core by grails.

the class GrailsFlashScope method registerWithSessionIfNecessary.

private void registerWithSessionIfNecessary() {
    if (registerWithSession) {
        GrailsWebRequest webRequest = (GrailsWebRequest) RequestContextHolder.currentRequestAttributes();
        HttpSession session = webRequest.getCurrentRequest().getSession(true);
        if (session.getAttribute(GrailsApplicationAttributes.FLASH_SCOPE) == null) {
            session.setAttribute(GrailsApplicationAttributes.FLASH_SCOPE, this);
        }
    }
}
Also used : HttpSession(javax.servlet.http.HttpSession) GrailsWebRequest(org.grails.web.servlet.mvc.GrailsWebRequest)

Example 32 with GrailsWebRequest

use of org.grails.web.servlet.mvc.GrailsWebRequest in project grails-core by grails.

the class CachingLinkGenerator method makeKey.

protected String makeKey(String prefix, Map attrs) {
    StringBuilder sb = new StringBuilder();
    sb.append(prefix);
    if (getConfiguredServerBaseURL() == null && isAbsolute(attrs)) {
        if (attrs.get(ATTRIBUTE_BASE) != null) {
            sb.append(attrs.get(ATTRIBUTE_BASE));
        } else {
            GrailsWebRequest webRequest = GrailsWebRequest.lookup();
            if (webRequest != null) {
                sb.append(webRequest.getBaseUrl());
            }
        }
    }
    appendMapKey(sb, attrs);
    return sb.toString();
}
Also used : GrailsWebRequest(org.grails.web.servlet.mvc.GrailsWebRequest)

Aggregations

GrailsWebRequest (org.grails.web.servlet.mvc.GrailsWebRequest)32 Decorator (com.opensymphony.module.sitemesh.Decorator)8 Page (com.opensymphony.module.sitemesh.Page)7 HTMLPageParser (com.opensymphony.module.sitemesh.parser.HTMLPageParser)7 Config (grails.config.Config)7 GroovyObject (groovy.lang.GroovyObject)7 ServletContext (javax.servlet.ServletContext)7 PropertySourcesConfig (org.grails.config.PropertySourcesConfig)7 MockApplicationContext (org.grails.support.MockApplicationContext)7 MockHttpServletRequest (org.springframework.mock.web.MockHttpServletRequest)7 MockServletConfig (org.springframework.mock.web.MockServletConfig)7 GroovyClassLoader (groovy.lang.GroovyClassLoader)5 HashMap (java.util.HashMap)5 Map (java.util.Map)4 Binding (groovy.lang.Binding)3 RequestDispatcher (javax.servlet.RequestDispatcher)3 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2 HttpServletRequest (javax.servlet.http.HttpServletRequest)2 GroovyPageScriptSource (org.grails.gsp.io.GroovyPageScriptSource)2 ControllerExecutionException (org.grails.web.servlet.mvc.exceptions.ControllerExecutionException)2