PAJES 2.3.9

org.pajes.servlet
Class RequestRedirector

java.lang.Object
  extended byorg.pajes.servlet.RequestRedirector
All Implemented Interfaces:
javax.servlet.RequestDispatcher

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

An object that receives requests from the client and redirects them to any resource (such as a servlet, HTML file, or JSP file) within this context. Unlike the servlet container RequestDispatcher object, which is used as a wrapper around a server resource located at a particular path or given by a particular name, the RequestRedirector sends a redirect instruction back to the client, rather than the content of the requested resource.

Note that as the request is being redirected, the forward(javax.servlet.ServletRequest, javax.servlet.ServletResponse) and include(javax.servlet.ServletRequest, javax.servlet.ServletResponse) methods perform exactly the same function.


Constructor Summary
RequestRedirector(java.lang.String path)
          Creates a RequestRedirector object that will redirect the request to the resource located at the given path.
RequestRedirector(URI path)
          Creates a RequestRedirector object that will redirect the request to the resource located at the given path.
 
Method Summary
 void forward(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response)
          Sends a redirect instruction to the client to pass a request from a servlet to another resource (servlet, JSP file, or HTML file) within this context.
 void include(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response)
          Sends a redirect instruction to the client to pass a request from a servlet to another resource (servlet, JSP file, or HTML file) within this context.
 java.lang.String toString()
          Over-rides Object.toString to return the path of this redirector.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RequestRedirector

public RequestRedirector(java.lang.String path)
Creates a RequestRedirector object that will redirect the request to the resource located at the given path. The resource can be dynamic or static.

Parameters:
path - the pathname to the resource. If the path begins with a "/", it is interpreted as relative to the context root.

RequestRedirector

public RequestRedirector(URI path)
Creates a RequestRedirector object that will redirect the request to the resource located at the given path. The resource can be dynamic or static.

Parameters:
path - the URI of the resource.
Method Detail

forward

public void forward(javax.servlet.ServletRequest request,
                    javax.servlet.ServletResponse response)
             throws javax.servlet.ServletException,
                    java.io.IOException
Sends a redirect instruction to the client to pass a request from a servlet to another resource (servlet, JSP file, or HTML file) within this context.

forward must be called before any response has been committed to the client.

The request and response parameters must be the same objects as were passed to the calling servlet's service method.

Specified by:
forward in interface javax.servlet.RequestDispatcher
Parameters:
request - a HttpServletRequest object that represents the request the client makes of the servlet
response - a HttpServletResponse object that represents the response the servlet returns to the client
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
Sends a redirect instruction to the client to pass a request from a servlet to another resource (servlet, JSP file, or HTML file) within this context.

forward must be called before any response has been committed to the client.

The request and response parameters must be the same objects as were passed to the calling servlet's service method.

Specified by:
include 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
java.io.IOException

toString

public java.lang.String toString()
Over-rides Object.toString to return the path of this redirector.

Returns:
a String representation of this Object.

PAJES 2.3.9

Copyright © 2002-2003 Viridian Pty Limited. All Rights Reserved.