GrailsWebRequest (Grails 6.0.0)

Package: org.grails.web.servlet.mvc

## [Java] Class GrailsWebRequest

- org.grails.web.servlet.mvc.GrailsWebRequest

-     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:
    3.0

- - ### Nested Class Summary

    Nested classes
    Modifiers | Name | Description
    --- | --- | ---
    `private static class` | `GrailsWebRequest.DefaultEncodingStateRegistryLookup` |

  - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `static java.lang.String` | `ID_PARAMETER` |
    `private static java.lang.String` | `REDIRECT_CALLED` |
    `private org.springframework.context.ApplicationContext` | `applicationContext` |
    `private GrailsApplicationAttributes` | `attributes` |
    `private java.lang.String` | `baseUrl` |
    `private EncodingStateRegistry` | `encodingStateRegistry` |
    `private Encoder` | `filteringEncoder` |
    `private static java.lang.Class<? extends GrailsApplicationAttributes>` | `grailsApplicationAttributesClass` |
    `private static java.lang.reflect.Constructor<? extends GrailsApplicationAttributes>` | `grailsApplicationAttributesConstructor` |
    `private javax.servlet.http.HttpServletRequest` | `multipartRequest` |
    `private GrailsParameterMap` | `originalParams` |
    `private java.util.List<ParameterCreationListener>` | `parameterCreationListeners` |
    `private GrailsParameterMap` | `params` |
    `private boolean` | `renderView` |
    `private GrailsHttpSession` | `session` |
    `private boolean` | `skipFilteringCodec` |
    `private org.springframework.web.util.UrlPathHelper` | `urlHelper` |
    `private javax.servlet.http.HttpServletResponse` | `wrappedResponse` |

  - Inherited fields
    Fields inherited from class | Fields
    --- | ---
    `class org.springframework.web.servlet.handler.DispatcherServletWebRequest` | `SCOPE_REQUEST, SCOPE_SESSION, REFERENCE_REQUEST, REFERENCE_SESSION, DESTRUCTION_CALLBACK_NAME_PREFIX`

  - ### Constructor Summary

    Constructors
    Constructor and description
    `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)`

  - ### Methods Summary

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

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class org.springframework.web.servlet.handler.DispatcherServletWebRequest` | `org.springframework.web.servlet.handler.DispatcherServletWebRequest#getLocale(), org.springframework.web.servlet.handler.DispatcherServletWebRequest#getHeader(java.lang.String), org.springframework.web.servlet.handler.DispatcherServletWebRequest#getRemoteUser(), org.springframework.web.servlet.handler.DispatcherServletWebRequest#isUserInRole(java.lang.String), org.springframework.web.servlet.handler.DispatcherServletWebRequest#isNotModified(), org.springframework.web.servlet.handler.DispatcherServletWebRequest#getNativeRequest(java.lang.Class), org.springframework.web.servlet.handler.DispatcherServletWebRequest#getNativeRequest(), org.springframework.web.servlet.handler.DispatcherServletWebRequest#getNativeResponse(java.lang.Class), org.springframework.web.servlet.handler.DispatcherServletWebRequest#getNativeResponse(), org.springframework.web.servlet.handler.DispatcherServletWebRequest#getHttpMethod(), org.springframework.web.servlet.handler.DispatcherServletWebRequest#getHeaderValues(java.lang.String), org.springframework.web.servlet.handler.DispatcherServletWebRequest#checkNotModified(java.lang.String, long), org.springframework.web.servlet.handler.DispatcherServletWebRequest#checkNotModified(java.lang.String), org.springframework.web.servlet.handler.DispatcherServletWebRequest#checkNotModified(long), org.springframework.web.servlet.handler.DispatcherServletWebRequest#getHeaderNames(), org.springframework.web.servlet.handler.DispatcherServletWebRequest#getContextPath(), org.springframework.web.servlet.handler.DispatcherServletWebRequest#getParameterNames(), org.springframework.web.servlet.handler.DispatcherServletWebRequest#getParameterValues(java.lang.String), org.springframework.web.servlet.handler.DispatcherServletWebRequest#getParameterMap(), org.springframework.web.servlet.handler.DispatcherServletWebRequest#getParameter(java.lang.String), org.springframework.web.servlet.handler.DispatcherServletWebRequest#getUserPrincipal(), org.springframework.web.servlet.handler.DispatcherServletWebRequest#isSecure(), org.springframework.web.servlet.handler.DispatcherServletWebRequest#getDescription(boolean), org.springframework.web.servlet.handler.DispatcherServletWebRequest#toString(), org.springframework.web.servlet.handler.DispatcherServletWebRequest#resolveReference(java.lang.String), org.springframework.web.servlet.handler.DispatcherServletWebRequest#getSessionMutex(), org.springframework.web.servlet.handler.DispatcherServletWebRequest#getSessionId(), 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#registerDestructionCallback(java.lang.String, java.lang.Runnable, int), org.springframework.web.servlet.handler.DispatcherServletWebRequest#removeAttribute(java.lang.String, int), org.springframework.web.servlet.handler.DispatcherServletWebRequest#getAttributeNames(int), org.springframework.web.servlet.handler.DispatcherServletWebRequest#getRequest(), org.springframework.web.servlet.handler.DispatcherServletWebRequest#getResponse(), org.springframework.web.servlet.handler.DispatcherServletWebRequest#requestCompleted(), org.springframework.web.servlet.handler.DispatcherServletWebRequest#wait(long), org.springframework.web.servlet.handler.DispatcherServletWebRequest#wait(long, int), 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()`

