|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.arsdigita.cms.dispatcher.CMSDispatcher
The CMS Dispatcher serves all request made within a content section. This dispatcher is called by the Subsite dispatcher.
Here are the steps for a request to http://yourserver/cms/cheese in excruciating detail:
A client sends a request to the web server, which passes it on to the global ACS dispatcher.
The global ACS dispatcher examines the first part of the URL, notices that CMS is mounted at /cms and hands the request to the CMS dispatcher.
The CMS dispatcher determines whether a Page has been
registered to the URL /cheese in this section via its
PageResolver
.
Since no page is registered to the URL, the CMS dispatcher asks
the content section (via its
ItemResolver
)
for a content item for /cheese in this content section. The
result of this process is a ContentItem
object.
The CMS dispatcher asks the content section for a Page to use as the "master template" for this item. The content section may apply item-, type-, or request-specific rules to make this decision (for example, check a user preference for normal or accessible style, or a query parameter for a printable version).
The CMS dispatcher hands the master Page object to
the SiteNodePresentationManager
to serve the page.
The presentation manager asks the master Page object for an XML document representing the data for the page.
The master template begins walking through its component
hierarchy, converting each component to XML by calling its
generateXML method. The component responsible for rendering
the content item uses an
XMLGenerator
to convert the
content item to XML.
The presentation manager receives the completed XML document, and selects an XSL transformer to use for generating the HTML. The stylesheet on which the transformer is based contains templates for all styles and all content types in the content section, in particular those from the file cms-item.xsl.
Field Summary | |
static String |
ADMIN_URL
|
static String |
CONTENT_ITEM
|
static String |
CONTENT_SECTION
|
static String[] |
INDEX_FILES
|
static String |
PREVIEW
The context for previewing items |
static String |
versionId
|
Fields inherited from interface com.arsdigita.dispatcher.ChainedDispatcher |
DISPATCH_BREAK, DISPATCH_CONTINUE |
Constructor Summary | |
CMSDispatcher()
|
|
CMSDispatcher(boolean adminOnly)
|
Method Summary | |
int |
chainedDispatch(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
com.arsdigita.dispatcher.RequestContext actx)
|
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 a CMS package instance. |
protected ContentSection |
findContentSection(String url)
Looks up the current content section using the remaining URL stored in the request context object and the SiteNode class. |
protected ContentItem |
getContentItem(ContentSection section,
String url,
String context)
Lookup a content item by section and URL. |
static ContentItem |
getContentItem(javax.servlet.http.HttpServletRequest request)
Fetches the content item from the request attributes. |
static ContentSection |
getContentSection(javax.servlet.http.HttpServletRequest request)
Fetches the content section from the request attributes. |
static ItemResolver |
getItemResolver(ContentSection section)
Fetches the ItemResolver for a content section. |
static PageResolver |
getPageResolver(ContentSection section)
Fetches the PageResolver for a content section. |
protected ResourceHandler |
getResource(ContentSection section,
String url)
Fetch a resource based on the URL stub. |
protected SecurityManager |
getSecurityManager(ContentSection section)
Returns the Security Manager to use for the specified section. |
static XMLGenerator |
getXMLGenerator(ContentSection section)
Fetches the XMLGenerator for a content section. |
protected boolean |
isAdminPage(String url)
Does this URL correspond to an admin page? |
protected void |
preview(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
com.arsdigita.dispatcher.RequestContext actx)
Preview the current content item. |
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(ContentSection section,
String url)
Flushes the page resolver cache. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String versionId
public static final String CONTENT_SECTION
public static final String CONTENT_ITEM
public static final String[] INDEX_FILES
public static final String ADMIN_URL
public static final String PREVIEW
Constructor Detail |
public CMSDispatcher()
public CMSDispatcher(boolean adminOnly)
Method Detail |
public void dispatch(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, com.arsdigita.dispatcher.RequestContext actx) throws IOException, javax.servlet.ServletException
dispatch
in interface com.arsdigita.dispatcher.Dispatcher
request
- The requestresponse
- The responseactx
- The request context
IOException
javax.servlet.ServletException
public int chainedDispatch(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, com.arsdigita.dispatcher.RequestContext actx) throws IOException, javax.servlet.ServletException
chainedDispatch
in interface com.arsdigita.dispatcher.ChainedDispatcher
IOException
javax.servlet.ServletException
protected SecurityManager getSecurityManager(ContentSection section)
section
- The current ContentSectionprotected void checkUserAccess(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, com.arsdigita.dispatcher.RequestContext actx) throws javax.servlet.ServletException, AccessDeniedException
request
- The HTTP requestresponse
- The HTTP responseactx
- The request context
AccessDeniedException
- if the user does not have access.
javax.servlet.ServletException
public static ContentSection getContentSection(javax.servlet.http.HttpServletRequest request)
request
- The HTTP request
public static ContentItem getContentItem(javax.servlet.http.HttpServletRequest request)
request
- The HTTP request
protected ContentSection findContentSection(String url) throws com.arsdigita.domain.DataObjectNotFoundException
url
- The section URL stub
com.arsdigita.domain.DataObjectNotFoundException
protected ResourceHandler getResource(ContentSection section, String url) throws javax.servlet.ServletException
section
- The current content sectionurl
- The section-relative URL
javax.servlet.ServletException
protected ContentItem getContentItem(ContentSection section, String url, String context) throws javax.servlet.ServletException
section
- The content sectionurl
- The URL relative to the content sectioncontext
- The use context
javax.servlet.ServletException
protected void preview(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, com.arsdigita.dispatcher.RequestContext actx) throws IOException, javax.servlet.ServletException
request
- The HTTP requestresponse
- The HTTP responseactx
- The request context
IOException
javax.servlet.ServletException
public static void releaseResource(ContentSection section, String url)
section
- The current content sectionurl
- The section-relative URLpublic static PageResolver getPageResolver(ContentSection section)
section
- The content section
public static ItemResolver getItemResolver(ContentSection section)
section
- The content section
public static XMLGenerator getXMLGenerator(ContentSection section)
section
- The content section
protected boolean isAdminPage(String url)
protected void redirectToLoginPage(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws javax.servlet.ServletException
javax.servlet.ServletException
- If there is an exception thrown while
trying to redirect, wrap that exception in a ServletException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |