|
[Deprecated API] | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | CURRENT API | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--com.interface21.context.support.ApplicationObjectSupport
|
+--com.interface21.web.servlet.view.AbstractView
Abstract view superclass. Standard framework view implementations and application-specific custom views can extend this class to simplify their implementation. Subclasses should be JavaBeans.
Extends ApplicationObjectSupport, which will be helpful to some views. Handles static attributes, and merging static with dynamic attributes. Subclasses just need to implement the actual rendering.
It's recommended that subclasses don't cache anything, in the quest for efficiency. This class offers caching. However, it's possible to disable this class's caching, which is useful during development.
renderMergedOutputModel(java.util.Map, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)| Fields inherited from class com.interface21.context.support.ApplicationObjectSupport |
logger |
| Constructor Summary | |
AbstractView()
|
|
| Method Summary | |
void |
addStaticAttribute(java.lang.String name,
java.lang.Object o)
Add static data to this view, exposed in each view. |
protected java.lang.String |
getContentType()
|
java.lang.String |
getName()
Return the view's name. |
java.util.Map |
getStaticAttributes()
Handy for testing. |
void |
render(java.util.Map model,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Prepares the view given the specified model. |
protected abstract void |
renderMergedOutputModel(java.util.Map model,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Subclasses must implement this method to render the view. |
void |
setAttributes(java.util.Properties prop)
Set static attributes from a java.util.Properties object. |
void |
setAttributesCSV(java.lang.String propString)
Set static attributes as a CSV string. |
void |
setContentType(java.lang.String contentType)
Set the content type for this view. |
void |
setName(java.lang.String name)
Set the view's name. |
void |
setRequestContextAttribute(java.lang.String requestContextAttribute)
Set the name of the RequestContext attribute for all views, or null if not needed. |
| Methods inherited from class com.interface21.context.support.ApplicationObjectSupport |
getApplicationContext, initApplicationContext, setApplicationContext |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public AbstractView()
| Method Detail |
public final void setAttributesCSV(java.lang.String propString)
throws java.lang.IllegalArgumentException
public final void setAttributes(java.util.Properties prop)
throws java.lang.IllegalArgumentException
Relies on registration of PropertiesEditor.
PropertiesEditorpublic final void setContentType(java.lang.String contentType)
contentType - content type for this viewprotected final java.lang.String getContentType()
public void setRequestContextAttribute(java.lang.String requestContextAttribute)
requestContextAttribute - name of the RequestContext attribute
public final void addStaticAttribute(java.lang.String name,
java.lang.Object o)
addStaticAttribute in interface Viewname - name of attribute to exposeo - object to exposepublic final java.util.Map getStaticAttributes()
public final void setName(java.lang.String name)
setName in interface Viewname - the view's name. May not be null.
Views should use this for log messages.public final java.lang.String getName()
getName in interface View
public final void render(java.util.Map model,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws javax.servlet.ServletException,
java.io.IOException
render in interface ViewrenderMergedOutputModel(java.util.Map, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
protected abstract void renderMergedOutputModel(java.util.Map model,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws javax.servlet.ServletException,
java.io.IOException
The first take will be preparing the request: This may include setting the model elements as attributes, e.g. in the case of a JSP view.
model - combined output Map, with dynamic values
taking precedence over static attributesrequest - current HTTP requestresponse - current HTTP responsejava.io.IOException - if there is an IO exception trying to obtain
or render the viewjavax.servlet.ServletException - if there is any other error
|
[Deprecated API] | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | CURRENT API | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||