## org.mortbay.jetty.servlet
Class Dispatcher

    java.lang.Object
      |
      +--org.mortbay.jetty.servlet.Dispatcher

All Implemented Interfaces:
  RequestDispatcher

public class Dispatcher
extends java.lang.Object
implements RequestDispatcher

Servlet RequestDispatcher. If the request attribute "org.mortbay.jetty.servlet.Dispatcher.shared_session" is set, then sessions are shared in cross context dispatch. Watch out for class loading issues!

Version:
  $Id: Dispatcher.java,v 1.54.2.7 2004/05/06 10:00:05 gregwilkins Exp $
Author:
  Greg Wilkins (gregw)

Field Summary
`static java.lang.String` `__CONTEXT_PATH`
`static StringMap` `__managedAttributes`
`static java.lang.String` `__PATH_INFO`
`static java.lang.String` `__QUERY_STRING`
`static java.lang.String` `__REQUEST_URI`
`static java.lang.String` `__SERVLET_PATH`

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()`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### __REQUEST_URI

    public static final java.lang.String __REQUEST_URI

See Also:
  Constant Field Values

### __CONTEXT_PATH

    public static final java.lang.String __CONTEXT_PATH

See Also:
  Constant Field Values

### __SERVLET_PATH

    public static final java.lang.String __SERVLET_PATH

See Also:
  Constant Field Values

### __PATH_INFO

    public static final java.lang.String __PATH_INFO

See Also:
  Constant Field Values

### __QUERY_STRING

    public static final java.lang.String __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:
    `ServletException` - if the included resource throws this exception
    `java.io.IOException` - 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:
    `java.io.IOException` - if the target resource throws this exception
    `ServletException` - if the target resource throws this exception

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

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