|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.faces.application.ViewHandler
org.apache.shale.clay.faces.ClayViewHandler
public class ClayViewHandler
This ViewHandler will handle full HTML template views using the
Clay component as the single subtree under the view root. Views will
be intercepted having a suffix matching the registered clay template suffix
in the web deployment descriptor. The default suffixes are ".html" and "*.xml".
All other view render requests that don't match the suffixes will be delegated to the
original decorated view handler.
| Field Summary | |
|---|---|
protected static String[] |
FORM_MARKERS
HTML form markers for client side state saving for MyFaces and Sun RI implementations. |
static String |
VIEW_MAPPER
Application scope attribute under which the ViewControllerMapper for translating view identifiers
to class names of the corresponding ViewController
is stored. |
| Fields inherited from class javax.faces.application.ViewHandler |
|---|
CHARACTER_ENCODING_KEY, DEFAULT_SUFFIX, DEFAULT_SUFFIX_PARAM_NAME |
| Constructor Summary | |
|---|---|
ClayViewHandler(javax.faces.application.ViewHandler original)
This is an overloaded constructor passing the original
view handler. |
|
| Method Summary | |
|---|---|
Locale |
calculateLocale(javax.faces.context.FacesContext context)
|
String |
calculateRenderKitId(javax.faces.context.FacesContext context)
|
javax.faces.component.UIViewRoot |
createView(javax.faces.context.FacesContext context,
String viewId)
This method is overridden to check to see if the target view is a clay html or xml template. |
String |
getActionURL(javax.faces.context.FacesContext context,
String viewId)
If the viewId is suffixed with the Clay template suffix,
rewrite the returned actionUrl with a clay suffix. |
protected String |
getManagedBeanName(javax.faces.context.FacesContext context,
String viewId)
Returns the "@managed-bean-name" the view controller is registered under. |
String |
getResourceURL(javax.faces.context.FacesContext context,
String path)
|
protected int |
indexOfClayTemplateSuffix(javax.faces.context.FacesContext context,
String viewId)
This method looks to see if the target view identified by the viewId is a Clay HTML or XML full view. |
protected int |
indexOfFormMarker()
Returns an index into the FORM_MAKKERS array. |
protected void |
recursiveRender(javax.faces.component.UIComponent child,
javax.faces.context.FacesContext context)
Recursively invokes the rendering of the sub component tree. |
void |
renderView(javax.faces.context.FacesContext context,
javax.faces.component.UIViewRoot view)
The viewId is check to see if it ends with the
same suffix as the full HTML or XML views. |
javax.faces.component.UIViewRoot |
restoreView(javax.faces.context.FacesContext context,
String viewId)
The default view handler implementation will try to make the viewId end with ".jsp". |
void |
writeState(javax.faces.context.FacesContext context)
Invokes the original view handler's writeState. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String VIEW_MAPPER
Application scope attribute under which the
ViewControllerMapper for translating view identifiers
to class names of the corresponding ViewController
is stored.
protected static final String[] FORM_MARKERS
HTML form markers for client side state saving for MyFaces and Sun RI implementations.
| Constructor Detail |
|---|
public ClayViewHandler(javax.faces.application.ViewHandler original)
This is an overloaded constructor passing the original
view handler.
original - view handler| Method Detail |
|---|
public Locale calculateLocale(javax.faces.context.FacesContext context)
calculateLocale in class javax.faces.application.ViewHandlercontext - faces context
public String calculateRenderKitId(javax.faces.context.FacesContext context)
calculateRenderKitId in class javax.faces.application.ViewHandlercontext - faces context
public javax.faces.component.UIViewRoot createView(javax.faces.context.FacesContext context,
String viewId)
This method is overridden to check to see if the target view is a clay html or xml template. If it is, the view id is normalized before the original implementation is invoked.
createView in class javax.faces.application.ViewHandlercontext - faces contextviewId - name of the page
public String getActionURL(javax.faces.context.FacesContext context,
String viewId)
If the viewId is suffixed with the Clay template suffix,
rewrite the returned actionUrl with a clay suffix. The super
implementation will assume ".jsp" or whatever the
javax.faces.DEFAULT_SUFFIX is set to in the web deployment
descriptor.
getActionURL in class javax.faces.application.ViewHandlercontext - faces contextviewId - name of the page
public String getResourceURL(javax.faces.context.FacesContext context,
String path)
getResourceURL in class javax.faces.application.ViewHandlercontext - faces contextpath - context root relative path
protected int indexOfClayTemplateSuffix(javax.faces.context.FacesContext context,
String viewId)
This method looks to see if the target view identified by the viewId is a
Clay HTML or XML full view.
This is determined by a value cached in request scope by the
ClayViewHandlerCommand or the suffix of the viewId. If a match
is found, the index position into the suffixes array is returned;
Otherwise a -1 is returned.
context - faces contextviewId - name of the page
public javax.faces.component.UIViewRoot restoreView(javax.faces.context.FacesContext context,
String viewId)
The default view handler implementation will try to make the viewId end with ".jsp". If the viewId ends in the clay template suffix, use the state manager to restore the view.
restoreView in class javax.faces.application.ViewHandlercontext - faces contextviewId - name of the page
public void writeState(javax.faces.context.FacesContext context)
throws IOException
Invokes the original view handler's writeState.
writeState in class javax.faces.application.ViewHandlercontext - faces context
IOException - serializing treeprotected int indexOfFormMarker()
Returns an index into the FORM_MAKKERS array. The index will be used to
get the form marker matching the JSF runtime. Only the myfaces and Sun RI are supported.
The form marker is determined by trying to load the myfaces view handler. Next,
the Sun RI 1.2 JSPVersionTracker is attempted to be loaded. The default
is the marker for the Sun RI.
public void renderView(javax.faces.context.FacesContext context,
javax.faces.component.UIViewRoot view)
throws IOException
The viewId is check to see if it ends with the
same suffix as the full HTML or XML views. This match might be performed
by the ClayViewHandlerCommand when using the myfaces jsf implementation.
If a match is not found, control is passed to the decorated view handler.
Otherwise, a Clay component is
instantiated as a single subtree under the
view root. The component's id property is set with a constant,
CLAY_VIEW_ID. The jsfid
property is set to the viewId. The managedBeanName property
is set with the Shale ViewControllerMapper. A ResponseWriter
is created and rendering is invoked on the component. This differs from the base implementation.
The base implementation would dispatch to a JSP that would assemble the component tree
and invoke rendering to the response writer.
renderView in class javax.faces.application.ViewHandlercontext - faces contextview - root of the component tree
IOException - response writer
protected void recursiveRender(javax.faces.component.UIComponent child,
javax.faces.context.FacesContext context)
throws IOException
Recursively invokes the rendering of the sub component tree.
child - component to invoke renderering oncontext - faces context
IOException - writing markup
protected String getManagedBeanName(javax.faces.context.FacesContext context,
String viewId)
Returns the "@managed-bean-name" the view controller is registered under. The assumed mapping will be the same as in core Shale.
context - faces contextviewId - name of the page
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||