com.interface21.web.servlet.view
Class InternalResourceView

java.lang.Object
  |
  +--com.interface21.context.support.ApplicationObjectSupport
        |
        +--com.interface21.web.servlet.view.AbstractView
              |
              +--com.interface21.web.servlet.view.InternalResourceView
All Implemented Interfaces:
ApplicationContextAware, View
Direct Known Subclasses:
JstlView

public class InternalResourceView
extends AbstractView

Wrapper for a JSP or other resource within the WAR. Sets request attributes and forwards the request to the specified specified resource using a RequestDispatcher.

Version:
$Id: InternalResourceView.java,v 1.6 2003/06/20 20:28:44 jhoeller Exp $
Author:
Rod Johnson

Fields inherited from class com.interface21.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 exposeModelsAsRequestAttributes(java.util.Map model, javax.servlet.http.HttpServletRequest request)
          Expose the models in the given map as request attributes.
protected  java.lang.String getUrl()
           
protected  void initApplicationContext()
          Overridden lifecycle method to check that URL property is set
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.
 void setUrl(java.lang.String url)
          Set the resource URL that this view forwards to.
 
Methods inherited from class com.interface21.web.servlet.view.AbstractView
addStaticAttribute, getContentType, getName, getStaticAttributes, render, setAttributes, setAttributesCSV, setContentType, setName, setRequestContextAttribute
 
Methods inherited from class com.interface21.context.support.ApplicationObjectSupport
getApplicationContext, 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 - url to forward to
Method Detail

setUrl

public void setUrl(java.lang.String url)
Set the resource URL that this view forwards to.
Parameters:
url - the URL of the resource this view forwards to

getUrl

protected java.lang.String getUrl()

initApplicationContext

protected void initApplicationContext()
                               throws ApplicationContextException
Overridden lifecycle method to check that URL property is set
Overrides:
initApplicationContext in class ApplicationObjectSupport
See Also:
ApplicationObjectSupport.initApplicationContext()

renderMergedOutputModel

protected void renderMergedOutputModel(java.util.Map model,
                                       javax.servlet.http.HttpServletRequest request,
                                       javax.servlet.http.HttpServletResponse response)
                                throws javax.servlet.ServletException
Render the internal resource given the specified model. This includes setting the model as request attributes.
Overrides:
renderMergedOutputModel in class AbstractView
Following copied from class: com.interface21.web.servlet.view.AbstractView
Parameters:
model - combined output Map, with dynamic values taking precedence over static attributes
request - current HTTP request
response - current HTTP response
Throws:
java.io.IOException - if there is an IO exception trying to obtain or render the view
javax.servlet.ServletException - if there is any other error

exposeModelsAsRequestAttributes

protected void exposeModelsAsRequestAttributes(java.util.Map model,
                                               javax.servlet.http.HttpServletRequest request)
                                        throws javax.servlet.ServletException
Expose the models 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 models to expose
request - HttpServletRequest to preprocess.


Rod Johnson and Spring contributors 2001-2003.