com.arsdigita.dispatcher
Class JSPApplicationDispatcher

java.lang.Object
  extended byjavax.servlet.GenericServlet
      extended byjavax.servlet.http.HttpServlet
          extended bycom.arsdigita.dispatcher.BaseDispatcherServlet
              extended bycom.arsdigita.dispatcher.JSPApplicationDispatcher
All Implemented Interfaces:
Dispatcher, com.arsdigita.dispatcher.DispatcherConstants, Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class JSPApplicationDispatcher
extends BaseDispatcherServlet
implements Dispatcher

Basic dispatcher class for dispatching URLs to JSP or other file-based assets (images, CSS, HTML, etc.) in the file system in the context of a single package's URL space.

Given an application context that contains a SiteNode, and a remaining URL, tries to resolve the remaining URL into a concrete file:
$root/packages/$key/$remaining-url
where
$root is the ACS webapp root
$key is siteNode.getPackageKey()
$remaining-url is given by appContext.getRemainingURLPart()

To make the URL mapping in JSPApplicationDispatcher work, you must map the "jsp" servlet in web.xml to whatever your entry-point dispatcher is (whatever servlet is mapped to the URL pattern "/"). Otherwise, requests for *.jsp will get picked up by the JSP container before any ACS dispatchers have a shot at URL mapping.

Example: if the application sample-app is mounted on the site nodes /sample1 and /sample2 then URLs will be dispatched as follows:

Request URL File served
/sample1/page.jsp /packages/sample-app/www/page.jsp
/sample2/image.gif /packages/sample-app/www/image.gif
/sample2/script.jsp /packages/sample-app/www/script.jsp

Version:
$Version$, $Date: 2004/04/07 $
Author:
Bill Schneider
See Also:
Serialized Form

Field Summary
static String versionId
           
 
Fields inherited from class com.arsdigita.dispatcher.BaseDispatcherServlet
DISPATCHER_PREFIX_ATTR, ERROR_REQUEST_ATTRIBUTE, INCLUDE_URI, JSP_EXCEPTION_ATTRIBUTE, ORIGINAL_REQUEST_ATTR, REDIRECT_SEMAPHORE, REENTRANCE_ATTRIBUTE, REQUEST_CONTEXT_ATTR, WELCOME_FILES, WRAPPED_REQUEST_ATTR
 
Constructor Summary
JSPApplicationDispatcher()
           
 
Method Summary
protected  RequestContext authenticateUser(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, RequestContext ctx)
          A placeholder method for performing user authentication during request processing.
 void dispatch(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, RequestContext actx)
          Dispatches this request.
static JSPApplicationDispatcher getInstance()
          Deprecated. No longer returns a singleton instance. Remains in place for API stability.
static JSPApplicationDispatcher newInstance()
          Returns a new instance of a JSPApplicationDispatcher.
 
Methods inherited from class com.arsdigita.dispatcher.BaseDispatcherServlet
addRequestListener, fireFinishedListener, fireStartListener, init, service
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

versionId

public static final String versionId
See Also:
Constant Field Values
Constructor Detail

JSPApplicationDispatcher

public JSPApplicationDispatcher()
Method Detail

newInstance

public static JSPApplicationDispatcher newInstance()
Returns a new instance of a JSPApplicationDispatcher.

Returns:
a new JSPApplicationDispatcher.

getInstance

public static JSPApplicationDispatcher getInstance()
Deprecated. No longer returns a singleton instance. Remains in place for API stability.

Returns a new instance of JSPApplicationDispatcher.

Returns:
a JSPApplicationDispatcher object.

authenticateUser

protected RequestContext authenticateUser(javax.servlet.http.HttpServletRequest req,
                                          javax.servlet.http.HttpServletResponse resp,
                                          RequestContext ctx)
                                   throws RedirectException
Description copied from class: BaseDispatcherServlet
A placeholder method for performing user authentication during request processing. Subclasses should override this method.

Specified by:
authenticateUser in class BaseDispatcherServlet
Parameters:
req - the current servlet request object
Returns:
the updated request context (which may be the same as the context context parameter).
Throws:
RedirectException - if the dispatcher should redirect the client to the page contained in the exception

dispatch

public void dispatch(javax.servlet.http.HttpServletRequest req,
                     javax.servlet.http.HttpServletResponse resp,
                     RequestContext actx)
              throws IOException,
                     javax.servlet.ServletException
Description copied from interface: Dispatcher
Dispatches this request.

Specified by:
dispatch in interface Dispatcher
Parameters:
req - the servlet request object
resp - the servlet response object
actx - the request context
Throws:
javax.servlet.ServletException - may be thrown by the dispatcher to propagate a generic error to its caller
IOException - may be thrown by the dispatcher to indicate an I/O error


Copyright (c) 2004 Red Hat, Inc. Corporation. All Rights Reserved. Generated at July 21 2004:2337 UTC