|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.myfaces.trinidad.config.Configurator
public abstract class Configurator
This defines an abstract class for the Configurator. Classes implementing this abstraction should be listed in the jar's /META-INF/services folder inside of a text file named "org.apache.myfaces.trinidad.config.Configurator". These services will then be run by Trinidad's global configurator.
This abstract class allows Trinidad and various renderkits to move some of their initialization and request/response wrapping code into a configurator so that they may be handled in a container agnostic fashion supporting both Portlets and Servlets. This allows Trinidad and its various renderkits to offload some of their filter logic such as multi-part request handling (file uploads), skin initialization, and other tasks. Depending on the container,these methods may be called at different times during the actual request. The only thing guaranteed to Configurator developers are the constraints listed below in the following methods. Use of this abstract class is encouraged, where possible, instead of using Trinidad filter services. While configurators and filter services should be able to coexist, any services provided by the filter service will not run in a portal and should therefore be considered optional to the run of the renderkit or application if Portal compatibility is important.
Constructor Summary | |
---|---|
Configurator()
|
Method Summary | |
---|---|
void |
beginRequest(javax.faces.context.ExternalContext externalContext)
This is called at the beginning of each "physical" request, sometime before getExternalContext(ExternalContext) or
endRequest(ExternalContext) . |
void |
destroy()
Cleans up the Configurator. |
static void |
disableConfiguratorServices(javax.servlet.ServletRequest srq)
Disables Configurator services for the current request. |
void |
endRequest(javax.faces.context.ExternalContext externalContext)
Executed at the end of each "physical" request. |
javax.faces.context.ExternalContext |
getExternalContext(javax.faces.context.ExternalContext externalContext)
Returns an ExternalContext wrapper based on the provided ExternalContext. |
void |
init(javax.faces.context.ExternalContext externalContext)
Initializes the Configurator. |
protected static boolean |
isConfiguratorServiceDisabled(javax.faces.context.ExternalContext ec)
Returns true if the disableConfiguratorServices(ServletRequest)
has been executed on the current request and false if it has not. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Configurator()
Method Detail |
---|
public void init(javax.faces.context.ExternalContext externalContext)
FacesContextFactory.getFacesContext(java.lang.Object, java.lang.Object, java.lang.Object, javax.faces.lifecycle.Lifecycle)
is completed.
Note:the ExternalContext provided to this method may not
contain any of the Request/Response functionality within the external
context and will NOT contain any ExternalContext wrapping provided by
the getExternalContext(ExternalContext)
method. This object
is intended only to be used as a container abstraction to the native
Context object.
externalContext
- a mocked up external context providing access
to the native context object.public void destroy()
public void beginRequest(javax.faces.context.ExternalContext externalContext)
getExternalContext(ExternalContext)
or
endRequest(ExternalContext)
. When using the
TrinidadFilter, this will be called during filter execution, but
is not guaranteed to happen until just before the creation of the
Trinidad FacesContext wrapper.
All Configurator services will have thier beginRequest() methods
called before any calls to getExternalContext(). So any context
wrapping done by this method will not happen until after the
beginRequest() is called.
It is also important to note that the ExternalContext provided
may or may not be the same as the ExternalContext provided to
getExternalContext(). But it will have a valid request and response
object.
By contract, the RequestContext
object will be initialized and available when this method is run.
externalContext
- a mocked up or life externalContext providing
access to the native request, response, and context
objects.public javax.faces.context.ExternalContext getExternalContext(javax.faces.context.ExternalContext externalContext)
beginRequest(ExternalContext)
.
Please note that it is important that this method returns a wrapper of
the original context, or the behavior provided by other services and by
Trinidad may not function
By contract, the RequestContext
object will be initialized and available when this method is run.
externalContext
- the ExternalContext to wrap
public void endRequest(javax.faces.context.ExternalContext externalContext)
beginRequest(ExternalContext)
.
It is also important to note that the ExternalContext provided
may or may not be the same as the ExternalContext provided to
getExternalContext(). But it will have a valid request and response
object.
By contract, the RequestContext
object will be initialized and available when this method is run.
externalContext
- the external contextpublic static final void disableConfiguratorServices(javax.servlet.ServletRequest srq)
beginRequest(ExternalContext)
,
endRequest(ExternalContext)
, and
getExternalContext(ExternalContext)
methods will not be called durring
a request.
Note: is this method is called after the beginRequest() method,
an error will be logged in the trinidad logger and the services will continue to
execute.
srq
- the servlet requestprotected static final boolean isConfiguratorServiceDisabled(javax.faces.context.ExternalContext ec)
true
if the disableConfiguratorServices(ServletRequest)
has been executed on the current request and false
if it has not.
Note:it is important to understand that this method will not
properly reflect if the services have actually been disabled or not. It simply
returns whether they "should" have been disabled. If the disableConfiguratorServices
was executed after the beginRequest methods have been executed, then the services
will continue to function so that {getExternalContext(ExternalContext)
and endRequest(ExternalContext)
will still be called.
ec
- the ExternalContext object
boolean
containing true
if the
disableConfiguratorServices()
method has been
called and false
if it has not.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |