Author: pboy
Date: 2012-03-11 09:14:14 +0000 (Sun, 11 Mar 2012)
New Revision: 2286
Added:
trunk/ccm-bundle/web/themes/static/aplaws-generic/content-section-admin.xsl
trunk/ccm-cms/src/com/arsdigita/cms/dispatcher/ContentCenterDispatcher.java.nolongerInUse
trunk/ccm-cms/src/com/arsdigita/cms/dispatcher/ServiceDispatcher..nolongerInUse
trunk/ccm-ldn-aplaws/web/themes/static/aplaws/content-section-admin.xsl
Removed:
trunk/ccm-bundle/web/themes/static/aplaws-generic/content-section-content-admin.xsl
trunk/ccm-cms/src/com/arsdigita/cms/dispatcher/ContentCenterDispatcher.java
trunk/ccm-cms/src/com/arsdigita/cms/dispatcher/ServiceDispatcher.java
trunk/ccm-core/src/com/arsdigita/templating/LegacyStylesheetResolver.java.nolongerInUse
trunk/ccm-ldn-aplaws/web/themes/static/aplaws/content-section-content-admin.xsl
Modified:
trunk/ccm-bundle/bundles/demo/cfg/web-sci.xml
trunk/ccm-bundle/bundles/devel/cfg/web-sci.xml
trunk/ccm-cms-assets-fileattachment/src/com/arsdigita/cms/contentassets/ui/FileAttachmentModelBuilder.java
trunk/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageStepDisplay.java
trunk/ccm-cms-types-organization/src/com/arsdigita/cms/contenttypes/ui/OrganizationImageStep.java
trunk/ccm-cms/src/com/arsdigita/cms/CMS.java
trunk/ccm-cms/src/com/arsdigita/cms/ContentSection.java
trunk/ccm-cms/src/com/arsdigita/cms/Loader.java
trunk/ccm-cms/src/com/arsdigita/cms/Service.java
trunk/ccm-cms/src/com/arsdigita/cms/ServiceServlet.java
trunk/ccm-cms/src/com/arsdigita/cms/Workspace.java
trunk/ccm-cms/src/com/arsdigita/cms/WorkspaceServlet.java
trunk/ccm-cms/src/com/arsdigita/cms/dispatcher/CMSDispatcher.java
trunk/ccm-cms/src/com/arsdigita/cms/dispatcher/CMSPage.java
trunk/ccm-cms/src/com/arsdigita/cms/dispatcher/ContentSectionDispatcher.java
trunk/ccm-cms/src/com/arsdigita/cms/dispatcher/ItemDispatcher.java
trunk/ccm-cms/src/com/arsdigita/cms/dispatcher/MultilingualItemResolver.java
trunk/ccm-cms/src/com/arsdigita/cms/dispatcher/SimpleItemResolver.java
trunk/ccm-cms/src/com/arsdigita/cms/dispatcher/Utilities.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/CMSApplicationPage.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ContentItemNavbar.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ContentItemRenderer.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ContentSectionNavbar.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/GlobalNavigation.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageBrowser.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageDisplay.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchWidget.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/SectionConfigurationPage.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/WorkspaceContextBar.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/lifecycle/ItemLifecycleItemPane.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/lifecycle/ItemLifecycleSelectForm.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/portlet/TaskPortletRenderer.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/templates/CategoryTemplates.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/workflow/TaskFinishForm.java
trunk/ccm-core/src/com/arsdigita/categorization/Categorization.java
trunk/ccm-core/src/com/arsdigita/templating/ApplicationPatternGenerator.java
trunk/ccm-core/src/com/arsdigita/templating/URLPatternGenerator.java
trunk/ccm-core/src/com/arsdigita/ui/login/UserInfo.java
trunk/ccm-core/src/com/arsdigita/web/BaseApplicationServlet.java
trunk/ccm-core/src/com/arsdigita/web/URL.java
trunk/ccm-docmgr/src/com/arsdigita/cms/docmgr/Repository.java
trunk/ccm-docmgr/src/com/arsdigita/cms/docmgr/dispatcher/MultilingualDocumentResolver.java
trunk/ccm-ldn-aplaws/bundles/custom/cfg/web.xml
trunk/ccm-ldn-aplaws/bundles/demo/cfg/web.xml
trunk/ccm-ldn-aplaws/bundles/devel/cfg/web.xml
trunk/ccm-ldn-aplaws/bundles/extended/cfg/web.xml
trunk/ccm-ldn-aplaws/bundles/standard/cfg/web.xml
trunk/ccm-ldn-terms/src/com/arsdigita/london/terms/importer/TermItemBuilder.java
trunk/ccm-simplesurvey/src/com/arsdigita/simplesurvey/Survey.java
trunk/ccm-simplesurvey/src/com/arsdigita/simplesurvey/ui/SimpleSurveyPanel.java
trunk/ccm-simplesurvey/src/com/arsdigita/simplesurvey/ui/SurveyTable.java
trunk/ccm-simplesurvey/src/com/arsdigita/simplesurvey/ui/admin/AdminSurveyTable.java
trunk/ccm-webpage/src/com/arsdigita/cms/webpage/ui/WebpageCMSEditorPage.java
trunk/ccm-webpage/src/com/arsdigita/cms/webpage/ui/WebpagePreviewPage.java
Log:
Module ccm-cms cms-service and cms-workspace (content-center) now legacy free type of application. Module ccm-cms is now completely legacy free. Update script not yet included.
Modified: trunk/ccm-bundle/bundles/demo/cfg/web-sci.xml
===================================================================
--- trunk/ccm-bundle/bundles/demo/cfg/web-sci.xml 2012-03-11 09:12:45 UTC (rev 2285)
+++ trunk/ccm-bundle/bundles/demo/cfg/web-sci.xml 2012-03-11 09:14:14 UTC (rev 2286)
@@ -32,7 +32,7 @@
<filter>
<filter-name>shortcuts</filter-name>
- <filter-class>com.arsdigita.london.shortcuts.ShortcutFilter</filter-class>
+ <filter-class>com.arsdigita.shortcuts.ShortcutFilter</filter-class>
</filter>
<filter>
@@ -52,6 +52,7 @@
</filter-mapping>
-->
+
<filter-mapping>
<filter-name>subsite</filter-name>
<url-pattern>/*</url-pattern>
@@ -158,11 +159,21 @@
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<servlet>
+ <servlet-name>content-center</servlet-name>
+ <servlet-class>com.arsdigita.cms.WorkspaceServlet</servlet-class>
+ </servlet>
+
+ <servlet>
<servlet-name>content-section</servlet-name>
<servlet-class>com.arsdigita.cms.ContentSectionServlet</servlet-class>
</servlet>
<servlet>
+ <servlet-name>cms-service</servlet-name>
+ <servlet-class>com.arsdigita.cms.ServiceServlet</servlet-class>
+ </servlet>
+
+ <servlet>
<servlet-name>content-type-xsl</servlet-name>
<servlet-class>com.arsdigita.cms.dispatcher.ContentTypeXSLServlet</servlet-class>
</servlet>
@@ -280,13 +291,13 @@
</servlet>
<!-- module ccm-ldn-search - servlet declarations END -->
- <!-- module ccm-ldn-shortcuts - servlet definitions -->
+ <!-- module ccm-shortcuts - servlet definitions -->
<servlet>
<servlet-name>shortcuts-files</servlet-name>
<servlet-class>com.arsdigita.web.ApplicationFileServlet</servlet-class>
<init-param>
<param-name>template-path</param-name>
- <param-value>/templates/ccm-ldn-shortcuts</param-value>
+ <param-value>/templates/ccm-shortcuts</param-value>
</init-param>
</servlet>
@@ -386,10 +397,10 @@
</servlet-mapping>
<!-- module ccm-ldn-search - servlet mappings END -->
- <!-- module ccm-ldn-shortcuts - servlet mappings -->
+ <!-- module ccm-shortcuts - servlet mappings -->
<servlet-mapping>
<servlet-name>shortcuts-files</servlet-name>
- <url-pattern>/ccm-ldn-shortcuts/files/*</url-pattern>
+ <url-pattern>/ccm-shortcuts/files/*</url-pattern>
</servlet-mapping>
<!-- module ccm-subsite - servlet mappings BEGIN -->
@@ -495,11 +506,21 @@
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<servlet-mapping>
+ <servlet-name>content-center</servlet-name>
+ <url-pattern>/templates/servlet/content-center/*</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
<servlet-name>content-section</servlet-name>
- <url-pattern>/themes/servlet/content-section/*</url-pattern>
+ <url-pattern>/templates/servlet/content-section/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
+ <servlet-name>cms-service</servlet-name>
+ <url-pattern>/templates/servlet/cms-service/*</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
<servlet-name>content-item-xsl</servlet-name>
<url-pattern>/templates/servlet/content-item/*</url-pattern>
</servlet-mapping>
Modified: trunk/ccm-bundle/bundles/devel/cfg/web-sci.xml
===================================================================
--- trunk/ccm-bundle/bundles/devel/cfg/web-sci.xml 2012-03-11 09:12:45 UTC (rev 2285)
+++ trunk/ccm-bundle/bundles/devel/cfg/web-sci.xml 2012-03-11 09:14:14 UTC (rev 2286)
@@ -32,7 +32,7 @@
<filter>
<filter-name>shortcuts</filter-name>
- <filter-class>com.arsdigita.london.shortcuts.ShortcutFilter</filter-class>
+ <filter-class>com.arsdigita.shortcuts.ShortcutFilter</filter-class>
</filter>
<filter>
@@ -52,6 +52,7 @@
</filter-mapping>
-->
+
<filter-mapping>
<filter-name>subsite</filter-name>
<url-pattern>/*</url-pattern>
@@ -158,11 +159,21 @@
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<servlet>
+ <servlet-name>content-center</servlet-name>
+ <servlet-class>com.arsdigita.cms.WorkspaceServlet</servlet-class>
+ </servlet>
+
+ <servlet>
<servlet-name>content-section</servlet-name>
<servlet-class>com.arsdigita.cms.ContentSectionServlet</servlet-class>
</servlet>
<servlet>
+ <servlet-name>cms-service</servlet-name>
+ <servlet-class>com.arsdigita.cms.ServiceServlet</servlet-class>
+ </servlet>
+
+ <servlet>
<servlet-name>content-type-xsl</servlet-name>
<servlet-class>com.arsdigita.cms.dispatcher.ContentTypeXSLServlet</servlet-class>
</servlet>
@@ -280,13 +291,13 @@
</servlet>
<!-- module ccm-ldn-search - servlet declarations END -->
- <!-- module ccm-ldn-shortcuts - servlet definitions -->
+ <!-- module ccm-shortcuts - servlet definitions -->
<servlet>
<servlet-name>shortcuts-files</servlet-name>
<servlet-class>com.arsdigita.web.ApplicationFileServlet</servlet-class>
<init-param>
<param-name>template-path</param-name>
- <param-value>/templates/ccm-ldn-shortcuts</param-value>
+ <param-value>/templates/ccm-shortcuts</param-value>
</init-param>
</servlet>
@@ -386,10 +397,10 @@
</servlet-mapping>
<!-- module ccm-ldn-search - servlet mappings END -->
- <!-- module ccm-ldn-shortcuts - servlet mappings -->
+ <!-- module ccm-shortcuts - servlet mappings -->
<servlet-mapping>
<servlet-name>shortcuts-files</servlet-name>
- <url-pattern>/ccm-ldn-shortcuts/files/*</url-pattern>
+ <url-pattern>/ccm-shortcuts/files/*</url-pattern>
</servlet-mapping>
<!-- module ccm-subsite - servlet mappings BEGIN -->
@@ -495,11 +506,21 @@
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<servlet-mapping>
+ <servlet-name>content-center</servlet-name>
+ <url-pattern>/templates/servlet/content-center/*</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
<servlet-name>content-section</servlet-name>
- <url-pattern>/themes/servlet/content-section/*</url-pattern>
+ <url-pattern>/templates/servlet/content-section/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
+ <servlet-name>cms-service</servlet-name>
+ <url-pattern>/templates/servlet/cms-service/*</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
<servlet-name>content-item-xsl</servlet-name>
<url-pattern>/templates/servlet/content-item/*</url-pattern>
</servlet-mapping>
Added: trunk/ccm-bundle/web/themes/static/aplaws-generic/content-section-admin.xsl
===================================================================
--- trunk/ccm-bundle/web/themes/static/aplaws-generic/content-section-admin.xsl (rev 0)
+++ trunk/ccm-bundle/web/themes/static/aplaws-generic/content-section-admin.xsl 2012-03-11 09:14:14 UTC (rev 2286)
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:bebop="http://www.arsdigita.com/bebop/1.0"
+ xmlns:cms="http://www.arsdigita.com/cms/1.0"
+ xmlns:ui="http://www.arsdigita.com/ui/1.0"
+ xmlns:aplaws="http://www.arsdigita.com/aplaws/1.0"
+ exclude-result-prefixes="bebop cms ui aplaws xsl"
+ version="1.0">
+
+ <xsl:import href="../../heirloom/apps/content-section/xsl/content-admin.xsl"/>
+ <xsl:import href="../../heirloom/packages/bebop/xsl/dcp.xsl"/>
+
+ <xsl:import href="category-step.xsl"/>
+
+ <xsl:param name="theme-prefix" />
+ <xsl:param name="internal-theme" />
+
+ <xsl:variable name="here"><xsl:value-of select="$internal-theme"/>/packages/cms/xml/admin/page</xsl:variable>
+
+ <xsl:template name="cat-widget-cat-name">
+ <xsl:value-of select="@name"/>
+
+ <xsl:if test="@pid and @domain='LGSL'">
+ (<xsl:value-of select="@pid"/>)
+ </xsl:if>
+ </xsl:template>
+
+
+ <xsl:template match="bebop:page[@class = 'cms-admin']">
+ <html xmlns:deditor="http://www.arsdigita.com/deditor/1.0">
+ <head>
+ <title><xsl:value-of select="bebop:title"/></title>
+ <link rel="stylesheet" type="text/css" href="{$internal-theme}/css/acs-master.css"/>
+ <link rel="stylesheet" type="text/css" href="{$internal-theme}/packages/cms/xsl/admin/cms-admin.css"/>
+ </head>
+ <body>
+ <xsl:call-template name="bebop:dcpJavascript"/>
+ <table id="global-header">
+ <tr>
+ <td id="logo"><img src="{$theme-prefix}/images/aplaws-logo-small.png" height="30" width="30"/></td>
+ <td id="context"><xsl:apply-templates select="bebop:contextBar"/></td>
+ <td style="margin: 0; color: #3f3f3f; border: 0; padding: 0; padding-right: 18px;">Welcome <strong><xsl:value-of select="@name" /></strong></td>
+ <td>
+ <table id="global-links">
+ <tr>
+ <td class="global-link-icon"><a href="{cms:globalNavigation/cms:workspace/@href}"><img src="{$internal-theme}/images/home.png" height="18" width="18"/></a></td>
+ <td class="global-link"><a href="{cms:globalNavigation/cms:workspace/@href}">Home</a></td>
+
+ <td class="global-link-icon"><a href="{cms:globalNavigation/cms:signOut/@href}"><img src="{$internal-theme}/images/lock.png" height="18" width="14"/></a></td>
+ <td class="global-link"><a href="{cms:globalNavigation/cms:signOut/@href}">Logout</a></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ <div id="page-title"><xsl:value-of select="bebop:title"/></div>
+ <xsl:if test="bebop:link[@id = 'preview_link']">
+ <xsl:choose>
+ <xsl:when test="bebop:link[@target]">
+ <div style="float: right; margin-right: 12px"><a target="{bebop:link/@target}" href="{bebop:link[@id = 'preview_link']/@href}"><xsl:value-of select="bebop:link[@id = 'preview_link']/bebop:label"/></a></div>
+ </xsl:when>
+ <xsl:otherwise>
+ <div style="float: right; margin-right: 12px"><a href="{bebop:link[@id = 'preview_link']/@href}"><xsl:value-of select="bebop:link[@id = 'preview_link']/bebop:label"/></a></div>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <div><xsl:apply-templates select="*[@id = 'page-body']"/></div>
+ <xsl:choose>
+ <xsl:when test="bebop:structure">
+ <div><xsl:apply-templates select="bebop:structure"/></div>
+ </xsl:when>
+ <xsl:when test="ui:debugPanel">
+ <div><xsl:apply-templates select="ui:debugPanel"/></div>
+ </xsl:when>
+ </xsl:choose>
+ </body>
+ </html>
+ </xsl:template>
+
+</xsl:stylesheet>
Deleted: trunk/ccm-bundle/web/themes/static/aplaws-generic/content-section-content-admin.xsl
===================================================================
--- trunk/ccm-bundle/web/themes/static/aplaws-generic/content-section-content-admin.xsl 2012-03-11 09:12:45 UTC (rev 2285)
+++ trunk/ccm-bundle/web/themes/static/aplaws-generic/content-section-content-admin.xsl 2012-03-11 09:14:14 UTC (rev 2286)
@@ -1,80 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:bebop="http://www.arsdigita.com/bebop/1.0"
- xmlns:cms="http://www.arsdigita.com/cms/1.0"
- xmlns:ui="http://www.arsdigita.com/ui/1.0"
- xmlns:aplaws="http://www.arsdigita.com/aplaws/1.0"
- exclude-result-prefixes="bebop cms ui aplaws xsl"
- version="1.0">
-
- <xsl:import href="../../heirloom/apps/content-section/xsl/content-admin.xsl"/>
- <xsl:import href="../../heirloom/packages/bebop/xsl/dcp.xsl"/>
-
- <xsl:import href="category-step.xsl"/>
-
- <xsl:param name="theme-prefix" />
- <xsl:param name="internal-theme" />
-
- <xsl:variable name="here"><xsl:value-of select="$internal-theme"/>/packages/cms/xml/admin/page</xsl:variable>
-
- <xsl:template name="cat-widget-cat-name">
- <xsl:value-of select="@name"/>
-
- <xsl:if test="@pid and @domain='LGSL'">
- (<xsl:value-of select="@pid"/>)
- </xsl:if>
- </xsl:template>
-
-
- <xsl:template match="bebop:page[@class = 'cms-admin']">
- <html xmlns:deditor="http://www.arsdigita.com/deditor/1.0">
- <head>
- <title><xsl:value-of select="bebop:title"/></title>
- <link rel="stylesheet" type="text/css" href="{$internal-theme}/css/acs-master.css"/>
- <link rel="stylesheet" type="text/css" href="{$internal-theme}/packages/cms/xsl/admin/cms-admin.css"/>
- </head>
- <body>
- <xsl:call-template name="bebop:dcpJavascript"/>
- <table id="global-header">
- <tr>
- <td id="logo"><img src="{$theme-prefix}/images/aplaws-logo-small.png" height="30" width="30"/></td>
- <td id="context"><xsl:apply-templates select="bebop:contextBar"/></td>
- <td style="margin: 0; color: #3f3f3f; border: 0; padding: 0; padding-right: 18px;">Welcome <strong><xsl:value-of select="@name" /></strong></td>
- <td>
- <table id="global-links">
- <tr>
- <td class="global-link-icon"><a href="{cms:globalNavigation/cms:workspace/@href}"><img src="{$internal-theme}/images/home.png" height="18" width="18"/></a></td>
- <td class="global-link"><a href="{cms:globalNavigation/cms:workspace/@href}">Home</a></td>
-
- <td class="global-link-icon"><a href="{cms:globalNavigation/cms:signOut/@href}"><img src="{$internal-theme}/images/lock.png" height="18" width="14"/></a></td>
- <td class="global-link"><a href="{cms:globalNavigation/cms:signOut/@href}">Logout</a></td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- <div id="page-title"><xsl:value-of select="bebop:title"/></div>
- <xsl:if test="bebop:link[@id = 'preview_link']">
- <xsl:choose>
- <xsl:when test="bebop:link[@target]">
- <div style="float: right; margin-right: 12px"><a target="{bebop:link/@target}" href="{bebop:link[@id = 'preview_link']/@href}"><xsl:value-of select="bebop:link[@id = 'preview_link']/bebop:label"/></a></div>
- </xsl:when>
- <xsl:otherwise>
- <div style="float: right; margin-right: 12px"><a href="{bebop:link[@id = 'preview_link']/@href}"><xsl:value-of select="bebop:link[@id = 'preview_link']/bebop:label"/></a></div>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:if>
- <div><xsl:apply-templates select="*[@id = 'page-body']"/></div>
- <xsl:choose>
- <xsl:when test="bebop:structure">
- <div><xsl:apply-templates select="bebop:structure"/></div>
- </xsl:when>
- <xsl:when test="ui:debugPanel">
- <div><xsl:apply-templates select="ui:debugPanel"/></div>
- </xsl:when>
- </xsl:choose>
- </body>
- </html>
- </xsl:template>
-
-</xsl:stylesheet>
Modified: trunk/ccm-cms/src/com/arsdigita/cms/CMS.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/CMS.java 2012-03-11 09:12:45 UTC (rev 2285)
+++ trunk/ccm-cms/src/com/arsdigita/cms/CMS.java 2012-03-11 09:14:14 UTC (rev 2286)
@@ -18,6 +18,7 @@
*/
package com.arsdigita.cms;
+import com.arsdigita.bebop.PageState;
import org.apache.log4j.Logger;
/**
@@ -87,4 +88,16 @@
static final void setContext(CMSContext context) {
s_context.set(context);
}
+
+ /**
+ * Fetch the security manager.
+ *
+ * @param state The page state
+ * @return The SecurityManager for the content section
+ */
+ public static SecurityManager getSecurityManager(PageState state) {
+ ContentSection section = CMS.getContext().getContentSection();
+ return new SecurityManager(section);
+ }
+
}
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ContentSection.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ContentSection.java 2012-03-11 09:12:45 UTC (rev 2285)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ContentSection.java 2012-03-11 09:14:14 UTC (rev 2286)
@@ -33,7 +33,6 @@
import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.globalization.Locale;
import com.arsdigita.kernel.Group;
-import com.arsdigita.kernel.SiteNode;
import com.arsdigita.kernel.permissions.PermissionService;
import com.arsdigita.persistence.CompoundFilter;
import com.arsdigita.persistence.DataAssociation;
@@ -51,12 +50,13 @@
import com.arsdigita.web.Web;
import com.arsdigita.workflow.simple.TaskCollection;
import com.arsdigita.workflow.simple.WorkflowTemplate;
-import org.apache.log4j.Logger;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.StringTokenizer;
+
import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
/**
* <p>A content section represents a collection of content that is
@@ -919,68 +919,30 @@
//
// Finding a content section.
//
+
/**
* Looks up the section given the SiteNode.
*
- * @param node The site node
+ * @param path
* @return The content section
- * @pre ( node != null )
+ * @pre ( path != null )
* @post ( return != null )
*/
- public static ContentSection getSectionFromNode(SiteNode node)
+ public static ContentSection getSectionForPath(String path)
throws DataObjectNotFoundException {
- return (ContentSection) retrieveApplicationForSiteNode(node);
-
-// BigDecimal sectionId = null;
-//
-// PackageInstance pkg = node.getPackageInstance();
-// if ( pkg == null ) {
-// throw new DataObjectNotFoundException(
-// "No package instance for node_id=" + node.getID().toString());
-// }
-//
-// return getSectionFromPackage(pkg);
+ return (ContentSection) retrieveApplicationForPath(path);
}
-// /**
-// * Looks up the section given the PackageInstance.
-// *
-// * @param pkg The package instance
-// * @return The content section ID
-// * @pre ( pkg != null )
-// * @post ( return != null )
-// */
-// public static ContentSection getSectionFromPackage(PackageInstance pkg)
-// throws DataObjectNotFoundException {
-//
-// ContentSection section = null;
-//
-// final String query = "com.arsdigita.cms.getSectionFromPackage";
-// DataQuery dq = SessionManager.getSession().retrieveQuery(query);
-// dq.setParameter("packageId", pkg.getID());
-// if ( dq.next() ) {
-// DataObject dobj = (DataObject) dq.get("section");
-// if ( dobj != null ) {
-// section = (ContentSection) DomainObjectFactory.newInstance(dobj);
-// }
-// dq.close();
-// } else {
-// throw new DataObjectNotFoundException(
-// "Failed to fetch a content section for the current package " +
-// "instance. [package_id =" + pkg.getID().toString() + "]");
-// }
-// return section;
-// }
/**
* Get the content section for an item.
*
- * @deprecated use {@link ContentItem#getContentSection} instead
- *
* @pre item != null
* @post return != null
* @param item A content item
* @return The content section of an item
+ *
+ * @deprecated use {@link ContentItem#getContentSection} instead
*/
public static ContentSection getContentSection(ContentItem item)
throws DataObjectNotFoundException {
@@ -991,11 +953,11 @@
/**
* Get the content section for a folder.
*
- * @deprecated use {@link ContentItem#getContentSection} instead
* @pre item != null
* @post return != null
* @param folder A content folder
* @return The content section of the folder
+ * @deprecated use {@link ContentItem#getContentSection} instead
*/
public static ContentSection getContentSection(Folder folder)
throws DataObjectNotFoundException {
Modified: trunk/ccm-cms/src/com/arsdigita/cms/Loader.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/Loader.java 2012-03-11 09:12:45 UTC (rev 2285)
+++ trunk/ccm-cms/src/com/arsdigita/cms/Loader.java 2012-03-11 09:14:14 UTC (rev 2286)
@@ -55,8 +55,8 @@
// Next Try
// Refactor using legacy compatible web/Application and ApplicationSetup *DONE*
// Refactor content-section als legacy free application *DONE*
-// Refactor workspace (content-center) as a legacy free application
-// Refactor cms-service as a legacy free application
+// Refactor workspace (content-center) as a legacy free application *DONE*
+// Refactor cms-service as a legacy free application *DONE*
/**
* <p>Executes nonrecurring at install time and loads (installs and initializes)
@@ -130,6 +130,9 @@
s_log.debug("CMS.loader (Constructor) completed");
}
+ /**
+ *
+ */
public void run(final ScriptContext ctx) {
s_log.debug("CMS.loader.run() invoked");
@@ -138,38 +141,22 @@
public void excurse() {
setEffectiveParty(Kernel.getSystemParty());
- // 2 - step 1b) Setup the Workspace package.
- // loadWorkspacePackage(); // using old stype
- // new style:
+ // Step 1) Setup the CMS Workspace
ApplicationType appType = loadWorkspaceApplicationType();
setupDefaultWorkspaceApplicationInstance(appType);
- // 3 - step 1c) Setup the CMS global services package.
- // loadServicePackage(); // using olde style
- // new style:
+ // Step 2) Setup the CMS global services
appType = loadServiceApplicationType();
setupDefaultServiceApplicationInstance(appType);
- // 4 - step 1d) Load the content-center page mappings
- // Wrong! Is Initializer task, must be done each startup, in
- // any way not a Loader task. It is here for reference
- // purpose during migration of the whole CMS to new style.
- // loadContentCenterMapping(s_conf.getContentCenterMap() );
-
- // 5) load (cms internal) content type definition(s)
- // Used to be step 2 in former enterprise.init file
+ // Step 3) load (cms internal) content type definition(s)
loadContentTypeDefinitions(s_conf.getCTDefFiles());
- // 6) Load CMS (content section) package application instance
- // Used to be step 4 in former enterprise.init file
- // (step 3 being initialize publishToFile, not to handle in Loader)
- // Implemented by
- // com.arsdigita.cms.installer.SectionInitializer
+ // Step 4) Load CMS content section
// Loads content section application type and instance in one step
loadContentSection( (String[]) get(m_contentSectionNames) );
- // Loading CMS portlets
- // Used to be step 7 (last step) in former enterprise.init
+ // Step 5) Loading CMS portlets
s_log.debug("CMS.loader going to load portlets");
ContentDirectoryPortlet.loadPortletType();
ContentItemPortlet.loadPortletType();
@@ -197,13 +184,25 @@
public static ApplicationType loadWorkspaceApplicationType() {
s_log.debug("Creating CMS Workspace...");
- /* Create new stype legacy compatible application type */
- ApplicationType type = ApplicationType
- .createApplicationType(Workspace.PACKAGE_KEY,
- Workspace.INSTANCE_NAME,
- Workspace.BASE_DATA_OBJECT_TYPE);
+ /* Create new type legacy compatible application type */
+ // ApplicationType type = ApplicationType
+ // .createApplicationType(Workspace.PACKAGE_KEY,
+ // Workspace.INSTANCE_NAME,
+ // Workspace.BASE_DATA_OBJECT_TYPE);
+ // type.setDispatcherClass(Workspace.DISPATCHER_CLASS);
+
+ /* Create new type legacy free application type
+ * NOTE: The wording in the title parameter of ApplicationType
+ * determines the name of the subdirectory for the XSL stylesheets.
+ * It gets "urlized", i.e. trimming leading and trailing blanks and
+ * replacing blanks between words and illegal characters with an
+ * hyphen and converted to lower case.
+ * "Content Center" will become "content-center". */
+ ApplicationType type = new
+ ApplicationType(Workspace.INSTANCE_NAME,
+ Workspace.BASE_DATA_OBJECT_TYPE );
+
type.setDescription("The content center workspace for content creators.");
- type.setDispatcherClass(Workspace.DISPATCHER_CLASS);
type.save();
s_log.debug("CMS Workspace type created.");
@@ -263,7 +262,7 @@
// there is only one
// appsetup.setDescription("Services to store global resources and assets.");
// old style / legacy compatible properties
-// appsetup.setKey(Service.PACKAGE_KEY);
+// appsetup.setKey(Service.PRIMARY_URL_STUB);
// appsetup.setDispatcherClass(Service.DISPATCHER_CLASS);
// appsetup.setSingleton(true);
// appsetup.setPortalApplication(false);
@@ -277,16 +276,27 @@
// ApplicationType serviceType = appsetup.run();
// serviceType.save();
// ////////////// Current style to create app type ///////////////
- /* Create new stype legacy compatible application type */
- ApplicationType serviceType = ApplicationType
- .createApplicationType(Service.PACKAGE_KEY,
- Service.INSTANCE_NAME,
- Service.BASE_DATA_OBJECT_TYPE);
- serviceType.setDescription("Services to store global resources and assets.");
- serviceType.setDispatcherClass(Service.DISPATCHER_CLASS);
- serviceType.save();
+ /* Create new type legacy compatible application type */
+ // ApplicationType type = ApplicationType
+ // .createApplicationType(Service.PRIMARY_URL_STUB,
+ // Service.INSTANCE_NAME,
+ // Service.BASE_DATA_OBJECT_TYPE);
+ // type.setDispatcherClass(Service.DISPATCHER_CLASS);
- return serviceType;
+ /* Create new type legacy free application type
+ * NOTE: The wording in the title parameter of ApplicationType
+ * determines the name of the subdirectory for the XSL stylesheets.
+ * It gets "urlized", i.e. trimming leading and trailing blanks and
+ * replacing blanks between words and illegal characters with an
+ * hyphen and converted to lower case.
+ * "CMS Service" will become "cms-service". */
+ ApplicationType type = new ApplicationType("CMS Service",
+ Service.BASE_DATA_OBJECT_TYPE );
+
+ type.setDescription("Services to store global resources and assets.");
+ type.save();
+
+ return type;
}
@@ -299,10 +309,10 @@
// create legacy compatible application instance,
// old-style package key used as url fragment where to install the instance
Service app = (Service) Application.createApplication(
- serviceType, // type
- Service.PACKAGE_KEY, // url fragment
- Service.INSTANCE_NAME,// title
- null); // parent
+ serviceType, // type
+ Service.PRIMARY_URL_STUB, // url fragment
+ "CMS Service Instance", // title
+ null); // parent
app.setDescription("The default CMS service instance.");
app.save();
Modified: trunk/ccm-cms/src/com/arsdigita/cms/Service.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/Service.java 2012-03-11 09:12:45 UTC (rev 2285)
+++ trunk/ccm-cms/src/com/arsdigita/cms/Service.java 2012-03-11 09:14:14 UTC (rev 2286)
@@ -18,13 +18,14 @@
*/
package com.arsdigita.cms;
+import com.arsdigita.cms.dispatcher.StreamAsset;
+import com.arsdigita.cms.dispatcher.StreamImage;
import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.persistence.DataObject;
import com.arsdigita.persistence.OID;
-// import com.arsdigita.persistence.DataAssociation;
-// import com.arsdigita.persistence.PersistenceException;
import com.arsdigita.web.Application;
+import com.arsdigita.web.URL;
import java.math.BigDecimal;
import org.apache.log4j.Logger;
@@ -51,10 +52,9 @@
"com.arsdigita.cms.Service";
// general constants
- public static final String PACKAGE_KEY = "cms-service";
- public static final String INSTANCE_NAME = "CMS Service";
- public static final String DISPATCHER_CLASS =
- "com.arsdigita.cms.dispatcher.ServiceDispatcher";
+ public static final String PRIMARY_URL_STUB = "cms-service";
+ // public static final String DISPATCHER_CLASS =
+ // "com.arsdigita.cms.dispatcher.ServiceDispatcher";
// Service has no direct user interface, therefore no styesheet
// public final static String STYLESHEET =
// "/packages/content-section/xsl/content-center.xsl";
@@ -97,12 +97,66 @@
return BASE_DATA_OBJECT_TYPE;
}
+
+ public static String getURL() {
+ return "/" + PRIMARY_URL_STUB + "/";
+ }
+
+
/**
+ * Constuct a URL which serves a binary asset.
+ *
+ * @param asset The binary asset
+ * @return the URL which will serve the specified binary asset
+ */
+ public static String getAssetURL(BinaryAsset asset) {
+ return getAssetURL(asset.getID());
+ }
+
+ /**
+ * Constuct a URL which serves a binary asset.
+ *
+ * @param assetId The asset ID
+ * @return the URL which will serve the specified binary asset
+ */
+ public static String getAssetURL(BigDecimal assetId) {
+ StringBuilder buf = new StringBuilder(Service.getURL() );
+ buf.append("stream/asset?");
+ buf.append(StreamAsset.ASSET_ID).append("=").append(assetId);
+ return buf.toString();
+ }
+
+
+
+ /**
+ * Constuct a URL which serves an image.
+ *
+ * @param asset The image asset whose image is to be served
+ * @return the URL which will serve the specified image asset
+ */
+ public static String getImageURL(ImageAsset asset) {
+ StringBuilder buf = new StringBuilder(Service.getURL() );
+ buf.append("stream/image/?");
+ buf.append(StreamImage.IMAGE_ID).append("=").append(asset.getID());
+ return buf.toString();
+ }
+
+ /**
+ * The URL to log out.
+ * @return The logout URL
+ */
+ public static String getLogoutURL() {
+ StringBuilder buf = new StringBuilder(Service.getURL() );
+ buf.append("logout");
+ return buf.toString();
+ }
+
+ /**
* This is called when the application is created.
*/
public static Service create(String urlName,
- String title,
- Application parent) {
+ String title,
+ Application parent) {
Service app = (Service) Application.createApplication
(BASE_DATA_OBJECT_TYPE, urlName, title, parent);
@@ -112,5 +166,10 @@
return app;
}
+ @Override
+ public String getServletPath() {
+ return URL.SERVLET_DIR + "/cms-service";
+ }
+
}
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ServiceServlet.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ServiceServlet.java 2012-03-11 09:12:45 UTC (rev 2285)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ServiceServlet.java 2012-03-11 09:14:14 UTC (rev 2286)
@@ -51,6 +51,15 @@
* URLs of the available services are stored in a XML file which is processed
* into a cache of services on a request by request basis (lazy loading).
*
+ * ServiceServlet is called by BaseApplicationServlet which has determined that
+ * ServiceServlet is associated with a request URL.
+ *
+ * The CMS Service determines whether a <tt>Page</tt> has been registered to
+ * the URL and if so passes the request to that page.
+ *
+ * If no <tt>Page</tt> is registered to the URL, then the CMS Service hands
+ * the request to the TemplateResolver to find an appropriate JSP file.
+ *
* @author Peter Boy <pb...@ba...>
* @version $Id: ServiceServlet.java 2161 2011-02-02 00:16:13Z pboy $
*/
@@ -68,9 +77,7 @@
/** Mapping between a relative URL and the class name of a ResourceHandler.*/
private static HashMap s_pageClasses = new HashMap();
- /**
- * Instantiated ResourceHandler cache. This allows for lazy loading.
- */
+ /** Instantiated ResourceHandler cache. This allows for lazy loading. */
private static SimpleCache s_pages = new SimpleCache();
/** List of URLs which require a trailing slash. These are required for
@@ -80,6 +87,7 @@
/** Path to directory containg ccm-cms template files */
private String m_templatePath;
+
/** Resolvers to find templages (JSP) and other stuff stored in file system.*/
private ApplicationFileResolver m_resolver;
@@ -101,20 +109,21 @@
/* Process mapping file. */
readFromFile(MAP_FILE);
+ /** Set Template base path for JSP's */
m_templatePath = ContentSection.getConfig().getTemplateRoot();
Assert.exists(m_templatePath, String.class);
Assert.isTrue(m_templatePath.startsWith("/"),
"template-path must start with '/'");
Assert.isTrue(!m_templatePath.endsWith("/"),
"template-path must not end with '/'");
+ /** Set TemplateResolver class */
m_resolver = Web.getConfig().getApplicationFileResolver();
}
/**
* Implements the (abstract) doService method of BaseApplicationServlet to
- * create the perform the services.
- *
+ * perform the services.
* @see com.arsdigita.web.BaseApplicationServlet#doService
* (HttpServletRequest, HttpServletResponse, Application)
*/
@@ -143,7 +152,7 @@
// Check user access.
// Deprecated and here implemented as a No-OP method!
- /* heckUserAccess(request, response, actx); */
+ /* checkUserAccess(request, response, actx); */
ResourceHandler page = getResource(url);
if ( page != null ) {
@@ -152,15 +161,10 @@
page.dispatch(sreq, sresp, ctx);
} else {
// Fall back on the JSP application dispatcher.
- // m_notFoundHandler.dispatch(request, response, actx);
if (s_log.isInfoEnabled()) {
- s_log.info("NOT serving content item");
+ s_log.info("NO page registered to serve the requst url.");
}
- /* Store content section in http request to make it available
- * or admin index,jsp */
- // sreq.setAttribute(CONTENT_SECTION, section);
-
RequestDispatcher rd = m_resolver.resolve(m_templatePath,
sreq, sresp, app);
if (rd != null) {
@@ -170,7 +174,6 @@
sreq = DispatcherHelper.restoreOriginalRequest(sreq);
rd.forward(sreq,sresp);
} else {
- // sresp.sendError(404, packageURL + " not found on this server.");
sresp.sendError(404, requestUri + " not found on this server.");
}
Modified: trunk/ccm-cms/src/com/arsdigita/cms/Workspace.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/Workspace.java 2012-03-11 09:12:45 UTC (rev 2285)
+++ trunk/ccm-cms/src/com/arsdigita/cms/Workspace.java 2012-03-11 09:14:14 UTC (rev 2286)
@@ -21,15 +21,15 @@
import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.persistence.DataObject;
import com.arsdigita.persistence.OID;
-// import com.arsdigita.persistence.DataAssociation;
-// import com.arsdigita.persistence.PersistenceException;
import com.arsdigita.web.Application;
+import com.arsdigita.web.ApplicationCollection;
+import com.arsdigita.web.ApplicationType;
+import com.arsdigita.web.URL;
import java.math.BigDecimal;
import org.apache.log4j.Logger;
-// WORK IN PROGRESS !!
/**
* Application domain class for the CMS module user entry page (content-center)
@@ -48,10 +48,8 @@
// general constants
public static final String PACKAGE_KEY = "content-center";
public static final String INSTANCE_NAME = "Content Center";
- public static final String DISPATCHER_CLASS =
- "com.arsdigita.cms.dispatcher.ContentCenterDispatcher";
- public final static String STYLESHEET =
- "/packages/content-section/xsl/content-center.xsl";
+// public static final String DISPATCHER_CLASS =
+// "com.arsdigita.cms.dispatcher.ContentCenterDispatcher";
/**
* Constructor retrieving a workspace from the database usings its OID.
@@ -107,4 +105,74 @@
return app;
}
+ /**
+ * Returns an instance of the Workspace application. There must not more
+ * than one instance exist. May return null.
+ */
+ public static Application getInstance() {
+ ApplicationType workspaceType = ApplicationType.
+ retrieveApplicationTypeForApplication(BASE_DATA_OBJECT_TYPE);
+ if ( workspaceType == null ) { return null; }
+
+ ApplicationCollection apps = Application.retrieveAllApplications();
+ apps.addEqualsFilter("resourceType.id", workspaceType.getID());
+ if ( !apps.next() ) { return null; }
+
+ Application result = apps.getApplication();
+ apps.close();
+ return result;
+ }
+
+ /**
+ * Fetch the location (URL) of the CMS Workspace. There must not more than
+ * one instance exist.
+ *
+ * @return The URL of the CMS Workspace (currently including trailing slash)
+ */
+ public static String getURL() {
+
+ Application app = Workspace.getInstance();
+ if (app == null) {
+ return null;
+ } else {
+ String url = (String) app.getPrimaryURL();
+ return url;
+ }
+ }
+
+ /**
+ * Returns the path name of the location of the applications servlet/JSP.
+ *
+ * Application implementations should overwrite this method to provide an
+ * application specific location, especially if an application (module) is
+ * to be installed along with others in one context.
+ *
+ * If you install the module into its own context you may use a standard
+ * location. In most cases though all modules (applications) of an
+ * webapplication should be installed into one context.
+ *
+ * Frequently it is a symbolic name/path, which will be mapped in the web.xml
+ * to the real location in the file system. Example:
+ * <servlet>
+ * <servlet-name>content-center</servlet-name>
+ * <servlet-class>com.arsdigita.cms.WorkspaceServlet</servlet-class>
+ * </servlet>
+ *
+ * <servlet-mapping>
+ * <servlet-name>content-center</servlet-name>
+ * <url-pattern>/ccm-applicationName/content-center/*</url-pattern>
+ * </servlet-mapping>
+ *
+ * NOTE: According to Servlet API the path always starts with a leading '/'
+ * and includes either the servlet name or a path to the servlet, but does
+ * not include any extra path information or a query string. Returns an
+ * empry string ("") is the servlet used was matched using the "/*" pattern.
+ *
+ * @return path name to the applications servlet/JSP
+ */
+ @Override
+ public String getServletPath() {
+ return URL.SERVLET_DIR + "/content-center";
+ }
+
}
Modified: trunk/ccm-cms/src/com/arsdigita/cms/WorkspaceServlet.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/WorkspaceServlet.java 2012-03-11 09:12:45 UTC (rev 2285)
+++ trunk/ccm-cms/src/com/arsdigita/cms/WorkspaceServlet.java 2012-03-11 09:14:14 UTC (rev 2286)
@@ -19,12 +19,17 @@
package com.arsdigita.cms;
+import com.arsdigita.cms.dispatcher.ResourceHandler;
import com.arsdigita.cms.dispatcher.SimpleCache;
import com.arsdigita.developersupport.DeveloperSupport;
+import com.arsdigita.dispatcher.DispatcherHelper;
+import com.arsdigita.dispatcher.RequestContext;
import com.arsdigita.kernel.security.UserContext;
import com.arsdigita.kernel.security.Util;
import com.arsdigita.ui.login.LoginHelper;
+import com.arsdigita.util.Assert;
import com.arsdigita.web.Application;
+import com.arsdigita.web.ApplicationFileResolver;
import com.arsdigita.web.BaseApplicationServlet;
import com.arsdigita.web.LoginSignal;
@@ -33,6 +38,8 @@
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.Iterator;
+import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
@@ -55,7 +62,7 @@
/** The path of the file that maps resources. */
public final static String DEFAULT_MAP_FILE =
- "/WEB-INF/resources/content-center-map.xml";
+ "/WEB-INF/resources/content-center-old-map.xml";
/** Mapping between a relative URL and the class name of a ResourceHandler.*/
private static HashMap s_pageClasses = WorkspaceSetup.getURLToClassMap();
@@ -69,11 +76,40 @@
// private Dispatcher m_notFoundHandler;
private ArrayList m_trailingSlashList = new ArrayList();
+ /** Path to directory containg ccm-cms template files */
+ private String m_templatePath;
+ /** Resolvers to find templages (JSP) and other stuff stored in file system.*/
+ private ApplicationFileResolver m_resolver;
+
/**
+ * Use parent's class initialization extension point to perform additional
+ * initialisation tasks.
+ */
+ @Override
+ protected void doInit() {
+ if (s_log.isDebugEnabled()) {
+ s_log.info("starting doInit method");
+ }
+ m_trailingSlashList = new ArrayList();
+ requireTrailingSlash("");
+
+ /** Set Template base path for JSP's */
+ m_templatePath = ContentSection.getConfig().getTemplateRoot();
+ Assert.exists(m_templatePath, String.class);
+ Assert.isTrue(m_templatePath.startsWith("/"),
+ "template-path must start with '/'");
+ Assert.isTrue(!m_templatePath.endsWith("/"),
+ "template-path must not end with '/'");
+ /** Set TemplateResolver class */
+ m_resolver = Web.getConfig().getApplicationFileResolver();
+ }
+
+
+ /**
* Implements the (abstract) doService method of BaseApplicationServlet to
- * create the Worspace page.
+ * create the Workspace page.
*
* @see com.arsdigita.web.BaseApplicationServlet#doService
* (HttpServletRequest, HttpServletResponse, Application)
@@ -88,9 +124,48 @@
}
DeveloperSupport.startStage("ContentCenterServlet.doService");
+ Workspace workspace = (Workspace) app;
+
+ RequestContext ctx = DispatcherHelper.getRequestContext();
+ String url = ctx.getRemainingURLPart(); // here SiteNodeRequestContext
+ String originalUrl = ctx.getOriginalURL();
+ String requestUri = sreq.getRequestURI();
+
+ // An empty remaining URL or a URL which doesn't end in trailing slash:
+ // probably want to redirect.
+ if ( m_trailingSlashList.contains(url) && !originalUrl.endsWith("/") ) {
+ DispatcherHelper.sendRedirect(sresp, originalUrl + "/");
+ return;
+ }
+
// Check user access.
checkUserAccess(sreq, sresp);
+ ResourceHandler page = getResource(url);
+ if ( page != null ) {
+ // Serve the page.
+ page.init();
+ page.dispatch(sreq, sresp, ctx);
+ } else {
+ // Fall back on the JSP application dispatcher.
+ if (s_log.isInfoEnabled()) {
+ s_log.info("NO page registered to serve the requst url.");
+ }
+
+ RequestDispatcher rd = m_resolver.resolve(m_templatePath,
+ sreq, sresp, app);
+ if (rd != null) {
+ if (s_log.isDebugEnabled()) {
+ s_log.debug("Got dispatcher " + rd);
+ }
+ sreq = DispatcherHelper.restoreOriginalRequest(sreq);
+ rd.forward(sreq,sresp);
+ } else {
+ sresp.sendError(404, requestUri + " not found on this server.");
+ }
+
+ }
+
DeveloperSupport.endStage("ContentCenterServlet.doService");
if (s_log.isDebugEnabled()) {
@@ -98,10 +173,88 @@
}
}
+ /**
+ * Service Method returns the URL stub for the class name,
+ * can return null if not mapped
+ */
+ public static String getURLStubForClass(String classname) {
+ s_log.debug("Getting URL Stub for : " + classname);
+ Iterator itr = s_pageURLs.keySet().iterator();
+ while (itr.hasNext()) {
+ String classname2 = (String)itr.next();
+ s_log.debug("key: " + classname + " value: " +
+ (String)s_pageURLs.get(classname2));
+ }
+ String url = (String)s_pageURLs.get(classname);
+ return url;
+ }
+
+ /**
+ * Fetch a page based on the URL stub.
+ *
+ * @param url The URL stub following the site-node URL
+ * @return A ResourceHandler or null if none exists.
+ * @pre (url != null)
+ */
+ protected ResourceHandler getResource(String url) throws ServletException {
+
+ // First check the pages cache for existing pages.
+ ResourceHandler page = (ResourceHandler) s_pages.get(url);
+ if ( page == null ) {
+
+ // Next check if the URL maps to a page class.
+ String pageClassName = (String) s_pageClasses.get(url);
+ if ( pageClassName != null ) {
+
+ Class pageClass;
+ try {
+ pageClass = Class.forName(pageClassName);
+ } catch (ClassNotFoundException e) {
+ s_log.error("error fetching class for ResourceHandler", e);
+ throw new ServletException(e);
+ }
+
+ // Try and instantiate the page.
+ try {
+ page = (ResourceHandler) pageClass.newInstance();
+ } catch (InstantiationException e) {
+ s_log.error("error instantiating a ResourceHandler", e);
+ throw new ServletException(e);
+ } catch (IllegalAccessException e) {
+ s_log.error("error instantiating a ResourceHandler", e);
+ throw new ServletException(e);
+ }
+
+ page.init();
+ s_pages.put(url, page);
+ }
+ }
+ return page;
+ }
+
+ /**
+ * Map a page to a URL.
+ *
+ * @param url The URL
+ * @param className The name of the ResourceHandler class
+ * @pre (url != null && className != null)
+ */
+ protected void addResource(String url, String className) {
+ s_pageClasses.put(url, className);
+ s_pageURLs.put(className, url);
+ }
+
+ /**
+ * Release the page at the specified URL.
+ *
+ * @param url The URL
+ * @pre (url != null)
+ */
+ public static void releaseResource(String url) {
+ s_pages.remove(url);
+ }
+
-
-
-
/**
* Verify that the user is logged in and is able to view the
* page. Subclasses can override this method if they need to, but
@@ -145,4 +298,17 @@
}
}
+ /**
+ * 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.
+ */
+ // public void requireTrailingSlash(String url) {
+ private void requireTrailingSlash(String url) {
+ m_trailingSlashList.add(url);
+ }
+
}
Modified: trunk/ccm-cms/src/com/arsdigita/cms/dispatcher/CMSDispatcher.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/dispatcher/CMSDispatcher.java 2012-03-11 09:12:45 UTC (rev 2285)
+++ trunk/ccm-cms/src/com/arsdigita/cms/dispatcher/CMSDispatcher.java 2012-03-11 09:14:14 UTC (rev 2286)
@@ -32,7 +32,6 @@
import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.kernel.ACSObjectCache;
import com.arsdigita.kernel.KernelHelper;
-import com.arsdigita.kernel.SiteNode;
import com.arsdigita.kernel.User;
import com.arsdigita.web.LoginSignal;
import com.arsdigita.web.URL;
@@ -451,8 +450,7 @@
}
// Fetch the current site node from the URL.
- SiteNode sn = SiteNode.getSiteNode(url);
- ContentSection section = ContentSection.getSectionFromNode(sn);
+ ContentSection section = ContentSection.getSectionForPath(url);
return section;
}
Modified: trunk/ccm-cms/src/com/arsdigita/cms/dispatcher/CMSPage.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/dispatcher/CMSPage.java 2012-03-11 09:12:45 UTC (rev 2285)
+++ trunk/ccm-cms/src/com/arsdigita/cms/dispatcher/CMSPage.java 2012-03-11 09:14:14 UTC (rev 2286)
@@ -27,6 +27,7 @@
import com.arsdigita.cms.CMSExcursion;
import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ContentSection;
+import com.arsdigita.cms.ContentSectionServlet;
import com.arsdigita.cms.SecurityManager;
import com.arsdigita.developersupport.DeveloperSupport;
import com.arsdigita.dispatcher.RequestContext;
@@ -194,7 +195,8 @@
*/
public ContentSection getContentSection(HttpServletRequest request) {
// Resets all content sections associations.
- return ContentSectionDispatcher.getContentSection(request);
+ // return ContentSectionDispatcher.getContentSection(request);
+ return ContentSectionServlet.getContentSection(request);
}
/**
Deleted: trunk/ccm-cms/src/com/arsdigita/cms/dispatcher/ContentCenterDispatcher.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/dispatcher/ContentCenterDispatcher.java 2012-03-11 09:12:45 UTC (rev 2285)
+++ trunk/ccm-cms/src/com/arsdigita/cms/dispatcher/ContentCenterDispatcher.java 2012-03-11 09:14:14 UTC (rev 2286)
@@ -1,301 +0,0 @@
-/*
- * Copyright (C) 2001-2004 Red Hat Inc. All Rights Reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.dispatcher;
-
-import com.arsdigita.cms.WorkspaceSetup;
-// import com.arsdigita.cms.util.PageClassConfigHandler;
-import com.arsdigita.developersupport.DeveloperSupport;
-import com.arsdigita.dispatcher.Dispatcher;
-import com.arsdigita.dispatcher.DispatcherHelper;
-import com.arsdigita.dispatcher.JSPApplicationDispatcher;
-import com.arsdigita.dispatcher.RequestContext;
-import com.arsdigita.kernel.security.Util;
-import com.arsdigita.kernel.security.UserContext;
-import com.arsdigita.ui.login.LoginHelper;
-import com.arsdigita.util.LockableImpl;
-import com.arsdigita.web.LoginSignal;
-import com.arsdigita.web.Web;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import org.apache.log4j.Logger;
-
-
-/**
- * <p> The CMS Workspace Dispatcher serves all request made within the
- * Content Center application. This dispatcher is called by the Subsite
- * dispatcher.</p>
- *
- * <p>Here are the steps for a request to
- * <tt>http://yourserver/content-center/cheese</tt>:</p>
- *
- * <ol>
- * <li><p>A client sends a request to the web server, which passes it on to
- * the global ACS dispatcher.</p></li>
- *
- * <li><p>The global ACS dispatcher examines the first part of the URL,
- * notices that the Content Center application is mounted at
- * <tt>/content-center</tt> and hands the request to the CMS
- * Workspace dispatcher.</p></li>
- *
- * <li><p>The CMS Workspace dispatcher determines whether a <tt>Page</tt>
- * has been registered to the URL <tt>/cheese</tt>.</p></li>
- *
- * <li><p>If no <tt>Page</tt> is registered to the URL <tt>/cheese</tt>,
- * then the CMS Workspace dispatcher hands the request to the
- * {@link com.arsdigita.dispatcher.JSPApplicationDispatcher}.</p></li>
- * </ol>
- *
- * @author Michael Pih (pi...@ar...)
- * @version $Id$
- */
-public class ContentCenterDispatcher extends LockableImpl
- implements Dispatcher {
-
- /**
- * The path of the file that maps resources.
- */
- public final s...
[truncated message content] |