com.arsdigita.cms.dispatcher
Class ContentItemDispatcher

java.lang.Object
  extended bycom.arsdigita.cms.dispatcher.ContentItemDispatcher
All Implemented Interfaces:
com.arsdigita.dispatcher.Dispatcher

public class ContentItemDispatcher
extends Object
implements com.arsdigita.dispatcher.Dispatcher

This is the dispatcher for content-sections. It maintains a ContentItem-to-Template cache Code that modifies a published ContentItem's template must update the cache in this class by calling the appropriate cache methods.

Author:
bche@redhat.com

Field Summary
protected  ItemXML m_itemXML
           
static Map s_templateResolverCache
           
 
Fields inherited from interface com.arsdigita.dispatcher.Dispatcher
versionId
 
Constructor Summary
ContentItemDispatcher()
           
 
Method Summary
static void cachePut(ContentItem item, Template t)
          Method cachePut.
static void cachePut(ContentSection section, ContentType type, Template t)
          Method cachePut.
static void cacheRemove(ContentItem item)
          Method cacheRemove.
 void dispatch(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, com.arsdigita.dispatcher.RequestContext actx)
           
 String fetchTemplateURL(ContentItem item, javax.servlet.http.HttpServletRequest request, com.arsdigita.dispatcher.RequestContext actx)
          Fetches the URL of a template for an item.
static ContentItem getContentItem(javax.servlet.http.HttpServletRequest request)
          Fetches the content item from the request attributes.
 TemplateResolver getTemplateResolver(ContentSection section)
          Fetches the TemplateResolver for a content section.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

s_templateResolverCache

public static Map s_templateResolverCache

m_itemXML

protected ItemXML m_itemXML
Constructor Detail

ContentItemDispatcher

public ContentItemDispatcher()
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
Specified by:
dispatch in interface com.arsdigita.dispatcher.Dispatcher
Throws:
IOException
javax.servlet.ServletException
See Also:
(HttpServletRequest, HttpServletResponse, RequestContext)

getContentItem

public static ContentItem getContentItem(javax.servlet.http.HttpServletRequest request)
Fetches the content item from the request attributes.

Parameters:
request - The HTTP request
Returns:
The content item

cacheRemove

public static void cacheRemove(ContentItem item)
Method cacheRemove. Removes the cached template path for the contentItem item

Parameters:
item -

cachePut

public static void cachePut(ContentItem item,
                            Template t)
Method cachePut. Maps the ContentItem item to the template t in the cache

Parameters:
item -
t -

cachePut

public static void cachePut(ContentSection section,
                            ContentType type,
                            Template t)
Method cachePut. Maps all the content items of ContentType type and in ContentSection section that don't have their own templates to the template t in the cache

Parameters:
section -
type -
t -

fetchTemplateURL

public String fetchTemplateURL(ContentItem item,
                               javax.servlet.http.HttpServletRequest request,
                               com.arsdigita.dispatcher.RequestContext actx)
Fetches the URL of a template for an item. The returned URL is relative to the webapp context.


getTemplateResolver

public TemplateResolver getTemplateResolver(ContentSection section)
Fetches the TemplateResolver for a content section. Checks cache first.

Parameters:
section - The content section
Returns:
The TemplateResolver associated with the content section


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