- - ### Field Detail

    - #### public static final java.lang.String ID_PARAMETER

    - #### private static final java.lang.String REDIRECT_CALLED

    - #### private org.springframework.context.ApplicationContext applicationContext

    - #### private GrailsApplicationAttributes attributes

    - #### private java.lang.String baseUrl

    - #### private EncodingStateRegistry encodingStateRegistry

    - #### private Encoder filteringEncoder

    - #### private static final java.lang.Class<? extends GrailsApplicationAttributes> grailsApplicationAttributesClass

    - #### private static final java.lang.reflect.Constructor<? extends GrailsApplicationAttributes> grailsApplicationAttributesConstructor

    - #### private javax.servlet.http.HttpServletRequest multipartRequest

    - #### private GrailsParameterMap originalParams

    - #### private final java.util.List<ParameterCreationListener> parameterCreationListeners

    - #### private GrailsParameterMap params

    - #### private boolean renderView

    - #### private GrailsHttpSession session

    - #### private boolean skipFilteringCodec

    - #### private final org.springframework.web.util.UrlPathHelper urlHelper

    - #### private javax.servlet.http.HttpServletResponse wrappedResponse

  - ### Constructor Detail

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

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

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

  - ### Method Detail

    - #### public void addParameterListener(ParameterCreationListener creationListener)

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

    - #### public java.lang.String getActionName()

      Returns:
        the actionName

    - #### public org.springframework.context.ApplicationContext getApplicationContext()

      Obtains the ApplicationContext object.

      Returns:
        The ApplicationContext

    - #### public GrailsApplicationAttributes getAttributes()

      Returns:
        The GrailsApplicationAttributes instance

    - #### public java.lang.String getBaseUrl()

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

      Returns the context path of the request.

      Returns:
        the path

    - #### public GrailsControllerClass getControllerClass()

      Returns:
        the controllerClass

    - #### public java.lang.String getControllerName()

      Returns:
        the controllerName

    - #### public java.lang.String getControllerNamespace()

      Returns:
        the controllerNamespace

    - #### public javax.servlet.http.HttpServletRequest getCurrentRequest()

      Returns:
        The currently executing request

    - #### public javax.servlet.http.HttpServletResponse getCurrentResponse()

    - #### public EncodingStateRegistry getEncodingStateRegistry()

    - #### public java.lang.String getFilteringCodec()

    - #### public Encoder getFilteringEncoder()

    - #### public FlashScope getFlashScope()

      Returns:
        The FlashScope instance for the current request

    - #### public java.lang.String getId()

    - #### public GrailsParameterMap getOriginalParams()

      Returns:
        The Grails params object

    - #### public java.io.Writer getOut()

      Returns:
        the out

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

      Overriden to return the GrailsParameterMap instance,

      Returns:
        An instance of GrailsParameterMap

    - #### public GrailsParameterMap getParams()

      Returns:
        The Grails params object

    - #### public org.springframework.beans.PropertyEditorRegistry getPropertyEditorRegistry()

      Obtains the PropertyEditorRegistry instance.

      Returns:
        The PropertyEditorRegistry

    - #### public javax.servlet.ServletContext getServletContext()

      Returns:
        The ServletContext instance

    - #### public GrailsHttpSession getSession()

      Returns:
        The Grails session object

    - #### public javax.servlet.http.HttpServletResponse getWrappedResponse()

    - #### public void informParameterCreationListeners()

      Informs any parameter creation listeners.

    - #### private void inheritEncodingStateRegistry()

    - #### public boolean isActive()

      Whether the web request is still active

      Returns:
        true if it is

    - #### public boolean isFlowRequest()

      Returns true if the current executing request is a flow request

      Returns:
        true if it is a flow request

    - #### public boolean isRenderView()

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

    - #### public boolean isSkipFilteringCodec()

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

    - #### @org.springframework.lang.Nullable 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

    - #### @org.springframework.lang.Nullable public static GrailsWebRequest lookup()

      Looks up the current Grails WebRequest instance

      Returns:
        The GrailsWebRequest instance

    - #### public Encoder lookupFilteringEncoder()

    - #### @java.lang.Override public void requestCompleted()

    - #### public void resetParams()

      Reset params by re-reading & initializing parameters from request

    - #### public void setActionName(java.lang.String actionName)

    - #### public void setControllerName(java.lang.String controllerName)

    - #### public void setControllerNamespace(java.lang.String controllerNamespace)

    - #### public void setFilteringCodec(java.lang.String codecName)

    - #### public void setFilteringEncoder(Encoder filteringEncoder)

    - #### public void setId(java.lang.Object id)

      Sets the id of the request.

      Parameters:
        `id` - The id

    - #### public void setMultipartRequest(javax.servlet.http.HttpServletRequest multipartRequest)

      Holds a reference to the org.springframework.web.multipart.MultipartRequest

      Parameters:
        `multipartRequest` - The multipart request

    - #### public void setOut(java.io.Writer out)

      Parameters:
        `out` - the out to set

    - #### public void setRenderView(boolean renderView)

    - #### public void setSkipFilteringCodec(boolean skipCodec)

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