public class GrailsWebRequest extends 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()
The request this exposes through getRequest() is always the outermost request, so wrappers contributed by other filters keep working. Multipart capabilities are discovered from its wrapper chain rather than by substituting the request - see WebUtils.resolveMultipartRequest.
| Modifiers | Name | Description |
|---|---|---|
static java.lang.String |
ID_PARAMETER |
| Fields inherited from class | Fields |
|---|---|
class DispatcherServletWebRequest |
SCOPE_REQUEST, SCOPE_SESSION, REFERENCE_REQUEST, REFERENCE_SESSION, DESTRUCTION_CALLBACK_NAME_PREFIX |
| Constructor and description |
|---|
GrailsWebRequest(HttpServletRequest request, HttpServletResponse response, GrailsApplicationAttributes attributes) |
GrailsWebRequest(HttpServletRequest request, HttpServletResponse response, ServletContext servletContext) |
GrailsWebRequest(HttpServletRequest request, HttpServletResponse response, ServletContext servletContext, ApplicationContext applicationContext) |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public void |
addParameterListener(ParameterCreationListener creationListener) |
|
public void |
addParametersFrom(java.util.Map previousParams) |
|
public java.lang.String |
getActionName()
|
|
public ApplicationContext |
getApplicationContext()Obtains the ApplicationContext object. |
|
public GrailsApplicationAttributes |
getAttributes()
|
|
public java.lang.String |
getBaseUrl() |
|
public java.lang.String |
getContextPath()Returns the context path of the request. |
|
public GrailsControllerClass |
getControllerClass()
|
|
public java.lang.String |
getControllerName()
|
|
public java.lang.String |
getControllerNamespace()
|
|
public HttpServletRequest |
getCurrentRequest()
|
|
public HttpServletResponse |
getCurrentResponse() |
|
public EncodingStateRegistry |
getEncodingStateRegistry() |
|
public java.lang.String |
getFilteringCodec() |
|
public Encoder |
getFilteringEncoder() |
|
public FlashScope |
getFlashScope()
|
|
public java.lang.String |
getId() |
|
public GrailsParameterMap |
getOriginalParams()
|
|
public java.io.Writer |
getOut()
|
|
public java.util.Map |
getParameterMap()Overriden to return the GrailsParameterMap instance, |
|
public GrailsParameterMap |
getParams()
|
|
public PropertyEditorRegistry |
getPropertyEditorRegistry()Obtains the PropertyEditorRegistry instance. |
|
public ServletContext |
getServletContext()
|
|
public GrailsHttpSession |
getSession()
|
|
public HttpServletResponse |
getWrappedResponse() |
|
public void |
informParameterCreationListeners()Informs any parameter creation listeners. |
|
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()
|
|
public boolean |
isSkipFilteringCodec()
|
|
public static GrailsWebRequest |
lookup(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 |
multipartRequestResolved()Discards the cached params so they are rebuilt and pick up uploaded files, for when multipart resolution happens after params were already read. |
|
public void |
requestCompleted() |
|
public void |
resetParams()Reset params by re-reading and 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(HttpServletRequest multipartRequest)
|
|
public void |
setOut(java.io.Writer out)
|
|
public void |
setRenderView(boolean renderView) |
|
public void |
setSkipFilteringCodec(boolean skipCodec) |
|
public void |
setWrappedResponse(HttpServletResponse wrappedResponse) |
Obtains the ApplicationContext object.
Returns the context path of the request.
This used to return the resolved multipart request in place of the request Grails was bound to. That substitution is gone, so this and getRequest() are the same object; either may be called.
Overriden to return the GrailsParameterMap instance,
Obtains the PropertyEditorRegistry instance.
Informs any parameter creation listeners.
Whether the web request is still active
Returns true if the current executing request is a flow request
Looks up the GrailsWebRequest from the current request.
request - The current requestLooks up the current Grails WebRequest instance
Discards the cached params so they are rebuilt and pick up uploaded files, for when multipart resolution happens after params were already read. See gh-13837.
Reset params by re-reading and initializing parameters from request
Sets the id of the request.
id - The idmultipartRequest - the resolved multipart request
out - the out to set