public class ViewRendererServlet extends HttpServlet
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.
Modifier and Type | Field and Description |
---|---|
static String |
MODEL_ATTRIBUTE
Name of request attribute that holds the model Map
|
static String |
VIEW_ATTRIBUTE
Name of request attribute that holds the View object
|
static String |
WEB_APPLICATION_CONTEXT_ATTRIBUTE
Request attribute to hold current web application context.
|
Constructor and Description |
---|
ViewRendererServlet() |
Modifier and Type | Method and Description |
---|---|
protected void |
doGet(HttpServletRequest request,
HttpServletResponse response) |
protected void |
doPost(HttpServletRequest request,
HttpServletResponse response) |
protected void |
processRequest(HttpServletRequest request,
HttpServletResponse response)
Process this request, handling exceptions.
|
protected void |
renderView(HttpServletRequest request,
HttpServletResponse response)
Retrieve the View instance and model Map to render
and trigger actual rendering.
|
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
public static final String WEB_APPLICATION_CONTEXT_ATTRIBUTE
public static final String VIEW_ATTRIBUTE
public static final String MODEL_ATTRIBUTE
protected final void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
doGet
in class HttpServlet
ServletException
IOException
protected final void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
doPost
in class HttpServlet
ServletException
IOException
protected final void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
renderView()
template method.protected void renderView(HttpServletRequest request, HttpServletResponse response) throws Exception
request
- current HTTP requestresponse
- current HTTP responseException
- in case of any kind of processing failureView.render(java.util.Map<java.lang.String, ?>, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)