org.apache.myfaces.orchestra.urlParamNav
Class UrlParameterViewHandler

java.lang.Object
  extended by javax.faces.application.ViewHandler
      extended by org.apache.myfaces.orchestra.urlParamNav.UrlParameterViewHandler

public class UrlParameterViewHandler
extends javax.faces.application.ViewHandler

Allow the to-view-id URL in a faces-config navigation case to include query parameters and EL expressions.

This class plays a few tricks to hide from the real NavigationHandler and ViewHandler classes the fact that a URL contains non-standard data.

This class also plays a few reflection-based tricks so that the code can be compiled against JSF1.1, and work with both JSF1.1 and JSF1.2. The code is a little fragile and will probably need to be updated to work correctly with JSF2.0, but that is the fault of the JSF spec.


Field Summary
 
Fields inherited from class javax.faces.application.ViewHandler
CHARACTER_ENCODING_KEY, DEFAULT_SUFFIX, DEFAULT_SUFFIX_PARAM_NAME
 
Constructor Summary
UrlParameterViewHandler(javax.faces.application.ViewHandler original)
          Constructor.
 
Method Summary
 String calculateCharacterEncoding(javax.faces.context.FacesContext context)
          Delegate to wrapped instance.
 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)
           
 String getActionURL(javax.faces.context.FacesContext context, String viewId)
           
 String getResourceURL(javax.faces.context.FacesContext context, String path)
           
 void initView(javax.faces.context.FacesContext context)
          Delegate to wrapped instance.
 void renderView(javax.faces.context.FacesContext context, javax.faces.component.UIViewRoot viewToRender)
           
 javax.faces.component.UIViewRoot restoreView(javax.faces.context.FacesContext context, String viewId)
           
 void writeState(javax.faces.context.FacesContext context)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UrlParameterViewHandler

public UrlParameterViewHandler(javax.faces.application.ViewHandler original)
Constructor.

Method Detail

calculateCharacterEncoding

public String calculateCharacterEncoding(javax.faces.context.FacesContext context)
Delegate to wrapped instance.

This method was added in JSF1.2. We must therefore use reflection to invoke the method on the wrapped instance. Note that this method is never invoked unless this is a JSF1.2 environment.

Since:
1.3

initView

public void initView(javax.faces.context.FacesContext context)
              throws javax.faces.FacesException
Delegate to wrapped instance.

This method was added in JSF1.2. We must therefore use reflection to invoke the method on the wrapped instance. Note that this method is never invoked unless this is a JSF1.2 environment.

Throws:
javax.faces.FacesException
Since:
1.3

calculateLocale

public Locale calculateLocale(javax.faces.context.FacesContext context)
Specified by:
calculateLocale in class javax.faces.application.ViewHandler

calculateRenderKitId

public String calculateRenderKitId(javax.faces.context.FacesContext context)
Specified by:
calculateRenderKitId in class javax.faces.application.ViewHandler

createView

public javax.faces.component.UIViewRoot createView(javax.faces.context.FacesContext context,
                                                   String viewId)
Specified by:
createView in class javax.faces.application.ViewHandler

getActionURL

public String getActionURL(javax.faces.context.FacesContext context,
                           String viewId)
Specified by:
getActionURL in class javax.faces.application.ViewHandler

getResourceURL

public String getResourceURL(javax.faces.context.FacesContext context,
                             String path)
Specified by:
getResourceURL in class javax.faces.application.ViewHandler

renderView

public void renderView(javax.faces.context.FacesContext context,
                       javax.faces.component.UIViewRoot viewToRender)
                throws IOException,
                       javax.faces.FacesException
Specified by:
renderView in class javax.faces.application.ViewHandler
Throws:
IOException
javax.faces.FacesException

restoreView

public javax.faces.component.UIViewRoot restoreView(javax.faces.context.FacesContext context,
                                                    String viewId)
Specified by:
restoreView in class javax.faces.application.ViewHandler

writeState

public void writeState(javax.faces.context.FacesContext context)
                throws IOException
Specified by:
writeState in class javax.faces.application.ViewHandler
Throws:
IOException


Copyright © 2012 The Apache Software Foundation. All Rights Reserved.