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

java.lang.Object
  extended by org.codehaus.groovy.grails.web.servlet.mvc.AbstractGrailsControllerHelper
All Implemented Interfaces:
org.codehaus.groovy.grails.plugins.support.aware.GrailsApplicationAware, org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware, org.springframework.web.context.ServletContextAware
Direct Known Subclasses:
ClosureGrailsControllerHelper, MethodGrailsControllerHelper, MixedGrailsControllerHelper

public abstract class AbstractGrailsControllerHelper
extends java.lang.Object
implements org.springframework.context.ApplicationContextAware, org.springframework.web.context.ServletContextAware, org.codehaus.groovy.grails.plugins.support.aware.GrailsApplicationAware

Processes Grails controller requests and responses.

Since:
2.0

Field Summary
protected  org.codehaus.groovy.grails.commons.GrailsApplication application
           
protected  org.springframework.context.ApplicationContext applicationContext
           
protected  GrailsApplicationAttributes grailsAttributes
           
protected  javax.servlet.ServletContext servletContext
           
 
Constructor Summary
AbstractGrailsControllerHelper()
           
 
Method Summary
protected  org.springframework.web.servlet.ModelAndView executeAction(groovy.lang.GroovyObject controller, java.lang.String actionName, java.lang.String viewName, GrailsWebRequest webRequest, java.util.Map params)
          Invokes the action defined by the webRequest for the given arguments.
 org.codehaus.groovy.grails.commons.GrailsControllerClass getControllerClassByName(java.lang.String name)
           
 org.codehaus.groovy.grails.commons.GrailsControllerClass getControllerClassByURI(java.lang.String uri)
           
 groovy.lang.GroovyObject getControllerInstance(org.codehaus.groovy.grails.commons.GrailsControllerClass controllerClass)
           
 GrailsApplicationAttributes getGrailsAttributes()
           
 javax.servlet.ServletContext getServletContext()
           
 java.lang.Object handleAction(groovy.lang.GroovyObject controller, java.lang.Object action, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
 java.lang.Object handleAction(groovy.lang.GroovyObject controller, java.lang.Object action, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.util.Map params)
           
 org.springframework.web.servlet.ModelAndView handleActionResponse(groovy.lang.GroovyObject controller, java.lang.Object returnValue, GrailsWebRequest webRequest, java.util.Map chainModel, java.lang.String closurePropertyName, java.lang.String viewName)
           
 org.springframework.web.servlet.ModelAndView handleURI(java.lang.String uri, GrailsWebRequest request)
           
 org.springframework.web.servlet.ModelAndView handleURI(java.lang.String uri, GrailsWebRequest grailsWebRequest, java.util.Map params)
           
protected abstract  java.lang.Object invoke(groovy.lang.GroovyObject controller, java.lang.Object action)
           
protected abstract  java.lang.Object retrieveAction(groovy.lang.GroovyObject controller, java.lang.String actionName, javax.servlet.http.HttpServletResponse response)
           
 void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
           
 void setGrailsApplication(org.codehaus.groovy.grails.commons.GrailsApplication application)
           
 void setServletContext(javax.servlet.ServletContext servletContext)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

application

protected org.codehaus.groovy.grails.commons.GrailsApplication application

applicationContext

protected org.springframework.context.ApplicationContext applicationContext

servletContext

protected javax.servlet.ServletContext servletContext

grailsAttributes

protected GrailsApplicationAttributes grailsAttributes
Constructor Detail

AbstractGrailsControllerHelper

public AbstractGrailsControllerHelper()
Method Detail

getServletContext

public javax.servlet.ServletContext getServletContext()

getControllerClassByName

public org.codehaus.groovy.grails.commons.GrailsControllerClass getControllerClassByName(java.lang.String name)

getControllerClassByURI

public org.codehaus.groovy.grails.commons.GrailsControllerClass getControllerClassByURI(java.lang.String uri)

getControllerInstance

public groovy.lang.GroovyObject getControllerInstance(org.codehaus.groovy.grails.commons.GrailsControllerClass controllerClass)

handleURI

public org.springframework.web.servlet.ModelAndView handleURI(java.lang.String uri,
                                                              GrailsWebRequest request)

handleURI

public org.springframework.web.servlet.ModelAndView handleURI(java.lang.String uri,
                                                              GrailsWebRequest grailsWebRequest,
                                                              java.util.Map params)

retrieveAction

protected abstract java.lang.Object retrieveAction(groovy.lang.GroovyObject controller,
                                                   java.lang.String actionName,
                                                   javax.servlet.http.HttpServletResponse response)

executeAction

protected org.springframework.web.servlet.ModelAndView executeAction(groovy.lang.GroovyObject controller,
                                                                     java.lang.String actionName,
                                                                     java.lang.String viewName,
                                                                     GrailsWebRequest webRequest,
                                                                     java.util.Map params)
Invokes the action defined by the webRequest for the given arguments.

Parameters:
controller - The controller instance
actionName - The current action
viewName - The name of the view to delegate to if necessary
webRequest - the current web Request
params - A map of parameters
Returns:
A Spring ModelAndView instance

getGrailsAttributes

public GrailsApplicationAttributes getGrailsAttributes()

handleAction

public java.lang.Object handleAction(groovy.lang.GroovyObject controller,
                                     java.lang.Object action,
                                     javax.servlet.http.HttpServletRequest request,
                                     javax.servlet.http.HttpServletResponse response)

invoke

protected abstract java.lang.Object invoke(groovy.lang.GroovyObject controller,
                                           java.lang.Object action)

handleAction

public java.lang.Object handleAction(groovy.lang.GroovyObject controller,
                                     java.lang.Object action,
                                     javax.servlet.http.HttpServletRequest request,
                                     javax.servlet.http.HttpServletResponse response,
                                     java.util.Map params)

handleActionResponse

public org.springframework.web.servlet.ModelAndView handleActionResponse(groovy.lang.GroovyObject controller,
                                                                         java.lang.Object returnValue,
                                                                         GrailsWebRequest webRequest,
                                                                         java.util.Map chainModel,
                                                                         java.lang.String closurePropertyName,
                                                                         java.lang.String viewName)

setApplicationContext

public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
                           throws org.springframework.beans.BeansException
Specified by:
setApplicationContext in interface org.springframework.context.ApplicationContextAware
Throws:
org.springframework.beans.BeansException

setServletContext

public void setServletContext(javax.servlet.ServletContext servletContext)
Specified by:
setServletContext in interface org.springframework.web.context.ServletContextAware

setGrailsApplication

public void setGrailsApplication(org.codehaus.groovy.grails.commons.GrailsApplication application)
Specified by:
setGrailsApplication in interface org.codehaus.groovy.grails.plugins.support.aware.GrailsApplicationAware