org.springframework.web.portlet.mvc
Class ParameterizableViewController

java.lang.Object
  extended by org.springframework.context.support.ApplicationObjectSupport
      extended by org.springframework.web.portlet.context.PortletApplicationObjectSupport
          extended by org.springframework.web.portlet.handler.PortletContentGenerator
              extended by org.springframework.web.portlet.mvc.AbstractController
                  extended by org.springframework.web.portlet.mvc.ParameterizableViewController
All Implemented Interfaces:
ApplicationContextAware, PortletContextAware, Controller

public class ParameterizableViewController
extends AbstractController

Trivial controller that always returns a named view. The view can be configured using an exposed configuration property. This controller offers an alternative to sending a request straight to a view such as a JSP. The advantage here is that the client is not exposed to the concrete view technology but rather just to the controller URL; the concrete view will be determined by the ViewResolver.

Workflow (and that defined by superclass):

  1. Render request is received by the controller
  2. call to handleRenderRequestInternal which just returns the view, named by the configuration property viewName. Nothing more, nothing less

This controller does not handle action requests.

Exposed configuration properties (and those defined by superclass):

name default description
viewName null the name of the view the viewResolver will use to forward to (if this property is not set, an exception will be thrown during initialization)

Since:
2.0
Author:
John A. Lewis

Field Summary
 
Fields inherited from class org.springframework.context.support.ApplicationObjectSupport
logger
 
Constructor Summary
ParameterizableViewController()
           
 
Method Summary
 String getViewName()
          Return the name of the view to delegate to.
protected  ModelAndView handleRenderRequestInternal(javax.portlet.RenderRequest request, javax.portlet.RenderResponse response)
          Return a ModelAndView object with the specified view name.
protected  void initApplicationContext()
          Subclasses can override this for custom initialization behavior.
 void setViewName(String viewName)
          Set the name of the view to delegate to.
 
Methods inherited from class org.springframework.web.portlet.mvc.AbstractController
handleActionRequest, handleActionRequestInternal, handleRenderRequest, isRenderWhenMinimized, isSynchronizeOnSession, setRenderWhenMinimized, setSynchronizeOnSession
 
Methods inherited from class org.springframework.web.portlet.handler.PortletContentGenerator
applyCacheSeconds, cacheForSeconds, check, checkAndPrepare, checkAndPrepare, getCacheSeconds, isRequireSession, preventCaching, setCacheSeconds, setRequireSession
 
Methods inherited from class org.springframework.web.portlet.context.PortletApplicationObjectSupport
getPortletContext, getTempDir, isContextRequired, setPortletContext
 
Methods inherited from class org.springframework.context.support.ApplicationObjectSupport
getApplicationContext, getMessageSourceAccessor, initApplicationContext, requiredContextClass, setApplicationContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ParameterizableViewController

public ParameterizableViewController()
Method Detail

setViewName

public void setViewName(String viewName)
Set the name of the view to delegate to.


getViewName

public String getViewName()
Return the name of the view to delegate to.


initApplicationContext

protected void initApplicationContext()
Description copied from class: ApplicationObjectSupport
Subclasses can override this for custom initialization behavior.

The default implementation is empty. Called by ApplicationObjectSupport.initApplicationContext(org.springframework.context.ApplicationContext).

Overrides:
initApplicationContext in class ApplicationObjectSupport
See Also:
ApplicationObjectSupport.setApplicationContext(org.springframework.context.ApplicationContext)

handleRenderRequestInternal

protected ModelAndView handleRenderRequestInternal(javax.portlet.RenderRequest request,
                                                   javax.portlet.RenderResponse response)
                                            throws Exception
Return a ModelAndView object with the specified view name.

Overrides:
handleRenderRequestInternal in class AbstractController
Throws:
Exception
See Also:
AbstractController.handleRenderRequest(javax.portlet.RenderRequest, javax.portlet.RenderResponse), AbstractController.handleActionRequestInternal(javax.portlet.ActionRequest, javax.portlet.ActionResponse)