Class DefaultGrailsApplicationAttributes

  • All Implemented Interfaces:
    grails.core.ApplicationAttributes, GrailsApplicationAttributes

    public class DefaultGrailsApplicationAttributes
    extends java.lang.Object
    implements GrailsApplicationAttributes
    Holds knowledge about how to obtain certain attributes from either the ServletContext or the HttpServletRequest instance.
    Since:
    0.3
    See Also:
    GrailsWebRequest
    • Field Detail

      • DEFAULT_NAMESPACE

        protected static final java.lang.String DEFAULT_NAMESPACE
        See Also:
        Constant Field Values
    • Constructor Detail

      • DefaultGrailsApplicationAttributes

        public DefaultGrailsApplicationAttributes​(javax.servlet.ServletContext context)
    • Method Detail

      • getApplicationContext

        public org.springframework.context.ApplicationContext getApplicationContext()
        Specified by:
        getApplicationContext in interface grails.core.ApplicationAttributes
      • getPluginContextPath

        public java.lang.String getPluginContextPath​(javax.servlet.http.HttpServletRequest request)
        Description copied from interface: GrailsApplicationAttributes
        Retrieves the plugin context path for the current request. The plugin context path is the path used by plugins to reference resources such as javascript, CSS and so forth It is established by evaluating the current controller, if the current controller is plugin provided then it will attempt to evaluate the path based on the plugin the controller came from
        Specified by:
        getPluginContextPath in interface GrailsApplicationAttributes
        Returns:
        The plugin context path
      • getController

        public groovy.lang.GroovyObject getController​(javax.servlet.ServletRequest request)
        Specified by:
        getController in interface GrailsApplicationAttributes
        Returns:
        The controller for the request
      • getControllerUri

        public java.lang.String getControllerUri​(javax.servlet.ServletRequest request)
        Specified by:
        getControllerUri in interface GrailsApplicationAttributes
        Returns:
        The uri of the controller within the request
      • getApplicationUri

        @Deprecated
        public java.lang.String getApplicationUri​(javax.servlet.ServletRequest request)
        Deprecated.
        Specified by:
        getApplicationUri in interface GrailsApplicationAttributes
        Parameters:
        request - The Servlet Reqest
        Returns:
        The Application URI
      • getTemplateUri

        public java.lang.String getTemplateUri​(java.lang.CharSequence templateName,
                                               javax.servlet.ServletRequest request)
        Specified by:
        getTemplateUri in interface GrailsApplicationAttributes
        Returns:
        The uri of a named template for the current controller
      • getViewUri

        public java.lang.String getViewUri​(java.lang.String viewName,
                                           javax.servlet.http.HttpServletRequest request)
        Description copied from interface: GrailsApplicationAttributes
        Retrieves the uri of a named view
        Specified by:
        getViewUri in interface GrailsApplicationAttributes
        Parameters:
        viewName - The name of the view
        request - The request instance
        Returns:
        The name of the view
      • getControllerActionUri

        public java.lang.String getControllerActionUri​(javax.servlet.ServletRequest request)
        Specified by:
        getControllerActionUri in interface GrailsApplicationAttributes
        Returns:
        The uri of the action called within the controller
      • getErrors

        public org.springframework.validation.Errors getErrors​(javax.servlet.ServletRequest request)
        Specified by:
        getErrors in interface GrailsApplicationAttributes
        Returns:
        The errors instance contained within the request
      • getGrailsApplication

        public grails.core.GrailsApplication getGrailsApplication()
        Specified by:
        getGrailsApplication in interface grails.core.ApplicationAttributes
      • getOut

        public java.io.Writer getOut​(javax.servlet.http.HttpServletRequest request)
        Description copied from interface: GrailsApplicationAttributes
        Holds the current response write for the request
        Specified by:
        getOut in interface GrailsApplicationAttributes
        Returns:
        The held response writer
      • setOut

        public void setOut​(javax.servlet.http.HttpServletRequest request,
                           java.io.Writer out2)
        Description copied from interface: GrailsApplicationAttributes
        Sets the current write for the request
        Specified by:
        setOut in interface GrailsApplicationAttributes
        Parameters:
        request - The request
        out2 - The writer
      • getTemplateURI

        public java.lang.String getTemplateURI​(groovy.lang.GroovyObject controller,
                                               java.lang.String templateName)
        Description copied from interface: GrailsApplicationAttributes
        Resolve the URI for a template
        Specified by:
        getTemplateURI in interface GrailsApplicationAttributes
        Parameters:
        controller - The controller
        templateName - The name of the template
        Returns:
        The template name
      • getTemplateURI

        public java.lang.String getTemplateURI​(groovy.lang.GroovyObject controller,
                                               java.lang.String templateName,
                                               boolean includeExtension)
        Description copied from interface: GrailsApplicationAttributes
        Resolve the URI for a template
        Specified by:
        getTemplateURI in interface GrailsApplicationAttributes
        Parameters:
        controller - The controller
        templateName - The name of the template
        includeExtension - Whether to include the GSP etension
        Returns:
        The template name