throws IOException, ServletException
{
if (httpContext.handleSecurity(request, response)) {
Thread t = Thread.currentThread();
Stack usedURIStack = (Stack) threadStacks.get(t);
if (usedURIStack == null) {
usedURIStack = new Stack();
threadStacks.put(t, usedURIStack);
}
String uri = (String) request
.getAttribute("javax.servlet.include.request_uri");
if (uri == null)
uri = request.getRequestURI();
if (usedURIStack.contains(uri))
throw new ServletException("Recursive include of \"" + uri
+ "\"");
usedURIStack.push(uri);
try {
if (servlet instanceof SingleThreadModel) {
synchronized (servlet) {
if (config == null)
servlet.service(request, response);
else
serviceResource(request, response, config);
}
} else {
if (config == null)
servlet.service(request, response);
else
serviceResource(request, response, config);
}
} finally {
usedURIStack.pop();
if (usedURIStack.empty())
threadStacks.remove(t);
}
}
}