org.riotfamily.website.view
Class ConfigurableViewController

java.lang.Object
  extended by org.riotfamily.website.view.ConfigurableViewController
All Implemented Interfaces:
Controller
Direct Known Subclasses:
CacheableViewController, PageController

public class ConfigurableViewController
extends Object
implements Controller

Class similar to Spring's ParameterizableViewController, with the following two differences:

Since:
8.0
Author:
Carsten Woelk [cwoelk at neteye dot de], Felix Gnass [fgnass at neteye dot de]

Constructor Summary
ConfigurableViewController()
           
 
Method Summary
 ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
          Creates a ModelAndView with the configured viewName and invokes populateModel(Model, HttpServletRequest).
protected  void populateModel(Model model, HttpServletRequest request)
          Can be overwritten by subclasses to populate the model.
 void setContentType(String contentType)
          Sets the content type to be set in the header.
 void setViewName(String viewName)
          Sets the name of the view to delegate to.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConfigurableViewController

public ConfigurableViewController()
Method Detail

setViewName

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


setContentType

public void setContentType(String contentType)
Sets the content type to be set in the header.


handleRequest

public ModelAndView handleRequest(HttpServletRequest request,
                                  HttpServletResponse response)
                           throws Exception
Creates a ModelAndView with the configured viewName and invokes populateModel(Model, HttpServletRequest). If a contentType is configured, ServletResponse.setContentType(String) is invoked.

Specified by:
handleRequest in interface Controller
Throws:
Exception

populateModel

protected void populateModel(Model model,
                             HttpServletRequest request)
Can be overwritten by subclasses to populate the model. The default implementation does nothing, hence an empty model is passed to the view.