Package org.grails.web.servlet
Class DefaultGrailsApplicationAttributes
- java.lang.Object
-
- org.grails.web.servlet.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 Summary
Fields Modifier and Type Field Description protected static java.lang.StringDEFAULT_NAMESPACE-
Fields inherited from interface grails.core.ApplicationAttributes
APPLICATION, APPLICATION_CONTEXT, PARENT_APPLICATION_CONTEXT, PLUGIN_MANAGER, REQUEST_SCOPE_ID
-
Fields inherited from interface org.grails.web.util.GrailsApplicationAttributes
ACTION_NAME_ATTRIBUTE, APP_URI_ATTRIBUTE, ASYNC_STARTED, CONTENT_FORMAT, CONTROLLER, CONTROLLER_NAME_ATTRIBUTE, CONTROLLER_NAMESPACE_ATTRIBUTE, ERRORS, FLASH_SCOPE, FORWARD_IN_PROGRESS, FORWARD_ISSUED, GRAILS_CONTROLLER_CLASS, GRAILS_CONTROLLER_CLASS_AVAILABLE, GSP_CODEC, GSP_TEMPLATE_ENGINE, GSP_TMP_WRITER, GSP_TO_RENDER, ID_PARAM, MODEL_AND_VIEW, OUT, PAGE_SCOPE, PARAMS_OBJECT, PATH_TO_VIEWS, PROPERTY_REGISTRY, REDIRECT_ISSUED, RENDERING_ERROR_ATTRIBUTE, REQUEST_FORMATS, REQUEST_REDIRECTED_ATTRIBUTE, RESPONSE_FORMAT, RESPONSE_FORMATS, RESPONSE_MIME_TYPE, RESPONSE_MIME_TYPES, TAG_CACHE, TEMPLATE_MODEL, WEB_REQUEST
-
-
Constructor Summary
Constructors Constructor Description DefaultGrailsApplicationAttributes(javax.servlet.ServletContext context)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description org.springframework.context.ApplicationContextgetApplicationContext()java.lang.StringgetApplicationUri(javax.servlet.ServletRequest request)Deprecated.Useinsteadgroovy.lang.GroovyObjectgetController(javax.servlet.ServletRequest request)java.lang.StringgetControllerActionUri(javax.servlet.ServletRequest request)java.lang.StringgetControllerUri(javax.servlet.ServletRequest request)org.springframework.validation.ErrorsgetErrors(javax.servlet.ServletRequest request)FlashScopegetFlashScope(javax.servlet.ServletRequest request)Retrieves the flash scope instance for the given requestegrails.core.GrailsApplicationgetGrailsApplication()GroovyPagesUriServicegetGroovyPagesUriService()org.springframework.context.MessageSourcegetMessageSource()java.lang.StringgetNoSuffixViewURI(groovy.lang.GroovyObject controller, java.lang.String viewName)java.io.WritergetOut(javax.servlet.http.HttpServletRequest request)Holds the current response write for the requestorg.grails.gsp.ResourceAwareTemplateEnginegetPagesTemplateEngine()java.lang.StringgetPluginContextPath(javax.servlet.http.HttpServletRequest request)Retrieves the plugin context path for the current request.javax.servlet.ServletContextgetServletContext()Retrieves the servlet context instancejava.lang.StringgetTemplateUri(java.lang.CharSequence templateName, javax.servlet.ServletRequest request)java.lang.StringgetTemplateURI(groovy.lang.GroovyObject controller, java.lang.String templateName)Resolve the URI for a templatejava.lang.StringgetTemplateURI(groovy.lang.GroovyObject controller, java.lang.String templateName, boolean includeExtension)Resolve the URI for a templatejava.lang.StringgetViewUri(java.lang.String viewName, javax.servlet.http.HttpServletRequest request)Retrieves the uri of a named viewvoidsetOut(javax.servlet.http.HttpServletRequest request, java.io.Writer out2)Sets the current write for the request
-
-
-
Field Detail
-
DEFAULT_NAMESPACE
protected static final java.lang.String DEFAULT_NAMESPACE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getApplicationContext
public org.springframework.context.ApplicationContext getApplicationContext()
- Specified by:
getApplicationContextin interfacegrails.core.ApplicationAttributes
-
getPluginContextPath
public java.lang.String getPluginContextPath(javax.servlet.http.HttpServletRequest request)
Description copied from interface:GrailsApplicationAttributesRetrieves 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:
getPluginContextPathin interfaceGrailsApplicationAttributes- Returns:
- The plugin context path
-
getController
public groovy.lang.GroovyObject getController(javax.servlet.ServletRequest request)
- Specified by:
getControllerin interfaceGrailsApplicationAttributes- Returns:
- The controller for the request
-
getControllerUri
public java.lang.String getControllerUri(javax.servlet.ServletRequest request)
- Specified by:
getControllerUriin interfaceGrailsApplicationAttributes- Returns:
- The uri of the controller within the request
-
getApplicationUri
@Deprecated public java.lang.String getApplicationUri(javax.servlet.ServletRequest request)
Deprecated.Useinstead- Specified by:
getApplicationUriin interfaceGrailsApplicationAttributes- Parameters:
request- The Servlet Reqest- Returns:
- The Application URI
-
getServletContext
public javax.servlet.ServletContext getServletContext()
Description copied from interface:GrailsApplicationAttributesRetrieves the servlet context instance- Specified by:
getServletContextin interfaceGrailsApplicationAttributes- Returns:
- The servlet context instance
-
getFlashScope
public FlashScope getFlashScope(javax.servlet.ServletRequest request)
Description copied from interface:GrailsApplicationAttributesRetrieves the flash scope instance for the given requeste- Specified by:
getFlashScopein interfaceGrailsApplicationAttributes- Returns:
- The FlashScope instance
-
getTemplateUri
public java.lang.String getTemplateUri(java.lang.CharSequence templateName, javax.servlet.ServletRequest request)- Specified by:
getTemplateUriin interfaceGrailsApplicationAttributes- 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:GrailsApplicationAttributesRetrieves the uri of a named view- Specified by:
getViewUriin interfaceGrailsApplicationAttributes- Parameters:
viewName- The name of the viewrequest- The request instance- Returns:
- The name of the view
-
getControllerActionUri
public java.lang.String getControllerActionUri(javax.servlet.ServletRequest request)
- Specified by:
getControllerActionUriin interfaceGrailsApplicationAttributes- Returns:
- The uri of the action called within the controller
-
getErrors
public org.springframework.validation.Errors getErrors(javax.servlet.ServletRequest request)
- Specified by:
getErrorsin interfaceGrailsApplicationAttributes- Returns:
- The errors instance contained within the request
-
getPagesTemplateEngine
public org.grails.gsp.ResourceAwareTemplateEngine getPagesTemplateEngine()
- Specified by:
getPagesTemplateEnginein interfaceGrailsApplicationAttributes- Returns:
- Retrieves the shared GSP template engine
-
getGrailsApplication
public grails.core.GrailsApplication getGrailsApplication()
- Specified by:
getGrailsApplicationin interfacegrails.core.ApplicationAttributes
-
getOut
public java.io.Writer getOut(javax.servlet.http.HttpServletRequest request)
Description copied from interface:GrailsApplicationAttributesHolds the current response write for the request- Specified by:
getOutin interfaceGrailsApplicationAttributes- Returns:
- The held response writer
-
setOut
public void setOut(javax.servlet.http.HttpServletRequest request, java.io.Writer out2)Description copied from interface:GrailsApplicationAttributesSets the current write for the request- Specified by:
setOutin interfaceGrailsApplicationAttributes- Parameters:
request- The requestout2- The writer
-
getNoSuffixViewURI
public java.lang.String getNoSuffixViewURI(groovy.lang.GroovyObject controller, java.lang.String viewName)- Specified by:
getNoSuffixViewURIin interfaceGrailsApplicationAttributes
-
getTemplateURI
public java.lang.String getTemplateURI(groovy.lang.GroovyObject controller, java.lang.String templateName)Description copied from interface:GrailsApplicationAttributesResolve the URI for a template- Specified by:
getTemplateURIin interfaceGrailsApplicationAttributes- Parameters:
controller- The controllertemplateName- 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:GrailsApplicationAttributesResolve the URI for a template- Specified by:
getTemplateURIin interfaceGrailsApplicationAttributes- Parameters:
controller- The controllertemplateName- The name of the templateincludeExtension- Whether to include the GSP etension- Returns:
- The template name
-
getGroovyPagesUriService
public GroovyPagesUriService getGroovyPagesUriService()
- Specified by:
getGroovyPagesUriServicein interfaceGrailsApplicationAttributes- Returns:
- The GroovyPageUriService instance
-
getMessageSource
public org.springframework.context.MessageSource getMessageSource()
- Specified by:
getMessageSourcein interfaceGrailsApplicationAttributes- Returns:
- The MessageSource instance
-
-