com.mortbay.HTTP
Class HttpRequestDispatcher

java.lang.Object
  |
  +--com.mortbay.HTTP.HttpRequestDispatcher

public class HttpRequestDispatcher
extends java.lang.Object
implements javax.servlet.RequestDispatcher

Dispatch requests to other resources. IT IS NOT RECOMMENDED THAT THIS API IS USED. The resources that can be referenced by the RequestDispatcher API, are very restricted and cannot be written as generic servlet.

Version:
1.0 Sat Feb 13 1999
Author:
Greg Wilkins (gregw)
See Also:
HttpServer

Method Summary
 void forward(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response)
          Forwards a ServletRequest object from this servlet to a resource (servlet, JSP file, or HTML file) on the server.
 void include(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response)
          Includes the content a resource (servlet, JSP page, HTML file) on the Web server generates in the response this servlet sends to another servlet.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

forward

public void forward(javax.servlet.ServletRequest request,
                    javax.servlet.ServletResponse response)
             throws javax.servlet.ServletException,
                    java.io.IOException
Description copied from interface: javax.servlet.RequestDispatcher
Forwards a ServletRequest object from this servlet to a resource (servlet, JSP file, or HTML file) on the server. You can use this method when one servlet does preliminary processing of a request and lets another resource generate the response.

The ServletRequest object has its path and other parameters adjusted to be relative to the path of the target resource.

You cannot use forward if the target resource has already returned a ServletOutputStream or PrintWriter object to the servlet. In that situation, forward throws an IllegalStateException.

Specified by:
forward in interface javax.servlet.RequestDispatcher
Parameters:
request -  
response -  
Throws:
javax.servlet.ServletException -  
java.io.IOException -  

include

public void include(javax.servlet.ServletRequest request,
                    javax.servlet.ServletResponse response)
             throws javax.servlet.ServletException,
                    java.io.IOException
Description copied from interface: javax.servlet.RequestDispatcher
Includes the content a resource (servlet, JSP page, HTML file) on the Web server generates in the response this servlet sends to another servlet. In essence, this method enables programmatic server-side includes.

The ServletResponse object passed to this servlet has the caller's request path. The response object only has access to this servlet's ServletOutputStream and PrintWriter objects.

A servlet that calls include cannot set response headers. If the servlet that calls include also calls methods that set headers, include is not guaranteed to work.

Specified by:
include in interface javax.servlet.RequestDispatcher
Parameters:
request -  
response -  
Throws:
javax.servlet.ServletException -  
java.io.IOException -