com.arsdigita.web
Class DispatcherServlet

java.lang.Object
  extended byjavax.servlet.GenericServlet
      extended byjavax.servlet.http.HttpServlet
          extended bycom.arsdigita.web.BaseServlet
              extended bycom.arsdigita.web.DispatcherServlet
All Implemented Interfaces:
Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class DispatcherServlet
extends BaseServlet

The CCM main dispatcher. This servlet serves as the main servlet (mapped to "/someprefix/*") for requests to the CCM webapp.

Upon finding an application at the requested URL, this class sets a request attribute storing the ID of the application and forwards to the servlet associated with it. If instead no application is found, the request is forwarded to the fallback servlet, if defined.

This servlet may be deployed using web.xml entries like these:

 <servlet>
   <servlet-name>ccm-dispatcher</servlet-name>
   <servlet-class>com.arsdigita.web.DispatcherServlet</servlet-class>
   <init-param>
     <param-name>fallback-servlet</param-name>
     <param-value>the-old-site-node-dispatcher</param-value>
   </init-param>
 </servlet>

 <servlet-mapping>
   <servlet-name>ccm-dispatcher</servlet-name>
   <url-pattern>/ccm/*</url-pattern>
 </servlet-mapping>
 

It's important to also edit the com.arsdigita.web.Initializer options to reflect where you've put your dispatcher.

 init com.arsdigita.web.Initializer {
     ...
     // This corresponds to a servlet mapping of "/ccm/*" and
     // assumes CCM is the default webapp.
     dispatcherContextPath = "";
     dispatcherServletPath = "/ccm";
     ...
 }
 

Version:
$Id: //core-platform/dev/src/com/arsdigita/web/DispatcherServlet.java#17 $
Author:
Justin Ross <jross@redhat.com>
See Also:
BaseApplicationServlet, Serialized Form

Field Summary
static String FALLBACK_SERVLET_PARAMETER
           
static String FALLING_BACK_ATTRIBUTE
           
static String versionId
           
 
Fields inherited from class com.arsdigita.web.BaseServlet
REQUEST_URL_ATTRIBUTE
 
Constructor Summary
DispatcherServlet()
           
 
Method Summary
protected  void doDestroy()
           
 void doInit()
           
protected  void doService(javax.servlet.http.HttpServletRequest sreq, javax.servlet.http.HttpServletResponse sresp)
          The method that BaseServlet.doGet(HttpServletRequest,HttpServletResponse) and BaseServlet.doPost(HttpServletRequest,HttpServletResponse) call.
 
Methods inherited from class com.arsdigita.web.BaseServlet
destroy, doGet, doPost, getUserContext, init
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
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

FALLBACK_SERVLET_PARAMETER

public static final String FALLBACK_SERVLET_PARAMETER
See Also:
Constant Field Values

FALLING_BACK_ATTRIBUTE

public static final String FALLING_BACK_ATTRIBUTE
Constructor Detail

DispatcherServlet

public DispatcherServlet()
Method Detail

doInit

public void doInit()
            throws javax.servlet.ServletException
Overrides:
doInit in class BaseServlet
Throws:
javax.servlet.ServletException

doService

protected void doService(javax.servlet.http.HttpServletRequest sreq,
                         javax.servlet.http.HttpServletResponse sresp)
                  throws javax.servlet.ServletException,
                         IOException
Description copied from class: BaseServlet

The method that BaseServlet.doGet(HttpServletRequest,HttpServletResponse) and BaseServlet.doPost(HttpServletRequest,HttpServletResponse) call. This is the extension point for users of this class.

Overrides:
doService in class BaseServlet
Throws:
javax.servlet.ServletException
IOException

doDestroy

protected void doDestroy()
Overrides:
doDestroy in class BaseServlet


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