GrailsWebRequest (Grails 2.3.8)
Date: 2014-04-24

Overview | Package | Class | Deprecated | Index | Help
| Groovy Documentation
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.codehaus.groovy.grails.web.servlet.mvc
[Java] 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

    public class GrailsWebRequest
    extends org.springframework.web.servlet.handler.DispatcherServletWebRequest

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()

Authors:
  Graeme Rocher

Since:
  0.4

Field Summary
`static java.lang.String` | `ID_PARAMETER`

Fields inherited from class org.springframework.web.servlet.handler.DispatcherServletWebRequest
SCOPE_REQUEST, SCOPE_SESSION, SCOPE_GLOBAL_SESSION, REFERENCE_REQUEST, REFERENCE_SESSION, DESTRUCTION_CALLBACK_NAME_PREFIX

Fields inherited from class org.springframework.web.context.request.ServletWebRequest
SCOPE_REQUEST, SCOPE_SESSION, SCOPE_GLOBAL_SESSION, REFERENCE_REQUEST, REFERENCE_SESSION, DESTRUCTION_CALLBACK_NAME_PREFIX

Constructor Summary
`GrailsWebRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, GrailsApplicationAttributes attributes)`
`GrailsWebRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.ServletContext servletContext)`
`GrailsWebRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.ServletContext servletContext, org.springframework.context.ApplicationContext applicationContext)`

Method Summary
`void` | `addParameterListener(ParameterCreationListener creationListener)`
`void` | `addParametersFrom(java.util.Map previousParams)`
`java.lang.String` | `getActionName()` @return the actionName
`org.springframework.context.ApplicationContext` | `getApplicationContext()` Obtains the ApplicationContext object.
`GrailsApplicationAttributes` | `getAttributes()` @return The GrailsApplicationAttributes instance
`java.lang.String` | `getBaseUrl()`
`java.lang.String` | `getContextPath()` Returns the context path of the request.
`java.lang.String` | `getControllerName()` @return the controllerName
`javax.servlet.http.HttpServletRequest` | `getCurrentRequest()` @return The currently executing request
`javax.servlet.http.HttpServletResponse` | `getCurrentResponse()`
`EncodingStateRegistry` | `getEncodingStateRegistry()`
`java.lang.String` | `getFilteringCodec()`
`Encoder` | `getFilteringEncoder()`
`FlashScope` | `getFlashScope()` @return The FlashScope instance for the current request
`java.lang.String` | `getId()`
`java.io.Writer` | `getOut()` @return the out
`java.util.Map` | `getParameterMap()` Overriden to return the GrailsParameterMap instance,
`GrailsParameterMap` | `getParams()` @return The Grails params object
`org.springframework.beans.PropertyEditorRegistry` | `getPropertyEditorRegistry()` Obtains the PropertyEditorRegistry instance.
`javax.servlet.ServletContext` | `getServletContext()` @return The ServletContext instance
`GrailsHttpSession` | `getSession()` @return The Grails session object
`javax.servlet.http.HttpServletResponse` | `getWrappedResponse()`
`void` | `informParameterCreationListeners()` Informs any parameter creation listeners.
`boolean` | `isActive()` Whether the web request is still active
`boolean` | `isFlowRequest()` Returns true if the current executing request is a flow request
`boolean` | `isRenderView()` @return true if the view for this GrailsWebRequest should be rendered
`boolean` | `isSkipFilteringCodec()` @return true if grails.views.filteringCodecForMimeType settings should be ignored for this request
`static GrailsWebRequest` | `lookup(javax.servlet.http.HttpServletRequest request)` Looks up the GrailsWebRequest from the current request.
`static GrailsWebRequest` | `lookup()` Looks up the current Grails WebRequest instance
`static GrailsApplication` | `lookupApplication()` Looks up the GrailsApplication from the current request.
`Encoder` | `lookupFilteringEncoder()`
`void` | `requestCompleted()`
`void` | `resetParams()` Reset params by re-reading & initializing parameters from request
`void` | `setActionName(java.lang.String actionName)`
`void` | `setControllerName(java.lang.String controllerName)`
`void` | `setFilteringCodec(java.lang.String codecName)`
`void` | `setFilteringEncoder(Encoder filteringEncoder)`
`void` | `setId(java.lang.Object id)` Sets the id of the request.
`void` | `setOut(java.io.Writer out)` @param out the out to set
`void` | `setRenderView(boolean renderView)`
`void` | `setSkipFilteringCodec(boolean skipCodec)`
`void` | `setWrappedResponse(javax.servlet.http.HttpServletResponse wrappedResponse)`

