org.codehaus.groovy.grails.web.servlet
Interface GrailsApplicationAttributes

All Superinterfaces:
ApplicationAttributes
All Known Implementing Classes:
DefaultGrailsApplicationAttributes

public interface GrailsApplicationAttributes
extends ApplicationAttributes

An interface defining the names of and methods to retrieve Grails specific request and servlet attributes

Since:
17-Jan-2006
Author:
Graeme Rocher

Field Summary
static String ACTION_NAME_ATTRIBUTE
           
static String APP_URI_ATTRIBUTE
           
static String CONTENT_FORMAT
           
static String CONTROLLER
           
static String CONTROLLER_NAME_ATTRIBUTE
           
static String ERRORS
           
static String FLASH_SCOPE
           
static String GSP_TEMPLATE_ENGINE
           
static String GSP_TMP_WRITER
           
static String GSP_TO_RENDER
           
static String ID_PARAM
           
static String MODEL_AND_VIEW
           
static String OUT
           
static String PAGE_SCOPE
           
static String PARAMS_OBJECT
           
static String PATH_TO_VIEWS
           
static String PROPERTY_REGISTRY
           
static String RENDERING_ERROR_ATTRIBUTE
           
static String REQUEST_FORMATS
           
static String REQUEST_REDIRECTED_ATTRIBUTE
           
static String TAG_CACHE
           
static String WEB_REQUEST
           
 
Fields inherited from interface org.codehaus.groovy.grails.commons.ApplicationAttributes
APPLICATION_CONTEXT, PARENT_APPLICATION_CONTEXT, PLUGIN_MANAGER, REQUEST_SCOPE_ID
 
Method Summary
 String getApplicationUri(ServletRequest request)
           
 groovy.lang.GroovyObject getController(ServletRequest request)
           
 String getControllerActionUri(ServletRequest request)
           
 String getControllerUri(ServletRequest request)
           
 Errors getErrors(ServletRequest request)
           
 FlashScope getFlashScope(ServletRequest request)
          Retrieves the flash scope instance for the given requeste
 GroovyPagesUriService getGroovyPagesUriService()
           
 MessageSource getMessageSource()
           
 String getNoSuffixViewURI(groovy.lang.GroovyObject controller, String viewName)
           
 Writer getOut(HttpServletRequest request)
          Holds the current response write for the request
 GroovyPagesTemplateEngine getPagesTemplateEngine()
           
 String getPluginContextPath(HttpServletRequest request)
          Retrieves the plugin context path for the current request.
 ServletContext getServletContext()
          Retrieves the servlet context instance
 groovy.lang.GroovyObject getTagLibraryForTag(HttpServletRequest request, HttpServletResponse response, String tagName)
          Retrieves a Grails tag library from the request for the named tag in the default namespace GroovyPage.DEFAULT_NAMESPACE
 groovy.lang.GroovyObject getTagLibraryForTag(HttpServletRequest request, HttpServletResponse response, String tagName, String namespace)
          Retrieves a Grails tag library from the request for the named tag in a given namespace.
 String getTemplateUri(CharSequence templateName, ServletRequest request)
           
 String getTemplateURI(groovy.lang.GroovyObject controller, String templateName)
           
 String getViewUri(String viewName, HttpServletRequest request)
          Retrieves the uri of a named view
 void setOut(HttpServletRequest currentRequest, Writer out2)
          Sets the current write for the request
 
Methods inherited from interface org.codehaus.groovy.grails.commons.ApplicationAttributes
getApplicationContext, getGrailsApplication
 

Field Detail

PATH_TO_VIEWS

static final String PATH_TO_VIEWS
See Also:
Constant Field Values

GSP_TEMPLATE_ENGINE

static final String GSP_TEMPLATE_ENGINE
See Also:
Constant Field Values

CONTENT_FORMAT

static final String CONTENT_FORMAT
See Also:
Constant Field Values

REQUEST_FORMATS

static final String REQUEST_FORMATS
See Also:
Constant Field Values

FLASH_SCOPE

static final String FLASH_SCOPE
See Also:
Constant Field Values

PARAMS_OBJECT

static final String PARAMS_OBJECT
See Also:
Constant Field Values

CONTROLLER

static final String CONTROLLER
See Also:
Constant Field Values

PROPERTY_REGISTRY

static final String PROPERTY_REGISTRY
See Also:
Constant Field Values

ERRORS

static final String ERRORS
See Also:
Constant Field Values

MODEL_AND_VIEW

