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

java.lang.Object
  extended by org.springframework.web.context.request.AbstractRequestAttributes
      extended by org.springframework.web.context.request.ServletRequestAttributes
          extended by org.springframework.web.context.request.ServletWebRequest
              extended by org.springframework.web.servlet.handler.DispatcherServletWebRequest
                  extended by org.codehaus.groovy.grails.web.servlet.mvc.GrailsWebRequest
All Implemented Interfaces:
ParameterInitializationCallback, 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
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 getControllerName()
           
 HttpServletRequest getCurrentRequest()
           
 HttpServletResponse getCurrentResponse()
           
 FlashScope getFlashScope()
           
 String getId()
           
 Writer getOut()
           
 Map getParameterMap()
          Overriden to return the GrailsParameterMap instance
 GrailsParameterMap getParams()
           
 ServletContext getServletContext()
           
 GrailsHttpSession getSession()
           
 boolean isFlowRequest()
          Returns true if the current executing request is a flow request
 boolean isRenderView()
           
 void setActionName(String actionName)
           
 void setControllerName(String controllerName)
           
 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, getContextPath, getDescription, getParameter, getParameterValues, getRemoteUser, getUserPrincipal, isNotModified, isSecure, isUserInRole, toString
 
Methods inherited from class org.springframework.web.context.request.ServletRequestAttributes
getAttribute, getAttributeNames, getRequest, getSession, getSessionId, getSessionMutex, registerDestructionCallback, removeAttribute, setAttribute, updateAccessedSessionAttributes
 
Methods inherited from class org.springframework.web.context.request.AbstractRequestAttributes
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, 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

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 GrailsParameterMap getParams()
Returns:
The Grails params object

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


Copyright (c) 2005-2006 The Grails project