Methods inherited from class org.springframework.web.servlet.handler.DispatcherServletWebRequest
org.springframework.web.servlet.handler.DispatcherServletWebRequest#getLocale(), org.springframework.web.servlet.handler.DispatcherServletWebRequest#getDescription(boolean), org.springframework.web.servlet.handler.DispatcherServletWebRequest#getHeader(java.lang.String), org.springframework.web.servlet.handler.DispatcherServletWebRequest#toString(), org.springframework.web.servlet.handler.DispatcherServletWebRequest#isSecure(), org.springframework.web.servlet.handler.DispatcherServletWebRequest#getParameter(java.lang.String), org.springframework.web.servlet.handler.DispatcherServletWebRequest#getUserPrincipal(), org.springframework.web.servlet.handler.DispatcherServletWebRequest#getResponse(), org.springframework.web.servlet.handler.DispatcherServletWebRequest#getContextPath(), org.springframework.web.servlet.handler.DispatcherServletWebRequest#getNativeRequest(java.lang.Class), org.springframework.web.servlet.handler.DispatcherServletWebRequest#getNativeRequest(), org.springframework.web.servlet.handler.DispatcherServletWebRequest#isNotModified(), org.springframework.web.servlet.handler.DispatcherServletWebRequest#getNativeResponse(java.lang.Class), org.springframework.web.servlet.handler.DispatcherServletWebRequest#getNativeResponse(), org.springframework.web.servlet.handler.DispatcherServletWebRequest#getParameterValues(java.lang.String), org.springframework.web.servlet.handler.DispatcherServletWebRequest#getParameterMap(), org.springframework.web.servlet.handler.DispatcherServletWebRequest#checkNotModified(long), org.springframework.web.servlet.handler.DispatcherServletWebRequest#checkNotModified(java.lang.String), org.springframework.web.servlet.handler.DispatcherServletWebRequest#getParameterNames(), org.springframework.web.servlet.handler.DispatcherServletWebRequest#getHeaderValues(java.lang.String), org.springframework.web.servlet.handler.DispatcherServletWebRequest#getHeaderNames(), org.springframework.web.servlet.handler.DispatcherServletWebRequest#getRemoteUser(), org.springframework.web.servlet.handler.DispatcherServletWebRequest#isUserInRole(java.lang.String), org.springframework.web.servlet.handler.DispatcherServletWebRequest#getAttribute(java.lang.String, int), org.springframework.web.servlet.handler.DispatcherServletWebRequest#setAttribute(java.lang.String, java.lang.Object, int), org.springframework.web.servlet.handler.DispatcherServletWebRequest#removeAttribute(java.lang.String, int), org.springframework.web.servlet.handler.DispatcherServletWebRequest#getRequest(), org.springframework.web.servlet.handler.DispatcherServletWebRequest#getAttributeNames(int), org.springframework.web.servlet.handler.DispatcherServletWebRequest#getSessionId(), org.springframework.web.servlet.handler.DispatcherServletWebRequest#resolveReference(java.lang.String), org.springframework.web.servlet.handler.DispatcherServletWebRequest#getSessionMutex(), org.springframework.web.servlet.handler.DispatcherServletWebRequest#registerDestructionCallback(java.lang.String, java.lang.Runnable, int), org.springframework.web.servlet.handler.DispatcherServletWebRequest#requestCompleted(), org.springframework.web.servlet.handler.DispatcherServletWebRequest#wait(long, int), org.springframework.web.servlet.handler.DispatcherServletWebRequest#wait(long), org.springframework.web.servlet.handler.DispatcherServletWebRequest#wait(), org.springframework.web.servlet.handler.DispatcherServletWebRequest#equals(java.lang.Object), org.springframework.web.servlet.handler.DispatcherServletWebRequest#hashCode(), org.springframework.web.servlet.handler.DispatcherServletWebRequest#getClass(), org.springframework.web.servlet.handler.DispatcherServletWebRequest#notify(), org.springframework.web.servlet.handler.DispatcherServletWebRequest#notifyAll()

