## org.codehaus.groovy.grails.web.servlet.mvc
Class GrailsWebRequest

    java.lang.Object
      org.springframework.web.context.request.AbstractRequestAttributes
          org.springframework.web.context.request.ServletRequestAttributes
              org.springframework.web.context.request.ServletWebRequest
                  org.springframework.web.servlet.handler.DispatcherServletWebRequest
                      org.codehaus.groovy.grails.web.servlet.mvc.GrailsWebRequest

All Implemented Interfaces:
  ParameterInitializationCallback, NativeWebRequest, RequestAttributes, WebRequest

    public class GrailsWebRequest

extends DispatcherServletWebRequest
implements ParameterInitializationCallback

A class the encapsulates a Grails request. An instance of this class is bound to the current thread using Spring's RequestContextHolder which can later be retrieved using: def webRequest = RequestContextHolder.currentRequestAttributes()

Since:
  0.4
Author:
  Graeme Rocher

Field Summary
`static String` `ID_PARAMETER`

Fields inherited from class org.springframework.web.context.request.ServletRequestAttributes
`DESTRUCTION_CALLBACK_NAME_PREFIX`

Fields inherited from class org.springframework.web.context.request.AbstractRequestAttributes
`requestDestructionCallbacks`

Fields inherited from interface org.springframework.web.context.request.RequestAttributes
`REFERENCE_REQUEST, REFERENCE_SESSION, SCOPE_GLOBAL_SESSION, SCOPE_REQUEST, SCOPE_SESSION`

Constructor Summary
`GrailsWebRequest(HttpServletRequest request, HttpServletResponse response, ServletContext servletContext)`

Method Summary
`void` `addParameterListener(ParameterCreationListener creationListener)` Adds a creationListener that will be called when the parameters are created
`String` `getActionName()`
`ApplicationContext` `getApplicationContext()` Obtains the ApplicationContext object
`GrailsApplicationAttributes` `getAttributes()`
`String` `getContextPath()` Retuns the context path of the request
`String` `getControllerName()`
`HttpServletRequest` `getCurrentRequest()`
`HttpServletResponse` `getCurrentResponse()`
`FlashScope` `getFlashScope()`
`String` `getId()`
`Writer` `getOut()`
`Map` `getParameterMap()` Overriden to return the GrailsParameterMap instance
`org.codehaus.groovy.grails.web.servlet.mvc.GrailsParameterMap` `getParams()`
`PropertyEditorRegistry` `getPropertyEditorRegistry()` Obtains the PropertyEditorRegistry instance
`ServletContext` `getServletContext()`
`GrailsHttpSession` `getSession()`
`void` `informParameterCreationListeners()` Informs any parameter creation listeners
`boolean` `isFlowRequest()` Returns true if the current executing request is a flow request
`boolean` `isRenderView()`
`static GrailsWebRequest` `lookup(HttpServletRequest request)` Looks up the GrailsWebRequest from the current request
`void` `setActionName(String actionName)`
`void` `setControllerName(String controllerName)`
`void` `setId(Object id)` Sets the id of the request
`void` `setOut(Writer out)`
`void` `setRenderView(boolean renderView)`

Methods inherited from class org.springframework.web.servlet.handler.DispatcherServletWebRequest
`getLocale`

Methods inherited from class org.springframework.web.context.request.ServletWebRequest
`checkNotModified, getDescription, getHeader, getHeaderNames, getHeaderValues, getNativeRequest, getNativeResponse, getParameter, getParameterNames, getParameterValues, getRemoteUser, getResponse, getUserPrincipal, isNotModified, isSecure, isUserInRole, toString`

Methods inherited from class org.springframework.web.context.request.ServletRequestAttributes
`getAttribute, getAttributeNames, getRequest, getSession, getSessionId, getSessionMutex, registerDestructionCallback, registerSessionDestructionCallback, removeAttribute, resolveReference, setAttribute, updateAccessedSessionAttributes`

