com.arsdigita.cms.dispatcher
Class ContentCenterDispatcher

java.lang.Object
  extended bycom.arsdigita.util.LockableImpl
      extended bycom.arsdigita.cms.dispatcher.ContentCenterDispatcher
All Implemented Interfaces:
com.arsdigita.dispatcher.Dispatcher, com.arsdigita.util.Lockable

public class ContentCenterDispatcher
extends com.arsdigita.util.LockableImpl
implements com.arsdigita.dispatcher.Dispatcher

The CMS Workspace Dispatcher serves all request made within the Content Center application. This dispatcher is called by the Subsite dispatcher.

Here are the steps for a request to http://yourserver/content-center/cheese:

  1. A client sends a request to the web server, which passes it on to the global ACS dispatcher.

  2. The global ACS dispatcher examines the first part of the URL, notices that the Content Center application is mounted at /content-center and hands the request to the CMS Workspace dispatcher.

  3. The CMS Workspace dispatcher determines whether a Page has been registered to the URL /cheese.

  4. If no Page is registered to the URL /cheese, then the CMS Workspace dispatcher hands the request to the JSPApplicationDispatcher.

Version:
$Revision: #17 $ $DateTime: 2004/04/07 16:07:11 $
Author:
Michael Pih (pihman@arsdigita.com)

Field Summary
static String DEFAULT_MAP_FILE
          The path of the file that maps resources.
static String versionId
           
 
Constructor Summary
ContentCenterDispatcher()
          Constructor.
 
Method Summary
protected  void addResource(String url, String className)
          Map a page to a URL.
protected  void checkUserAccess(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, com.arsdigita.dispatcher.RequestContext actx)
          Verify that the user is logged in and is able to view the page.
 void dispatch(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, com.arsdigita.dispatcher.RequestContext actx)
          Handles requests made to the Content Center package.
protected  ResourceHandler getResource(String url)
          Fetch a page based on the URL stub.
static String getURLStubForClass(String classname)
          Return the URL stub for the class name, can return null if not mapped
protected  void redirectToLoginPage(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
          Redirects the client to the login page, setting the return url to the current request URI.
static void releaseResource(String url)
          Release the page at the specified URL.
 void requireTrailingSlash(String url)
          Adds a URL to the list of URLs that are required to have trailing slashes.
 void setNotFoundDispatcher(com.arsdigita.dispatcher.Dispatcher d)
          sets the default page to display if no page can be found for the URL in the page map on dispatch.
 
Methods inherited from class com.arsdigita.util.LockableImpl
isLocked, lock
 
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

DEFAULT_MAP_FILE

public static final String DEFAULT_MAP_FILE
The path of the file that maps resources.

See Also:
Constant Field Values
Constructor Detail

ContentCenterDispatcher

public ContentCenterDispatcher()
Constructor.

Method Detail

dispatch

public void dispatch(javax.servlet.http.HttpServletRequest request,
                     javax.servlet.http.HttpServletResponse response,
                     com.arsdigita.dispatcher.RequestContext actx)
              throws IOException,
                     javax.servlet.ServletException
Handles requests made to the Content Center package.

Specified by:
dispatch in interface com.arsdigita.dispatcher.Dispatcher
Parameters:
request - The HTTP request
response - The HTTP response
actx - The request context
Throws:
IOException
javax.servlet.ServletException

setNotFoundDispatcher

public final void setNotFoundDispatcher(com.arsdigita.dispatcher.Dispatcher d)
sets the default page to display if no page can be found for the URL in the page map on dispatch.


requireTrailingSlash

public void requireTrailingSlash(String url)
Adds a URL to the list of URLs that are required to have trailing slashes. A request for url will be redirected to url + "/" if the original URL request (what you see in your browser) doesn't include a trailing slash. This is required for creating virtual directories, so that relative URLs and redirects work.


getURLStubForClass

public static String getURLStubForClass(String classname)
Return the URL stub for the class name, can return null if not mapped


getResource

protected ResourceHandler getResource(String url)
                               throws javax.servlet.ServletException
Fetch a page based on the URL stub.

Parameters:
url - The URL stub following the site-node URL
Returns:
A ResourceHandler or null if none exists.
Throws:
javax.servlet.ServletException

addResource

protected void addResource(String url,
                           String className)
Map a page to a URL.

Parameters:
url - The URL
className - The name of the ResourceHandler class

releaseResource

public static void releaseResource(String url)
Release the page at the specified URL.

Parameters:
url - The URL

checkUserAccess

protected void checkUserAccess(javax.servlet.http.HttpServletRequest request,
                               javax.servlet.http.HttpServletResponse response,
                               com.arsdigita.dispatcher.RequestContext actx)
                        throws javax.servlet.ServletException
Verify that the user is logged in and is able to view the page. Subclasses can override this method if they need to, but should always be sure to call super.checkUserAccess(...)

Parameters:
request - The HTTP request
response - The HTTP response
actx - The request context
Throws:
javax.servlet.ServletException

redirectToLoginPage

protected void redirectToLoginPage(javax.servlet.http.HttpServletRequest req,
                                   javax.servlet.http.HttpServletResponse resp)
                            throws javax.servlet.ServletException
Redirects the client to the login page, setting the return url to the current request URI.

Throws:
javax.servlet.ServletException - If there is an exception thrown while trying to redirect, wrap that exception in a ServletException


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