winstone
Class RequestDispatcher

java.lang.Object
  extended by winstone.RequestDispatcher
All Implemented Interfaces:
FilterChain, RequestDispatcher

public class RequestDispatcher
extends java.lang.Object
implements RequestDispatcher, FilterChain

This class implements both the RequestDispatcher and FilterChain components. On the first call to include() or forward(), it starts the filter chain execution if one exists. On the final doFilter() or if there is no chain, we call the include() or forward() again, and the servlet is executed.

Version:
$Id: RequestDispatcher.java,v 1.18 2007/04/23 02:55:35 rickknowles Exp $
Author:
Rick Knowles

Constructor Summary
RequestDispatcher(WebAppConfiguration webAppConfig, ServletConfiguration servletConfig)
          Constructor.
 
Method Summary
 void doFilter(ServletRequest request, ServletResponse response)
          Handles the processing of the chain of filters, so that we process them all, then pass on to the main servlet
 void forward(ServletRequest request, ServletResponse response)
          Forwards to another servlet, and when it's finished executing that other servlet, cut off execution.
 java.lang.String getName()
           
protected  WinstoneRequest getUnwrappedRequest(ServletRequest request)
          Unwrap back to the original container allocated request object
protected  WinstoneResponse getUnwrappedResponse(ServletResponse response)
          Unwrap back to the original container allocated response object
 void include(ServletRequest request, ServletResponse response)
          Includes the execution of a servlet into the current request Note this method enters itself twice: once with the initial call, and once again when all the filters have completed.
 void setForErrorDispatcher(java.lang.String servletPath, java.lang.String pathInfo, java.lang.String queryString, int statusCode, java.lang.String summaryMessage, java.lang.Throwable exception, java.lang.String errorHandlerURI, Mapping[] errorFilterPatterns)
           
 void setForInitialDispatcher(java.lang.String servletPath, java.lang.String pathInfo, java.lang.String queryString, java.lang.String requestURIInsideWebapp, Mapping[] requestFilterPatterns, AuthenticationHandler authHandler)
           
 void setForNamedDispatcher(Mapping[] forwardFilterPatterns, Mapping[] includeFilterPatterns)
           
 void setForURLDispatcher(java.lang.String servletPath, java.lang.String pathInfo, java.lang.String queryString, java.lang.String requestURIInsideWebapp, Mapping[] forwardFilterPatterns, Mapping[] includeFilterPatterns)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RequestDispatcher

public RequestDispatcher(WebAppConfiguration webAppConfig,
                         ServletConfiguration servletConfig)
Constructor. This initializes the filter chain and sets up the details needed to handle a servlet excecution, such as security constraints, filters, etc.

Method Detail

setForNamedDispatcher

public void setForNamedDispatcher(Mapping[] forwardFilterPatterns,
                                  Mapping[] includeFilterPatterns)

setForURLDispatcher

public void setForURLDispatcher(java.lang.String servletPath,
                                java.lang.String pathInfo,
                                java.lang.String queryString,
                                java.lang.String requestURIInsideWebapp,
                                Mapping[] forwardFilterPatterns,
                                Mapping[] includeFilterPatterns)

setForErrorDispatcher

public void setForErrorDispatcher(java.lang.String servletPath,
                                  java.lang.String pathInfo,
                                  java.lang.String queryString,
                                  int statusCode,
                                  java.lang.String summaryMessage,
                                  java.lang.Throwable exception,
                                  java.lang.String errorHandlerURI,
                                  Mapping[] errorFilterPatterns)

setForInitialDispatcher

public void setForInitialDispatcher(java.lang.String servletPath,
                                    java.lang.String pathInfo,
                                    java.lang.String queryString,
                                    java.lang.String requestURIInsideWebapp,
                                    Mapping[] requestFilterPatterns,
                                    AuthenticationHandler authHandler)

getName

public java.lang.String getName()

include

public void include(ServletRequest request,
                    ServletResponse response)
             throws ServletException,
                    java.io.IOException
Includes the execution of a servlet into the current request Note this method enters itself twice: once with the initial call, and once again when all the filters have completed.

Specified by:
include in interface RequestDispatcher
Throws:
ServletException
java.io.IOException

forward

public void forward(ServletRequest request,
                    ServletResponse response)
             throws ServletException,
                    java.io.IOException
Forwards to another servlet, and when it's finished executing that other servlet, cut off execution. Note this method enters itself twice: once with the initial call, and once again when all the filters have completed.

Specified by:
forward in interface RequestDispatcher
Throws:
ServletException
java.io.IOException

doFilter

public void doFilter(ServletRequest request,
                     ServletResponse response)
              throws ServletException,
                     java.io.IOException
Handles the processing of the chain of filters, so that we process them all, then pass on to the main servlet

Specified by:
doFilter in interface FilterChain
Throws:
ServletException
java.io.IOException

getUnwrappedRequest

protected WinstoneRequest getUnwrappedRequest(ServletRequest request)
Unwrap back to the original container allocated request object


getUnwrappedResponse

protected WinstoneResponse getUnwrappedResponse(ServletResponse response)
Unwrap back to the original container allocated response object



Copyright © 2013. All Rights Reserved.