Groovy Documentation

## org.codehaus.groovy.grails.web.servlet.mvc
[Java] Class GrailsWebRequest

    java.lang.Object
      org.springframework.web.servlet.handler.DispatcherServletWebRequest
          org.codehaus.groovy.grails.web.servlet.mvc.GrailsWebRequest

All Implemented Interfaces:
  ParameterInitializationCallback

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

Authors:
  Graeme Rocher

Since:
  0.4

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

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

Method Summary
`void` | `addParameterListener(ParameterCreationListener creationListener)`
`java.lang.String` | `getActionName()` @return the actionName
`ApplicationContext` | `getApplicationContext()` Obtains the ApplicationContext object.
`GrailsApplicationAttributes` | `getAttributes()` @return The GrailsApplicationAttributes instance
`java.lang.String` | `getContextPath()` Returns the context path of the request.
`java.lang.String` | `getControllerName()` @return the controllerName
`HttpServletRequest` | `getCurrentRequest()` @return The currently executing request
`HttpServletResponse` | `getCurrentResponse()`
`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
`PropertyEditorRegistry` | `getPropertyEditorRegistry()` Obtains the PropertyEditorRegistry instance.
`ServletContext` | `getServletContext()` @return The ServletContext instance
`GrailsHttpSession` | `getSession()` @return The Grails session object
`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
`static GrailsWebRequest` | `lookup(HttpServletRequest request)` Looks up the GrailsWebRequest from the current request.
`void` | `setActionName(java.lang.String actionName)`
`void` | `setControllerName(java.lang.String controllerName)`
`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)`

Field Detail

### ID_PARAMETER

    public static final java.lang.String ID_PARAMETER

Constructor Detail

### GrailsWebRequest

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

Method Detail

### addParameterListener

    public void addParameterListener(ParameterCreationListener creationListener)

### getActionName

    public java.lang.String getActionName()

  Returns:
    the actionName

### getApplicationContext

    public ApplicationContext getApplicationContext()

  Obtains the ApplicationContext object.
  Returns:
    The ApplicationContext

### getAttributes

    public GrailsApplicationAttributes getAttributes()

  Returns:
    The GrailsApplicationAttributes instance

### getContextPath

    @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 HttpServletRequest getCurrentRequest()

  Returns:
    The currently executing request

### getCurrentResponse

    public HttpServletResponse getCurrentResponse()

### 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

    @Override
    @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 PropertyEditorRegistry getPropertyEditorRegistry()

  Obtains the PropertyEditorRegistry instance.
  Returns:
    The PropertyEditorRegistry

### getServletContext

    public ServletContext getServletContext()

  Returns:
    The ServletContext instance

### getSession

    public GrailsHttpSession getSession()

  Returns:
    The Grails session object

### 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

### lookup

    public static GrailsWebRequest lookup(HttpServletRequest request)

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

### setActionName

    public void setActionName(java.lang.String actionName)

### setControllerName

    public void setControllerName(java.lang.String controllerName)

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

Groovy Documentation