Methods inherited from class org.springframework.web.context.request.AbstractRequestAttributes
`isRequestActive, registerRequestDestructionCallback, removeRequestDestructionCallback, requestCompleted`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface org.springframework.web.context.request.RequestAttributes
`getAttribute, getAttributeNames, getSessionId, getSessionMutex, registerDestructionCallback, removeAttribute, resolveReference, setAttribute`

Field Detail

### ID_PARAMETER

    public static final String ID_PARAMETER

See Also:
  Constant Field Values

Constructor Detail

### GrailsWebRequest

    public GrailsWebRequest(HttpServletRequest request,
                            HttpServletResponse response,
                            ServletContext servletContext)

Method Detail

### getParameterMap

    public Map getParameterMap()

  Overriden to return the GrailsParameterMap instance

  Specified by:
    `getParameterMap` in interface `WebRequest`
  Overrides:
    `getParameterMap` in class `ServletWebRequest`
  Returns:
    An instance of GrailsParameterMap

### getOut

    public Writer getOut()

  Returns:
    the out

### setOut

    public void setOut(Writer out)

  Parameters:
    `out` - the out to set

### getServletContext

    public ServletContext getServletContext()

  Returns:
    The ServletContext instance

### getContextPath

    public String getContextPath()

  Retuns the context path of the request

  Specified by:
    `getContextPath` in interface `WebRequest`
  Overrides:
    `getContextPath` in class `ServletWebRequest`
  Returns:
    The context path of the request

### getFlashScope

    public FlashScope getFlashScope()

  Returns:
    The FlashScope instance for the current request

### getCurrentRequest

    public HttpServletRequest getCurrentRequest()

  Returns:
    The currently executing request

### getCurrentResponse

    public HttpServletResponse getCurrentResponse()

### getParams

    public org.codehaus.groovy.grails.web.servlet.mvc.GrailsParameterMap getParams()

  Returns:
    The Grails params object

### informParameterCreationListeners

    public void informParameterCreationListeners()

  Informs any parameter creation listeners

### getSession

    public GrailsHttpSession getSession()

  Returns:
    The Grails session object

### getAttributes

    public GrailsApplicationAttributes getAttributes()

  Returns:
    The GrailsApplicationAttributes instance

### setActionName

    public void setActionName(String actionName)

### setControllerName

    public void setControllerName(String controllerName)

### getActionName

    public String getActionName()

  Returns:
    the actionName

### getControllerName

    public String getControllerName()

  Returns:
    the controllerName

### setRenderView

    public void setRenderView(boolean renderView)

### isRenderView

    public boolean isRenderView()

  Returns:
    True if the view for this GrailsWebRequest should be rendered

### getId

    public String getId()

### isFlowRequest

    public boolean isFlowRequest()

  Returns true if the current executing request is a flow request

  Returns:
    True if it is a flow request

### addParameterListener

    public void addParameterListener(ParameterCreationListener creationListener)

  Description copied from interface: `ParameterInitializationCallback`
  Adds a creationListener that will be called when the parameters are created

  Specified by:
    `addParameterListener` in interface `ParameterInitializationCallback`
  Parameters:
    `creationListener` - The creationListener

### getApplicationContext

    public ApplicationContext getApplicationContext()

  Obtains the ApplicationContext object

  Returns:
    The ApplicationContext

### getPropertyEditorRegistry

    public PropertyEditorRegistry getPropertyEditorRegistry()

  Obtains the PropertyEditorRegistry instance

  Returns:
    The PropertyEditorRegistry

### lookup

    public static GrailsWebRequest lookup(HttpServletRequest request)

  Looks up the GrailsWebRequest from the current request

  Parameters:
    `request` - The current request
  Returns:
    The GrailsWebRequest

### setId

    public void setId(Object id)

  Sets the id of the request

  Parameters:
    `id` - The id

Copyright (c) 2005-2009 The Grails project