|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.mycompany.jsf.event.CaptureStatePhaseListener
This class is a JSF PhaseListener that captures view state before and after each request processing lifecycle phase.
It saves the state as a tree composed of TreeNode instances in a session scope Map named "com.mycompany.debug", with an entry per view keyed by the view ID.
Field Summary | |
private java.util.Map |
pdCache
|
Constructor Summary | |
CaptureStatePhaseListener()
|
Method Summary | |
private void |
addComponentNodes(javax.faces.context.FacesContext context,
TreeNode parent,
javax.faces.component.UIComponent comp)
Creates nodes for properties and attributes of the provided component and adds them as branches under the provided node, and then recursively calls itself for each child and facet of the provided component. |
private void |
addLeafNodes(TreeNode parent,
java.util.Map map)
Add a TreeNode instance for each entry in the Map, with the entry key (converted to a String) as the node name, the entry value (converted to a String) as the node value, and with the "leafNode" property set to "true". |
void |
afterPhase(javax.faces.event.PhaseEvent event)
Saves the view state after the regular processing of the view in the current phase by calling capturePhaseData(). |
void |
beforePhase(javax.faces.event.PhaseEvent event)
Saves the view state before the regular processing of the view in the current phase by calling capturePhaseData(), unless the current phase is Restore View (there's no view available in this case). |
private void |
capturePhaseData(java.lang.String phaseName,
javax.faces.context.FacesContext context)
Creates nodes for the view. |
private void |
captureRequestData(javax.faces.context.FacesContext context)
Creates nodes for the request data. |
private java.lang.String |
format(java.util.Iterator i)
Returns a String with comma-separated list of the values represented by the Iterator. |
private java.lang.String |
format(java.util.Map map)
Returns a String with comma-separated list of the Map entries, with each entry as "key = value". |
javax.faces.event.PhaseId |
getPhaseId()
Returns PhaseId.ANY_PHASE to announce that this listener must be invoked in all phases. |
private TreeNode |
getRoot(javax.faces.context.FacesContext context)
Returns the TreeNode for the tree root, from the Map saved as a session scope variable named "com.mycompany.debug" or a new instance if it's not found or the found instance is for a previous request. |
private java.lang.String |
getViewId(javax.faces.context.FacesContext context)
Returns the view ID for the view held by the provided FacesContext, adjusted if needed. |
private java.lang.Object[] |
toObjects(boolean[] arr)
Returns an Object array with the values of the array. |
private java.lang.Object[] |
toObjects(byte[] arr)
Returns an Object array with the values of the array. |
private java.lang.Object[] |
toObjects(char[] arr)
Returns an Object array with the values of the array. |
private java.lang.Object[] |
toObjects(double[] arr)
Returns an Object array with the values of the array. |
private java.lang.Object[] |
toObjects(float[] arr)
Returns an Object array with the values of the array. |
private java.lang.Object[] |
toObjects(int[] arr)
Returns an Object array with the values of the array. |
private java.lang.Object[] |
toObjects(long[] arr)
Returns an Object array with the values of the array. |
private java.lang.Object[] |
toObjects(short[] arr)
Returns an Object array with the values of the array. |
private java.lang.String |
toString(java.lang.Object value)
Returns the value as a String in an appropriate format depending on the data type. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private java.util.Map pdCache
Constructor Detail |
public CaptureStatePhaseListener()
Method Detail |
public javax.faces.event.PhaseId getPhaseId()
getPhaseId
in interface javax.faces.event.PhaseListener
public void beforePhase(javax.faces.event.PhaseEvent event)
beforePhase
in interface javax.faces.event.PhaseListener
public void afterPhase(javax.faces.event.PhaseEvent event)
afterPhase
in interface javax.faces.event.PhaseListener
private TreeNode getRoot(javax.faces.context.FacesContext context)
private java.lang.String getViewId(javax.faces.context.FacesContext context)
private void captureRequestData(javax.faces.context.FacesContext context)
private void capturePhaseData(java.lang.String phaseName, javax.faces.context.FacesContext context)
private void addComponentNodes(javax.faces.context.FacesContext context, TreeNode parent, javax.faces.component.UIComponent comp)
private void addLeafNodes(TreeNode parent, java.util.Map map)
private java.lang.String toString(java.lang.Object value)
private java.lang.Object[] toObjects(boolean[] arr)
private java.lang.Object[] toObjects(byte[] arr)
private java.lang.Object[] toObjects(char[] arr)
private java.lang.Object[] toObjects(double[] arr)
private java.lang.Object[] toObjects(float[] arr)
private java.lang.Object[] toObjects(int[] arr)
private java.lang.Object[] toObjects(short[] arr)
private java.lang.Object[] toObjects(long[] arr)
private java.lang.String format(java.util.Iterator i)
private java.lang.String format(java.util.Map map)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |