|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.myfaces.orchestra.filter.OrchestraServletFilter
public class OrchestraServletFilter
Perform a number of useful per-request tasks.
This filter is entirely optional; it can be omitted if you do not need any of the functionality provided here.
Note that it is necessary to define a filter that initialises the Orchestra
framework; this can be done either via a standalone filter such as
JsfFrameworkAdapterFilter, or via a filter that combines framework initialisation
with the functionality of this class, such as
OrchestraServletFilter
.
By default, the servlet engine simply processes all requests concurrently in different threads. However that can cause all sorts of unexpected problems with session-scoped objects.
The usual solution is to apply a filter to all requests which uses standard java synchronisation on a session-scoped object, taking the lock on request entry and releasing it on request exit. This ensures that only one request for that session runs at a time, with the others waiting until they can obtain a lock on the appropriate object. This is referred to as "request serialization" because it causes requests to be processed serially, ie one after the other, rather than concurrently. This has nothing to do with java.io.Serializable.
When using an Orchestra conversationContext, session-scoped data should be avoided and conversation-scoped beans used instead. If there is no session-scoped data in use by an application then it is possible to allow concurrent requests to the same http session, but NOT concurrent access to the same orchestra conversationContext. This filter implements that, by holding a lock on a mutex object held by the appropriate conversationContext.
The request serialization functionality can be enabled or disabled via a filter init parameter; setting "serializeRequests" to "false" disables this feature. Default value: true (enabled).
Field Summary | |
---|---|
static java.lang.String |
SERIALIZE_REQUESTS
This filter init property can be set to "true" or "false". |
Constructor Summary | |
---|---|
OrchestraServletFilter()
|
Method Summary | |
---|---|
protected void |
cleanupPersistence()
|
void |
destroy()
|
void |
doFilter(javax.servlet.ServletRequest servletRequest,
javax.servlet.ServletResponse servletResponse,
javax.servlet.FilterChain filterChain)
|
void |
init(javax.servlet.FilterConfig filterConfig)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String SERIALIZE_REQUESTS
Constructor Detail |
---|
public OrchestraServletFilter()
Method Detail |
---|
public void init(javax.servlet.FilterConfig filterConfig) throws javax.servlet.ServletException
init
in interface javax.servlet.Filter
javax.servlet.ServletException
public void doFilter(javax.servlet.ServletRequest servletRequest, javax.servlet.ServletResponse servletResponse, javax.servlet.FilterChain filterChain) throws java.io.IOException, javax.servlet.ServletException
doFilter
in interface javax.servlet.Filter
java.io.IOException
javax.servlet.ServletException
protected void cleanupPersistence()
public void destroy()
destroy
in interface javax.servlet.Filter
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |