org.apache.myfaces.orchestra.requestParameterProvider.jsf
Class RequestParameterFacesContextFactory

java.lang.Object
  extended by javax.faces.context.FacesContextFactory
      extended by org.apache.myfaces.orchestra.requestParameterProvider.jsf.RequestParameterFacesContextFactory
All Implemented Interfaces:
javax.faces.FacesWrapper<javax.faces.context.FacesContextFactory>

public class RequestParameterFacesContextFactory
extends javax.faces.context.FacesContextFactory

Ensure that a custom wrapper is put around the HttpServletResponse so that encodeURL can be intercepted and modified.

There is a servlet filter (RequestParameterServletFilter) that does this in the obvious way, but it is a nuisance to have to set up filters in the web.xml. This class implements a sneaky hack to get this to happen automatically for JSF applications, ie no servlet filter is needed when this is specified in the faces-config.xml file as the FacesContextFactory.

If you have to deal with a mixed environment e.g. JSP/JSF it would be better to use the RequestParameterServletFilter.


Constructor Summary
RequestParameterFacesContextFactory(javax.faces.context.FacesContextFactory original)
           
 
Method Summary
 javax.faces.context.FacesContext getFacesContext(java.lang.Object context, java.lang.Object request, java.lang.Object response, javax.faces.lifecycle.Lifecycle lifecycle)
          Invokes the getFacesContext method on the original factory in order to return a perfectly normal FacesContext instance.
 
Methods inherited from class javax.faces.context.FacesContextFactory
getWrapped
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RequestParameterFacesContextFactory

public RequestParameterFacesContextFactory(javax.faces.context.FacesContextFactory original)
Method Detail

getFacesContext

public javax.faces.context.FacesContext getFacesContext(java.lang.Object context,
                                                        java.lang.Object request,
                                                        java.lang.Object response,
                                                        javax.faces.lifecycle.Lifecycle lifecycle)
                                                 throws javax.faces.FacesException
Invokes the getFacesContext method on the original factory in order to return a perfectly normal FacesContext instance. However the ServletResponse object passed to that FacesContext instance is a modified one that tweaks every url that is processed by the ServletResponse.encodeUrl method.

Specified by:
getFacesContext in class javax.faces.context.FacesContextFactory
Throws:
javax.faces.FacesException


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