Methods inherited from class org.springframework.web.context.request.ServletWebRequest
org.springframework.web.context.request.ServletWebRequest#getLocale(), org.springframework.web.context.request.ServletWebRequest#getDescription(boolean), org.springframework.web.context.request.ServletWebRequest#getHeader(java.lang.String), org.springframework.web.context.request.ServletWebRequest#toString(), org.springframework.web.context.request.ServletWebRequest#isSecure(), org.springframework.web.context.request.ServletWebRequest#getParameter(java.lang.String), org.springframework.web.context.request.ServletWebRequest#getUserPrincipal(), org.springframework.web.context.request.ServletWebRequest#getResponse(), org.springframework.web.context.request.ServletWebRequest#getContextPath(), org.springframework.web.context.request.ServletWebRequest#getNativeRequest(java.lang.Class), org.springframework.web.context.request.ServletWebRequest#getNativeRequest(), org.springframework.web.context.request.ServletWebRequest#isNotModified(), org.springframework.web.context.request.ServletWebRequest#getNativeResponse(java.lang.Class), org.springframework.web.context.request.ServletWebRequest#getNativeResponse(), org.springframework.web.context.request.ServletWebRequest#getParameterValues(java.lang.String), org.springframework.web.context.request.ServletWebRequest#getParameterMap(), org.springframework.web.context.request.ServletWebRequest#checkNotModified(long), org.springframework.web.context.request.ServletWebRequest#checkNotModified(java.lang.String), org.springframework.web.context.request.ServletWebRequest#getParameterNames(), org.springframework.web.context.request.ServletWebRequest#getHeaderValues(java.lang.String), org.springframework.web.context.request.ServletWebRequest#getHeaderNames(), org.springframework.web.context.request.ServletWebRequest#getRemoteUser(), org.springframework.web.context.request.ServletWebRequest#isUserInRole(java.lang.String), org.springframework.web.context.request.ServletWebRequest#getAttribute(java.lang.String, int), org.springframework.web.context.request.ServletWebRequest#setAttribute(java.lang.String, java.lang.Object, int), org.springframework.web.context.request.ServletWebRequest#removeAttribute(java.lang.String, int), org.springframework.web.context.request.ServletWebRequest#getRequest(), org.springframework.web.context.request.ServletWebRequest#getAttributeNames(int), org.springframework.web.context.request.ServletWebRequest#getSessionId(), org.springframework.web.context.request.ServletWebRequest#resolveReference(java.lang.String), org.springframework.web.context.request.ServletWebRequest#getSessionMutex(), org.springframework.web.context.request.ServletWebRequest#registerDestructionCallback(java.lang.String, java.lang.Runnable, int), org.springframework.web.context.request.ServletWebRequest#requestCompleted(), org.springframework.web.context.request.ServletWebRequest#wait(long, int), org.springframework.web.context.request.ServletWebRequest#wait(long), org.springframework.web.context.request.ServletWebRequest#wait(), org.springframework.web.context.request.ServletWebRequest#equals(java.lang.Object), org.springframework.web.context.request.ServletWebRequest#hashCode(), org.springframework.web.context.request.ServletWebRequest#getClass(), org.springframework.web.context.request.ServletWebRequest#notify(), org.springframework.web.context.request.ServletWebRequest#notifyAll()

Field Detail

### ID_PARAMETER

    public static final java.lang.String ID_PARAMETER

Constructor Detail

### GrailsWebRequest

    public GrailsWebRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, GrailsApplicationAttributes attributes)

### GrailsWebRequest

    public GrailsWebRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.ServletContext servletContext)

### GrailsWebRequest

    public GrailsWebRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.ServletContext servletContext, org.springframework.context.ApplicationContext applicationContext)

Method Detail

### addParameterListener

    public void addParameterListener(ParameterCreationListener creationListener)

### addParametersFrom

    @java.lang.SuppressWarnings("rawtypes")
    public void addParametersFrom(java.util.Map previousParams)

### getActionName

    public java.lang.String getActionName()

  Returns:
    the actionName

### getApplicationContext

    public org.springframework.context.ApplicationContext getApplicationContext()

  Obtains the ApplicationContext object.
  Returns:
    The ApplicationContext

