public class

ViewRendererServlet

extends HttpServlet
java.lang.Object
   ↳ javax.servlet.GenericServlet
     ↳ javax.servlet.http.HttpServlet
       ↳ org.springframework.web.servlet.ViewRendererServlet

Class Overview

ViewRendererServlet is a bridge servlet, mainly for the Portlet MVC support.

For usage with Portlets, this Servlet is necessary to force the portlet container to convert the PortletRequest to a ServletRequest, which it has to do when including a resource via the PortletRequestDispatcher. This allows for reuse of the entire Servlet-based View support even in a Portlet environment.

The actual mapping of the bridge servlet is configurable in the DispatcherPortlet, via a "viewRendererUrl" property. The default is "/WEB-INF/servlet/view", which is just available for internal resource dispatching.

Summary

Fields
public static final String MODEL_ATTRIBUTE Name of request attribute that holds the model Map
public static final String VIEW_ATTRIBUTE Name of request attribute that holds the View object
public static final String WEB_APPLICATION_CONTEXT_ATTRIBUTE Request attribute to hold current web application context.
Public Constructors
ViewRendererServlet()
Protected Methods
final void doGet(HttpServletRequest request, HttpServletResponse response)
final void doPost(HttpServletRequest request, HttpServletResponse response)
final void processRequest(HttpServletRequest request, HttpServletResponse response)
Process this request, handling exceptions.
void renderView(HttpServletRequest request, HttpServletResponse response)
Retrieve the View instance and model Map to render and trigger actual rendering.
[Expand]
Inherited Methods
From class javax.servlet.http.HttpServlet
From class javax.servlet.GenericServlet
From class java.lang.Object
From interface javax.servlet.Servlet
From interface javax.servlet.ServletConfig

Fields

public static final String MODEL_ATTRIBUTE

Name of request attribute that holds the model Map

public static final String VIEW_ATTRIBUTE

Name of request attribute that holds the View object

public static final String WEB_APPLICATION_CONTEXT_ATTRIBUTE

Request attribute to hold current web application context. Otherwise only the global web app context is obtainable by tags etc.

Public Constructors

public ViewRendererServlet ()

Protected Methods

protected final void doGet (HttpServletRequest request, HttpServletResponse response)

Throws
IOException
ServletException

protected final void doPost (HttpServletRequest request, HttpServletResponse response)

Throws
IOException
ServletException

protected final void processRequest (HttpServletRequest request, HttpServletResponse response)

Process this request, handling exceptions. The actually event handling is performed by the abstract renderView() template method.

Throws
IOException
ServletException

protected void renderView (HttpServletRequest request, HttpServletResponse response)

Retrieve the View instance and model Map to render and trigger actual rendering.

Parameters
request current HTTP request
response current HTTP response
Throws
Exception in case of any kind of processing failure