Enhydra 5.1 API

org.enhydra.servlet.servletManager
Class EnhydraRequestDispatcher

java.lang.Object
  |
  +--org.enhydra.servlet.servletManager.EnhydraRequestDispatcher
All Implemented Interfaces:
javax.servlet.RequestDispatcher

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

Processes requests for resources at a particular path, including Servlets, Enhydra Apps, and Web Apps.

Version:
$Revision: 1.1 $
Author:
Shawn McMurdo
See Also:
ServletContext.getRequestDispatcher(java.lang.String)

Constructor Summary
EnhydraRequestDispatcher(java.lang.String urlPath)
          Creates a new RequestDispatcher for the given url path.
 
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 of a resource in the response of the calling servlet.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EnhydraRequestDispatcher

public EnhydraRequestDispatcher(java.lang.String urlPath)
Creates a new RequestDispatcher for the given url path.

Parameters:
urlPath - a String URL path that the dispatcher will handle request for.
Method Detail

forward

public void forward(javax.servlet.ServletRequest request,
                    javax.servlet.ServletResponse response)
             throws javax.servlet.ServletException,
                    java.io.IOException
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 - a ServletRequest object that represents the request the client makes of the servlet
response - a ServletResponse object that represents the response the servlet returns to the client
Throws:
javax.servlet.ServletException - if the target resource is a servlet and throws an exception
java.io.IOException - if an input or output exception occurs
java.lang.IllegalStateException - if the target resource returned a ServletOutputStream or PrintWriter object before this method was called

include

public void include(javax.servlet.ServletRequest request,
                    javax.servlet.ServletResponse response)
             throws javax.servlet.ServletException,
                    java.io.IOException
Includes the content of a resource in the response of the calling 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 - a ServletRequest object that contains the client's request
response - a ServletResponse object that contains the servlet's response
Throws:
javax.servlet.ServletException - if the target servlet throws a servlet exception
java.io.IOException - if the servlet has already obtained a ServletOutputStream or print writer object from the ServletResponse object

Enhydra 5.1 API