org.mortbay.jetty.servlet

Class Dispatcher

Implemented Interfaces:
RequestDispatcher

public class Dispatcher
extends java.lang.Object
implements RequestDispatcher

Servlet RequestDispatcher.
Version:
$Id: Dispatcher.java,v 1.92 2005/12/12 18:03:31 gregwilkins Exp $
Author:
Greg Wilkins (gregw)

Field Summary

static int
__ALL
static int
__DEFAULT
Dispatch types
static int
__ERROR
static int
__FORWARD
static String
__FORWARD_CONTEXT_PATH
static String
__FORWARD_PATH_INFO
static String
__FORWARD_QUERY_STRING
static String
__FORWARD_REQUEST_URI
Dispatch include attribute names
static String
__FORWARD_SERVLET_PATH
static int
__INCLUDE
static String
__INCLUDE_CONTEXT_PATH
static String
__INCLUDE_PATH_INFO
static String
__INCLUDE_QUERY_STRING
static String
__INCLUDE_REQUEST_URI
Dispatch include attribute names
static String
__INCLUDE_SERVLET_PATH
static int
__REQUEST
static StringMap
__managedAttributes

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()
String
toString()
static int
type(String type)
Dispatch type from name

Field Details

__ALL

public static final int __ALL
Field Value:
15

__DEFAULT

public static final int __DEFAULT
Dispatch types
Field Value:
0

__ERROR

public static final int __ERROR
Field Value:
8

__FORWARD

public static final int __FORWARD
Field Value:
2

__FORWARD_CONTEXT_PATH

public static final String __FORWARD_CONTEXT_PATH

__FORWARD_PATH_INFO

public static final String __FORWARD_PATH_INFO

__FORWARD_QUERY_STRING

public static final String __FORWARD_QUERY_STRING

__FORWARD_REQUEST_URI

public static final String __FORWARD_REQUEST_URI
Dispatch include attribute names

__FORWARD_SERVLET_PATH

public static final String __FORWARD_SERVLET_PATH

__INCLUDE

public static final int __INCLUDE
Field Value:
4

__INCLUDE_CONTEXT_PATH

public static final String __INCLUDE_CONTEXT_PATH

__INCLUDE_PATH_INFO

public static final String __INCLUDE_PATH_INFO

__INCLUDE_QUERY_STRING

public static final String __INCLUDE_QUERY_STRING

__INCLUDE_REQUEST_URI

public static final String __INCLUDE_REQUEST_URI
Dispatch include attribute names

__INCLUDE_SERVLET_PATH

public static final String __INCLUDE_SERVLET_PATH

__REQUEST

public static final int __REQUEST
Field Value:
1

__managedAttributes

public static final StringMap __managedAttributes

Method Details

forward

public void forward(ServletRequest servletRequest,
                    ServletResponse servletResponse)
            throws ServletException,
                   IOException
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:
Throws:
ServletException - if the target resource throws this exception

include

public void include(ServletRequest servletRequest,
                    ServletResponse servletResponse)
            throws ServletException,
                   IOException
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:
Throws:
ServletException - if the included resource throws this exception

isNamed

public boolean isNamed()

toString

public String toString()

type

public static int type(String type)
Dispatch type from name

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