### getAttributes

    public GrailsApplicationAttributes getAttributes()

  Returns:
    The GrailsApplicationAttributes instance

### getBaseUrl

    public java.lang.String getBaseUrl()

### getContextPath

    @java.lang.Override
    public java.lang.String getContextPath()

  Returns the context path of the request.
  Returns:
    the path

### getControllerName

    public java.lang.String getControllerName()

  Returns:
    the controllerName

### getCurrentRequest

    public javax.servlet.http.HttpServletRequest getCurrentRequest()

  Returns:
    The currently executing request

### getCurrentResponse

    public javax.servlet.http.HttpServletResponse getCurrentResponse()

### getEncodingStateRegistry

    public EncodingStateRegistry getEncodingStateRegistry()

### getFilteringCodec

    public java.lang.String getFilteringCodec()

### getFilteringEncoder

    public Encoder getFilteringEncoder()

### getFlashScope

    public FlashScope getFlashScope()

  Returns:
    The FlashScope instance for the current request

### getId

    public java.lang.String getId()

### getOut

    public java.io.Writer getOut()

  Returns:
    the out

### getParameterMap

    @java.lang.Override
    @java.lang.SuppressWarnings({ "unchecked", "rawtypes" })
    public java.util.Map getParameterMap()

  Overriden to return the GrailsParameterMap instance,
  Returns:
    An instance of GrailsParameterMap

### getParams

    public GrailsParameterMap getParams()

  Returns:
    The Grails params object

### getPropertyEditorRegistry

    public org.springframework.beans.PropertyEditorRegistry getPropertyEditorRegistry()

  Obtains the PropertyEditorRegistry instance.
  Returns:
    The PropertyEditorRegistry

### getServletContext

    public javax.servlet.ServletContext getServletContext()

  Returns:
    The ServletContext instance

### getSession

    public GrailsHttpSession getSession()

  Returns:
    The Grails session object

### getWrappedResponse

    public javax.servlet.http.HttpServletResponse getWrappedResponse()

### informParameterCreationListeners

    public void informParameterCreationListeners()

  Informs any parameter creation listeners.

### isActive

    public boolean isActive()

  Whether the web request is still active
  Returns:
    true if it is

### isFlowRequest

    public boolean isFlowRequest()

  Returns true if the current executing request is a flow request
  Returns:
    true if it is a flow request

### isRenderView

    public boolean isRenderView()

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

### isSkipFilteringCodec

    public boolean isSkipFilteringCodec()

  Returns:
    true if grails.views.filteringCodecForMimeType settings should be ignored for this request

### lookup

    public static GrailsWebRequest lookup(javax.servlet.http.HttpServletRequest request)

  Looks up the GrailsWebRequest from the current request.
  Parameters:
    `request` - The current request
  Returns:
    The GrailsWebRequest

### lookup

    public static GrailsWebRequest lookup()

  Looks up the current Grails WebRequest instance
  Returns:
    The GrailsWebRequest instance

### lookupApplication

    public static GrailsApplication lookupApplication()

  Looks up the GrailsApplication from the current request.
  Returns:
    The GrailsWebRequest

### lookupFilteringEncoder

    public Encoder lookupFilteringEncoder()

### requestCompleted

    @java.lang.Override
    public void requestCompleted()

### resetParams

    public void resetParams()

  Reset params by re-reading & initializing parameters from request

### setActionName

    public void setActionName(java.lang.String actionName)

### setControllerName

    public void setControllerName(java.lang.String controllerName)

### setFilteringCodec

    public void setFilteringCodec(java.lang.String codecName)

### setFilteringEncoder

    public void setFilteringEncoder(Encoder filteringEncoder)

### setId

    public void setId(java.lang.Object id)

  Sets the id of the request.
  Parameters:
    `id` - The id

### setOut

    public void setOut(java.io.Writer out)

  Parameters:
    `out` - the out to set

### setRenderView

    public void setRenderView(boolean renderView)

### setSkipFilteringCodec

    public void setSkipFilteringCodec(boolean skipCodec)

### setWrappedResponse

    public void setWrappedResponse(javax.servlet.http.HttpServletResponse wrappedResponse)

Groovy Documentation