org.springframework.web.servlet.view
Class InternalResourceView

java.lang.Object
  extended byorg.springframework.context.support.ApplicationObjectSupport
      extended byorg.springframework.web.context.support.WebApplicationObjectSupport
          extended byorg.springframework.web.servlet.view.AbstractView
              extended byorg.springframework.web.servlet.view.AbstractUrlBasedView
                  extended byorg.springframework.web.servlet.view.InternalResourceView
All Implemented Interfaces:
ApplicationContextAware, BeanNameAware, View
Direct Known Subclasses:
JstlView, TilesView

public class InternalResourceView
extends AbstractUrlBasedView

Wrapper for a JSP or other resource within the same web application. Exposes model objects as request attributes and forwards the request to the specified resource URL using a RequestDispatcher. Will fall back to an include if already in an included request.

A URL for this view is supposed to specify a resource within the web application, i.e. suitable for RequestDispatcher's forward/include methods.

Version:
$Id: InternalResourceView.java,v 1.10 2004/03/18 02:46:11 trisberg Exp $
Author:
Rod Johnson, Juergen Hoeller
See Also:
RequestDispatcher.forward(javax.servlet.ServletRequest, javax.servlet.ServletResponse), RequestDispatcher.include(javax.servlet.ServletRequest, javax.servlet.ServletResponse)

Field Summary
 
Fields inherited from class org.springframework.context.support.ApplicationObjectSupport
logger
 
Constructor Summary
InternalResourceView()
          Constructor for use as a bean.
InternalResourceView(java.lang.String url)
          Create a new InternalResourceView with the given URL.
 
Method Summary
protected  void exposeModelAsRequestAttributes(java.util.Map model, javax.servlet.http.HttpServletRequest request)
          Expose the model objects in the given map as request attributes.
protected  void renderMergedOutputModel(java.util.Map model, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Render the internal resource given the specified model.
 
Methods inherited from class org.springframework.web.servlet.view.AbstractUrlBasedView
getUrl, initApplicationContext, setUrl
 
Methods inherited from class org.springframework.web.servlet.view.AbstractView
addStaticAttribute, getBeanName, getContentType, getStaticAttributes, render, setAttributes, setAttributesCSV, setAttributesMap, setBeanName, setContentType, setRequestContextAttribute
 
Methods inherited from class org.springframework.web.context.support.WebApplicationObjectSupport
getServletContext, getTempDir, getWebApplicationContext, requiredContextClass
 
Methods inherited from class org.springframework.context.support.ApplicationObjectSupport
getApplicationContext, getMessageSourceAccessor, setApplicationContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InternalResourceView

public InternalResourceView()
Constructor for use as a bean.


InternalResourceView

public InternalResourceView(java.lang.String url)
Create a new InternalResourceView with the given URL.

Parameters:
url - the URL to forward to
Method Detail

renderMergedOutputModel

protected void renderMergedOutputModel(java.util.Map model,
                                       javax.servlet.http.HttpServletRequest request,
                                       javax.servlet.http.HttpServletResponse response)
                                throws java.lang.Exception
Render the internal resource given the specified model. This includes setting the model as request attributes.

Specified by:
renderMergedOutputModel in class AbstractView
Parameters:
model - combined output Map, with dynamic values taking precedence over static attributes
request - current HTTP request
response - current HTTP response
Throws:
java.lang.Exception - if rendering failed

exposeModelAsRequestAttributes

protected void exposeModelAsRequestAttributes(java.util.Map model,
                                              javax.servlet.http.HttpServletRequest request)
                                       throws javax.servlet.ServletException
Expose the model objects in the given map as request attributes. Names will be taken from the map. This method is suitable for all resources reachable by RequestDispatcher.

Parameters:
model - Map of model objects to expose
request - current HTTP request
Throws:
javax.servlet.ServletException


Copyright (C) 2003-2004 The Spring Framework Project.