@Override
public Invocation buildInvocation(Invocation invocation)
throws ConfigException
{
if (_configException != null) {
FilterChain chain = new ExceptionFilterChain(_configException);
invocation.setFilterChain(chain);
invocation.setDependency(AlwaysModified.create());
return invocation;
}
else if (! _lifecycle.waitForActive(_startWaitTime)) {
log.fine(this + " container is not active");
int code = HttpServletResponse.SC_SERVICE_UNAVAILABLE;
FilterChain chain = new ErrorFilterChain(code);
invocation.setFilterChain(chain);
invocation.setWebApp(getErrorWebApp());
invocation.setDependency(AlwaysModified.create());
return invocation ;
}
FilterChain chain;
WebAppController controller = getWebAppController(invocation);
WebApp webApp = getWebApp(invocation, controller, true);
boolean isAlwaysModified;
if (webApp != null) {
invocation = webApp.buildInvocation(invocation);
chain = invocation.getFilterChain();
isAlwaysModified = false;
}
else if (controller != null){
int code = HttpServletResponse.SC_SERVICE_UNAVAILABLE;
chain = new ErrorFilterChain(code);
ContextFilterChain contextChain = new ContextFilterChain(chain);
contextChain.setErrorPageManager(getErrorPageManager());
chain = contextChain;
invocation.setFilterChain(contextChain);
isAlwaysModified = true;
}
else {
int code = HttpServletResponse.SC_NOT_FOUND;
chain = new ErrorFilterChain(code);
ContextFilterChain contextChain = new ContextFilterChain(chain);
contextChain.setErrorPageManager(getErrorPageManager());
chain = contextChain;
invocation.setFilterChain(contextChain);
isAlwaysModified = true;
}
if (_rewriteDispatch != null) {
String uri = invocation.getURI();
String queryString = invocation.getQueryString();
FilterChain rewriteChain = _rewriteDispatch.map(DispatcherType.REQUEST,
uri,
queryString,
chain);
if (rewriteChain != chain) {