Top Description Inners Fields Constructors Methods
org.mortbay.jetty

public Class Dispatcher

extends Object
implements RequestDispatcher
Class Inheritance
All Implemented Interfaces
javax.servlet.RequestDispatcher
Imports
java.io.IOException, java.util.Collections, .Enumeration, .HashSet, .Iterator, .Map, javax.servlet.DispatcherType, .RequestDispatcher, .ServletException, .ServletRequest, .ServletResponse, javax.servlet.http.HttpServletRequest, .HttpServletResponse, org.mortbay.jetty.handler.ContextHandler, org.mortbay.util.Attributes, .LazyList, .MultiMap, .UrlEncoded

Servlet RequestDispatcher.
Author
Greg Wilkins (gregw)

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
private class

Field Summary

Modifier and TypeField and Description
public static final String
public static final String
__FORWARD_JETTY

Dispatch include attribute names

public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
__INCLUDE_JETTY

Dispatch include attribute names

public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
__JSP_FILE

JSP attributes

private ContextHandler
private String
private String
private String
private String

Constructor Summary

AccessConstructor and Description
public
Dispatcher(ContextHandler contextHandler, String uri, String pathInContext, String query)

public
Dispatcher(ContextHandler contextHandler, String name)

Constructor.

Method Summary

Modifier and TypeMethod and Description
public void
public void
forward(ServletRequest
a ServletRequest object that represents the request the client makes of the servlet
request
,
ServletResponse
a ServletResponse object that represents the response the servlet returns to the client
response
)

Implements javax.servlet.RequestDispatcher.forward.

Forwards a request from a servlet to another resource (servlet, JSP file, or HTML file) on the server.
protected void
forward(ServletRequest request, ServletResponse response, int dispatch)

public void
include(ServletRequest
a ServletRequest object that contains the client's request
request
,
ServletResponse
a ServletResponse object that contains the servlet's response
response
)

Implements javax.servlet.RequestDispatcher.include.

Includes the content of a resource (servlet, JSP page, HTML file) in the response.
public static int
type(String type)

Dispatch type from name

public static int
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

__FORWARD_CONTEXT_PATHback to summary
public static final String __FORWARD_CONTEXT_PATH
__FORWARD_JETTYback to summary
public static final String __FORWARD_JETTY

Dispatch include attribute names

__FORWARD_PATH_INFOback to summary
public static final String __FORWARD_PATH_INFO
__FORWARD_PREFIXback to summary
public static final String __FORWARD_PREFIX
__FORWARD_QUERY_STRINGback to summary
public static final String __FORWARD_QUERY_STRING
__FORWARD_REQUEST_URIback to summary
public static final String __FORWARD_REQUEST_URI
__FORWARD_SERVLET_PATHback to summary
public static final String __FORWARD_SERVLET_PATH
__INCLUDE_CONTEXT_PATHback to summary
public static final String __INCLUDE_CONTEXT_PATH
__INCLUDE_JETTYback to summary
public static final String __INCLUDE_JETTY

Dispatch include attribute names

__INCLUDE_PATH_INFOback to summary
public static final String __INCLUDE_PATH_INFO
__INCLUDE_PREFIXback to summary
public static final String __INCLUDE_PREFIX
__INCLUDE_QUERY_STRINGback to summary
public static final String __INCLUDE_QUERY_STRING
__INCLUDE_REQUEST_URIback to summary
public static final String __INCLUDE_REQUEST_URI
__INCLUDE_SERVLET_PATHback to summary
public static final String __INCLUDE_SERVLET_PATH
__JSP_FILEback to summary
public static final String __JSP_FILE

JSP attributes

_contextHandlerback to summary
private ContextHandler _contextHandler
_dQueryback to summary
private String _dQuery
_namedback to summary
private String _named
_pathback to summary
private String _path
_uriback to summary
private String _uri

Constructor Detail

Dispatcherback to summary
public Dispatcher(ContextHandler contextHandler, String uri, String pathInContext, String query)
Dispatcherback to summary
public Dispatcher(ContextHandler contextHandler, String name) throws IllegalStateException

Constructor.

Method Detail

errorback to summary
public void error(ServletRequest request, ServletResponse response) throws ServletException, IOException
forwardback to summary
public void forward(ServletRequest request, ServletResponse response) throws ServletException, IOException

