org.apache.catalina.core
final class: ApplicationDispatcher [javadoc |
source]
java.lang.Object
org.apache.catalina.core.ApplicationDispatcher
All Implemented Interfaces:
RequestDispatcher
Standard implementation of
RequestDispatcher that allows a
request to be forwarded to a different resource to create the ultimate
response, or to include the output of another resource in the response
from this resource. This implementation allows application level servlets
to wrap the request and/or response objects that are passed on to the
called resource, as long as the wrapping classes extend
javax.servlet.ServletRequestWrapper and
javax.servlet.ServletResponseWrapper.
- author:
Craig - R. McClanahan
- version:
$ - Revision: 588477 $ $Date: 2007-10-26 04:37:39 +0200 (ven., 26 oct. 2007) $
| Constructor: |
public ApplicationDispatcher(Wrapper wrapper,
String requestURI,
String servletPath,
String pathInfo,
String queryString,
String name) {
// ----------------------------------------------------------- Constructors
super();
// Save all of our configuration parameters
this.wrapper = wrapper;
this.context = (Context) wrapper.getParent();
this.requestURI = requestURI;
this.servletPath = servletPath;
this.pathInfo = pathInfo;
this.queryString = queryString;
this.name = name;
if (wrapper instanceof StandardWrapper)
this.support = ((StandardWrapper) wrapper).getInstanceSupport();
else
this.support = new InstanceSupport(wrapper);
}
Construct a new instance of this class, configured according to the
specified parameters. If both servletPath and pathInfo are
null, it will be assumed that this RequestDispatcher
was acquired by name, rather than by path. Parameters:
wrapper - The Wrapper associated with the resource that will
be forwarded to or included (required)
requestURI - The request URI to this resource (if any)
servletPath - The revised servlet path to this resource (if any)
pathInfo - The revised extra path information to this resource
(if any)
queryString - Query string parameters included with this request
(if any)
name - Servlet name (if a named dispatcher was created)
else null
|
| Method from org.apache.catalina.core.ApplicationDispatcher Detail: |
public void forward(ServletRequest request,
ServletResponse response) throws IOException, ServletException {
if (Globals.IS_SECURITY_ENABLED) {
try {
PrivilegedForward dp = new PrivilegedForward(request,response);
AccessController.doPrivileged(dp);
} catch (PrivilegedActionException pe) {
Exception e = pe.getException();
if (e instanceof ServletException)
throw (ServletException) e;
throw (IOException) e;
}
} else {
doForward(request,response);
}
}
Forward this request and response to another resource for processing.
Any runtime exception, IOException, or ServletException thrown by the
called servlet will be propogated to the caller. |
public String getInfo() {
// ------------------------------------------------------------- Properties
return (info);
}
Return the descriptive information about this implementation. |
public void include(ServletRequest request,
ServletResponse response) throws IOException, ServletException {
if (Globals.IS_SECURITY_ENABLED) {
try {
PrivilegedInclude dp = new PrivilegedInclude(request,response);
AccessController.doPrivileged(dp);
} catch (PrivilegedActionException pe) {
Exception e = pe.getException();
if (e instanceof ServletException)
throw (ServletException) e;
throw (IOException) e;
}
} else {
doInclude(request,response);
}
}
Include the response from another resource in the current response.
Any runtime exception, IOException, or ServletException thrown by the
called servlet will be propogated to the caller. |