org.chwf.servlet.engine
Class InvokerFilter
java.lang.Object
|
+--org.chwf.servlet.filter.FilterSupport
|
+--org.chwf.servlet.engine.InvokerFilter
- All Implemented Interfaces:
- javax.servlet.Filter
- public class InvokerFilter
- extends FilterSupport
A filter that invokes a controller, and stores the InvocationContext in
the request for post-processing.
- Author:
- Paul Strack
Method Summary |
void |
doFilter(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response,
javax.servlet.FilterChain chain)
Process filter. |
static InvocationContext |
getContext(javax.servlet.ServletRequest request)
Retrieve the invocation context from the request. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
InvokerFilter
public InvokerFilter()
getContext
public static InvocationContext getContext(javax.servlet.ServletRequest request)
- Retrieve the invocation context from the request. This method is only
valid after the controller has been invoked. In particular, this method
can only be used during post-processing in other filters:
public void doFilter(...) {
// Should not call getContext() for pre-processing.
chain.doFilter(request, response);
// Valid to call getContext() for post-processing.
InvocationContext context = InvokerFilter.getContext(request);
// Work with context ...
}
- Parameters:
request
- The request.- Returns:
- The context, or
null
if it has not been initialized.
doFilter
public void doFilter(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response,
javax.servlet.FilterChain chain)
throws java.io.IOException,
javax.servlet.ServletException
- Process filter.
- Overrides:
doFilter
in class FilterSupport
- Parameters:
request
- The request.response
- The response.chain
- The filter chain.- Throws:
javax.servlet.ServletException
- For servlet exceptions.java.io.IOException
- For IO exceptions.
Copyright © 2002-2004, Paul Strack. All Rights Reserved.