org.mortbay.jetty.servlet
Class Dispatcher

java.lang.Object
  extended byorg.mortbay.jetty.servlet.Dispatcher
All Implemented Interfaces:
RequestDispatcher

public class Dispatcher
extends java.lang.Object
implements RequestDispatcher

Servlet RequestDispatcher.

Version:
$Id: Dispatcher.java,v 1.87 2005/10/06 09:29:44 gregwilkins Exp $
Author:
Greg Wilkins (gregw)

Field Summary
static int __ALL
           
static int __DEFAULT
          Dispatch types
static int __ERROR
           
static int __FORWARD
           
static java.lang.String __FORWARD_CONTEXT_PATH
           
static java.lang.String __FORWARD_PATH_INFO
           
static java.lang.String __FORWARD_QUERY_STRING
           
static java.lang.String __FORWARD_REQUEST_URI
          Dispatch include attribute names
static java.lang.String __FORWARD_SERVLET_PATH
           
static int __INCLUDE
           
static java.lang.String __INCLUDE_CONTEXT_PATH
           
static java.lang.String __INCLUDE_PATH_INFO
           
static java.lang.String __INCLUDE_QUERY_STRING
           
static java.lang.String __INCLUDE_REQUEST_URI
          Dispatch include attribute names
static java.lang.String __INCLUDE_SERVLET_PATH
           
static StringMap __managedAttributes
           
static int __REQUEST
           
 
Method Summary
 void forward(ServletRequest servletRequest, ServletResponse servletResponse)
          Forwards a request from a servlet to another resource (servlet, JSP file, or HTML file) on the server.
 void include(ServletRequest servletRequest, ServletResponse servletResponse)
          Includes the content of a resource (servlet, JSP page, HTML file) in the response.
 boolean isNamed()
           
 java.lang.String toString()
           
static int type(java.lang.String type)
          Dispatch type from name
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

__DEFAULT

public static final int __DEFAULT
Dispatch types

See Also:
Constant Field Values

__REQUEST

public static final int __REQUEST
See Also:
Constant Field Values

__FORWARD

public static final int __FORWARD
See Also:
Constant Field Values

__INCLUDE

public static final int __INCLUDE
See Also:
Constant Field Values

__ERROR

public static final int __ERROR
See Also:
Constant Field Values

__ALL

public static final int __ALL
See Also:
Constant Field Values

__INCLUDE_REQUEST_URI

public static final java.lang.String __INCLUDE_REQUEST_URI
Dispatch include attribute names

See Also:
Constant Field Values

__INCLUDE_CONTEXT_PATH

public static final java.lang.String __INCLUDE_CONTEXT_PATH
See Also:
Constant Field Values

__INCLUDE_SERVLET_PATH

public static final java.lang.String __INCLUDE_SERVLET_PATH
See Also:
Constant Field Values

__INCLUDE_PATH_INFO

public static final java.lang.String __INCLUDE_PATH_INFO
See Also:
Constant Field Values

__INCLUDE_QUERY_STRING

public static final java.lang.String __INCLUDE_QUERY_STRING
See Also:
Constant Field Values

__FORWARD_REQUEST_URI

public static final java.lang.String __FORWARD_REQUEST_URI
Dispatch include attribute names

See Also:
Constant Field Values

__FORWARD_CONTEXT_PATH

public static final java.lang.String __FORWARD_CONTEXT_PATH
See Also:
Constant Field Values

__FORWARD_SERVLET_PATH

public static final java.lang.String __FORWARD_SERVLET_PATH
See Also:
Constant Field Values

__FORWARD_PATH_INFO

public static final java.lang.String __FORWARD_PATH_INFO
See Also:
Constant Field Values

__FORWARD_QUERY_STRING

public static final java.lang.String __FORWARD_QUERY_STRING
See Also:
Constant Field Values

__managedAttributes

public static final StringMap __managedAttributes
Method Detail

isNamed

public boolean isNamed()

include

public void include(ServletRequest servletRequest,
                    ServletResponse servletResponse)
             throws ServletException,
                    java.io.IOException
Description copied from interface: RequestDispatcher
Includes the content of a resource (servlet, JSP page, HTML file) in the response. In essence, this method enables programmatic server-side includes.

The ServletResponse object has its path elements and parameters remain unchanged from the caller's. The included servlet cannot change the response status code or set headers; any attempt to make a change is ignored.

The request and response parameters must be either the same objects as were passed to the calling servlet's service method or be subclasses of the ServletRequestWrapper or ServletResponseWrapper classes that wrap them.

Specified by:
include in interface RequestDispatcher
Parameters:
servletRequest - a ServletRequest object that contains the client's request
servletResponse - a ServletResponse object that contains the servlet's response
Throws:
java.io.IOException - if the included resource throws this exception
ServletException - if the included resource throws this exception

forward

public void forward(ServletRequest servletRequest,
                    ServletResponse servletResponse)
             throws ServletException,
                    java.io.IOException
Description copied from interface: RequestDispatcher
Forwards a request from a servlet to another resource (servlet, JSP file, or HTML file) on the server. This method allows one servlet to do preliminary processing of a request and another resource to generate the response.

For a RequestDispatcher obtained via getRequestDispatcher(), the ServletRequest object has its path elements and parameters adjusted to match the path of the target resource.

forward should be called before the response has been committed to the client (before response body output has been flushed). If the response already has been committed, this method throws an IllegalStateException. Uncommitted output in the response buffer is automatically cleared before the forward.

The request and response parameters must be either the same objects as were passed to the calling servlet's service method or be subclasses of the ServletRequestWrapper or ServletResponseWrapper classes that wrap them.

Specified by:
forward in interface RequestDispatcher
Parameters:
servletRequest - a ServletRequest object that represents the request the client makes of the servlet
servletResponse - a ServletResponse object that represents the response the servlet returns to the client
Throws:
ServletException - if the target resource throws this exception
java.io.IOException - if the target resource throws this exception

toString

public java.lang.String toString()

type

public static int type(java.lang.String type)
Dispatch type from name



Copyright © 2004 Mortbay Consulting Pty. Ltd. All Rights Reserved.