Implements javax.servlet.RequestDispatcher.forward.

Doc from javax.servlet.RequestDispatcher.forward.

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.

This method sets the dispatcher type of the given request to DispatcherType.FORWARD.

Parameters
request:ServletRequest

a ServletRequest object that represents the request the client makes of the servlet

response:ServletResponse

a ServletResponse object that represents the response the servlet returns to the client

Exceptions
ServletException:
if the target resource throws this exception
IOException:
if the target resource throws this exception
forwardback to summary
protected void forward(ServletRequest request, ServletResponse response, int dispatch) throws ServletException, IOException
includeback to summary
public void include(ServletRequest request, ServletResponse response) throws ServletException, IOException

Implements javax.servlet.RequestDispatcher.include.

Doc from javax.servlet.RequestDispatcher.include.

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.

This method sets the dispatcher type of the given request to DispatcherType.INCLUDE.

Parameters
request:ServletRequest

a ServletRequest object that contains the client's request

response:ServletResponse

a ServletResponse object that contains the servlet's response

Exceptions
ServletException:
if the included resource throws this exception
IOException:
if the included resource throws this exception
typeback to summary
public static int type(String type)

Dispatch type from name

typeback to summary
public static int type(DispatcherType type)
org.mortbay.jetty back to summary

private Class Dispatcher.ForwardAttributes

extends Object
implements Attributes
Class Inheritance
All Implemented Interfaces
org.mortbay.util.Attributes

Field Summary

Modifier and TypeField and Description
pack-priv Attributes
pack-priv String
pack-priv String
pack-priv String
pack-priv String
pack-priv String

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
public Object
public Enumeration<E>
public void
public void
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

_attrback to summary
pack-priv Attributes _attr
_contextPathback to summary
pack-priv String _contextPath
_pathInfoback to summary
pack-priv String _pathInfo
_queryback to summary
pack-priv String _query
_requestURIback to summary
pack-priv String _requestURI
_servletPathback to summary
pack-priv String _servletPath

Constructor Detail

ForwardAttributesback to summary
pack-priv ForwardAttributes(Attributes attributes)

Method Detail

clearAttributesback to summary
public void clearAttributes()

Implements org.mortbay.util.Attributes.clearAttributes.

getAttributeback to summary
public Object getAttribute(String key)

Implements org.mortbay.util.Attributes.getAttribute.

getAttributeNamesback to summary
public Enumeration<E> getAttributeNames()

Implements org.mortbay.util.Attributes.getAttributeNames.

removeAttributeback to summary
public void removeAttribute(String name)

Implements org.mortbay.util.Attributes.removeAttribute.

setAttributeback to summary
public void setAttribute(String key, Object value)

Implements org.mortbay.util.Attributes.setAttribute.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

org.mortbay.jetty back to summary

private Class Dispatcher.IncludeAttributes

extends Object
implements Attributes
Class Inheritance
All Implemented Interfaces
org.mortbay.util.Attributes

Field Summary

Modifier and TypeField and Description
pack-priv Attributes
pack-priv String
pack-priv String
pack-priv String
pack-priv String
pack-priv String

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
public Object
public Enumeration<E>
public void
public void
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

_attrback to summary
pack-priv Attributes _attr
_contextPathback to summary
pack-priv String _contextPath
_pathInfoback to summary
pack-priv String _pathInfo
_queryback to summary
pack-priv String _query
_requestURIback to summary
pack-priv String _requestURI
_servletPathback to summary
pack-priv String _servletPath

Constructor Detail

IncludeAttributesback to summary
pack-priv IncludeAttributes(Attributes attributes)

Method Detail

clearAttributesback to summary
public void clearAttributes()

Implements org.mortbay.util.Attributes.clearAttributes.

getAttributeback to summary
public Object getAttribute(String key)

Implements org.mortbay.util.Attributes.getAttribute.

getAttributeNamesback to summary
public Enumeration<E> getAttributeNames()

Implements org.mortbay.util.Attributes.getAttributeNames.

removeAttributeback to summary
public void removeAttribute(String name)

Implements org.mortbay.util.Attributes.removeAttribute.

setAttributeback to summary
public void setAttribute(String key, Object value)

Implements org.mortbay.util.Attributes.setAttribute.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.