static final String MODEL_AND_VIEW
See Also:
Constant Field Values

OUT

static final String OUT
See Also:
Constant Field Values

TAG_CACHE

static final String TAG_CACHE
See Also:
Constant Field Values

ID_PARAM

static final String ID_PARAM
See Also:
Constant Field Values

GSP_TO_RENDER

static final String GSP_TO_RENDER
See Also:
Constant Field Values

WEB_REQUEST

static final String WEB_REQUEST
See Also:
Constant Field Values

PAGE_SCOPE

static final String PAGE_SCOPE
See Also:
Constant Field Values

GSP_TMP_WRITER

static final String GSP_TMP_WRITER
See Also:
Constant Field Values

REQUEST_REDIRECTED_ATTRIBUTE

static final String REQUEST_REDIRECTED_ATTRIBUTE
See Also:
Constant Field Values

ACTION_NAME_ATTRIBUTE

static final String ACTION_NAME_ATTRIBUTE
See Also:
Constant Field Values

CONTROLLER_NAME_ATTRIBUTE

static final String CONTROLLER_NAME_ATTRIBUTE
See Also:
Constant Field Values

APP_URI_ATTRIBUTE

static final String APP_URI_ATTRIBUTE
See Also:
Constant Field Values

RENDERING_ERROR_ATTRIBUTE

static final String RENDERING_ERROR_ATTRIBUTE
See Also:
Constant Field Values
Method Detail

getPluginContextPath

String getPluginContextPath(HttpServletRequest request)
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

Returns:
The plugin context path

getController

groovy.lang.GroovyObject getController(ServletRequest request)
Returns:
The controller for the request

getControllerUri

String getControllerUri(ServletRequest request)
Parameters:
request -
Returns:
The uri of the controller within the request

getApplicationUri

String getApplicationUri(ServletRequest request)
Parameters:
request -
Returns:
The uri of the application relative to the server root

getTemplateURI

String getTemplateURI(groovy.lang.GroovyObject controller,
                      String templateName)

getNoSuffixViewURI

String getNoSuffixViewURI(groovy.lang.GroovyObject controller,
                          String viewName)

getServletContext

ServletContext getServletContext()
Retrieves the servlet context instance

Returns:
The servlet context instance

getFlashScope

FlashScope getFlashScope(ServletRequest request)
Retrieves the flash scope instance for the given requeste

Parameters:
request -
Returns:
The FlashScope instance

getTemplateUri

String getTemplateUri(CharSequence templateName,
                      ServletRequest request)
Parameters:
templateName -
request -
Returns:
The uri of a named template for the current controller

getViewUri

String getViewUri(String viewName,
                  HttpServletRequest request)
Retrieves the uri of a named view

Parameters:
viewName - The name of the view
request - The request instance
Returns:
The name of the view

getControllerActionUri

String getControllerActionUri(ServletRequest request)
Parameters:
request -
Returns:
The uri of the action called within the controller

getErrors

Errors getErrors(ServletRequest request)
Parameters:
request -
Returns:
The errors instance contained within the request

getPagesTemplateEngine

GroovyPagesTemplateEngine getPagesTemplateEngine()
Returns:
Retrieves the shared GSP template engine

getTagLibraryForTag

groovy.lang.GroovyObject getTagLibraryForTag(HttpServletRequest request,
                                             HttpServletResponse response,
                                             String tagName)
Retrieves a Grails tag library from the request for the named tag in the default namespace GroovyPage.DEFAULT_NAMESPACE

Parameters:
request - the request instance
response - the response instancte
tagName - The name of the tag that contains the tag library
Returns:
An instance of the tag library or null if not found

getTagLibraryForTag

groovy.lang.GroovyObject getTagLibraryForTag(HttpServletRequest request,
                                             HttpServletResponse response,
                                             String tagName,
                                             String namespace)
Retrieves a Grails tag library from the request for the named tag in a given namespace.

Parameters:
request - the request instance
response - the response instancte
tagName - The name of the tag that contains the tag library
namespace - The namespace of the tag
Returns:
An instance of the tag library or null if not found

getOut

Writer getOut(HttpServletRequest request)
Holds the current response write for the request

Returns:
The held response writer

setOut

void setOut(HttpServletRequest currentRequest,
            Writer out2)
Sets the current write for the request

Parameters:
currentRequest - The request
out2 - The writer

getGroovyPagesUriService

GroovyPagesUriService getGroovyPagesUriService()

getMessageSource

MessageSource getMessageSource()


Copyright (c) 2005-2009 The Grails project