From 02b4cdb547a8df7a4cbe728812d4dea68aa0ef5c Mon Sep 17 00:00:00 2001 From: pb Date: Sat, 17 Jul 2010 19:11:19 +0000 Subject: [PATCH] =?UTF-8?q?Bug=20in=20Subsite=20behoben.=20In=20web.xml=20?= =?UTF-8?q?stand=20f=C3=BCr=20den=20filter=20der=20falsche=20Eintag=20(ink?= =?UTF-8?q?l.=20ccm=20prefix,=20was=20nicht=20funktioniert).=20Subsitges?= =?UTF-8?q?=20funktionieren=20jetzt=20wieder.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://svn.libreccm.org/ccm/trunk@485 8810af33-2d31-482b-a856-94f89814c4df --- ccm-gen-aplaws/bundles/devel/cfg/web.xml | 3 -- ccm-gen-aplaws/web/WEB-INF/web.xml-aplaws | 3 -- ccm-ldn-aplaws/web/WEB-INF/web.empty.xml | 6 ++- ccm-ldn-aplaws/web/WEB-INF/web.xml-aplaws | 3 -- .../arsdigita/london/subsite/Initializer.java | 6 +-- .../com/arsdigita/london/subsite/Loader.java | 6 +-- .../com/arsdigita/london/subsite/Site.java | 41 +++++++++++++++---- .../london/subsite/SubsiteContext.java | 24 ++++++----- .../london/subsite/SubsiteFilter.java | 20 +++++++++ .../web/WEB-INF/web.ccm-ldn-subsite.xml | 11 +++-- ccm-shp-aplaws/bundles/devel/cfg/web.xml | 3 -- .../bundles/openccm-devel/cfg/web.xml | 3 -- ccm-shp-aplaws/web/WEB-INF/web.xml-aplaws | 3 -- ccm-zes-aplaws/bundles/devel/cfg/web.xml | 3 -- ccm-zes-aplaws/web/WEB-INF/web.xml-aplaws | 3 -- 15 files changed, 79 insertions(+), 59 deletions(-) diff --git a/ccm-gen-aplaws/bundles/devel/cfg/web.xml b/ccm-gen-aplaws/bundles/devel/cfg/web.xml index f2a92540c..2e0b80c57 100755 --- a/ccm-gen-aplaws/bundles/devel/cfg/web.xml +++ b/ccm-gen-aplaws/bundles/devel/cfg/web.xml @@ -55,10 +55,7 @@ subsite - /ccm/* - diff --git a/ccm-gen-aplaws/web/WEB-INF/web.xml-aplaws b/ccm-gen-aplaws/web/WEB-INF/web.xml-aplaws index be52545f1..d56eee455 100755 --- a/ccm-gen-aplaws/web/WEB-INF/web.xml-aplaws +++ b/ccm-gen-aplaws/web/WEB-INF/web.xml-aplaws @@ -58,10 +58,7 @@ subsite - /ccm/* - diff --git a/ccm-ldn-aplaws/web/WEB-INF/web.empty.xml b/ccm-ldn-aplaws/web/WEB-INF/web.empty.xml index 8a67a8770..86a3470b0 100644 --- a/ccm-ldn-aplaws/web/WEB-INF/web.empty.xml +++ b/ccm-ldn-aplaws/web/WEB-INF/web.empty.xml @@ -1,4 +1,6 @@ - + diff --git a/ccm-ldn-aplaws/web/WEB-INF/web.xml-aplaws b/ccm-ldn-aplaws/web/WEB-INF/web.xml-aplaws index 29ff94b80..edf4507fa 100755 --- a/ccm-ldn-aplaws/web/WEB-INF/web.xml-aplaws +++ b/ccm-ldn-aplaws/web/WEB-INF/web.xml-aplaws @@ -27,10 +27,7 @@ subsite - /ccm/* - diff --git a/ccm-ldn-subsite/src/com/arsdigita/london/subsite/Initializer.java b/ccm-ldn-subsite/src/com/arsdigita/london/subsite/Initializer.java index 29a8fd2a2..4ac1d9d4b 100755 --- a/ccm-ldn-subsite/src/com/arsdigita/london/subsite/Initializer.java +++ b/ccm-ldn-subsite/src/com/arsdigita/london/subsite/Initializer.java @@ -45,10 +45,6 @@ import com.arsdigita.xml.XML; * @version $Id: Initializer.java 287 2005-02-22 00:29:02Z sskracic $ */ public class Initializer extends CompoundInitializer { - public final static String versionId = - "$Id: Initializer.java 287 2005-02-22 00:29:02Z sskracic $" + - "$Author: sskracic $" + - "$DateTime: 2004/01/23 10:22:44 $"; public Initializer() { final String url = RuntimeConfig.getConfig().getJDBCURL(); @@ -72,7 +68,7 @@ public class Initializer extends CompoundInitializer { }); } - // TODO - one the core initializers are ported this should be moved + // TODO - once the core initializers are ported this should be moved // to be a DomainEvent instead of a LegacyInitEvent public void init(LegacyInitEvent evt) { super.init(evt); diff --git a/ccm-ldn-subsite/src/com/arsdigita/london/subsite/Loader.java b/ccm-ldn-subsite/src/com/arsdigita/london/subsite/Loader.java index 17e0c72b3..10879b46f 100755 --- a/ccm-ldn-subsite/src/com/arsdigita/london/subsite/Loader.java +++ b/ccm-ldn-subsite/src/com/arsdigita/london/subsite/Loader.java @@ -37,10 +37,6 @@ import org.apache.log4j.Logger; * @version $Id: Loader.java 287 2005-02-22 00:29:02Z sskracic $ */ public class Loader extends PackageLoader { - public final static String versionId = - "$Id: Loader.java 287 2005-02-22 00:29:02Z sskracic $" + - "$Author: sskracic $" + - "$DateTime: 2004/01/23 10:22:44 $"; private static final Logger s_log = Logger.getLogger(Loader.class); @@ -54,7 +50,7 @@ public class Loader extends PackageLoader { } /** - * This creates an initializes the subsite application + * This creates and initializes the subsite application */ private void createApplication() { ApplicationType type = ApplicationType diff --git a/ccm-ldn-subsite/src/com/arsdigita/london/subsite/Site.java b/ccm-ldn-subsite/src/com/arsdigita/london/subsite/Site.java index 4d9fa1280..7730030d9 100755 --- a/ccm-ldn-subsite/src/com/arsdigita/london/subsite/Site.java +++ b/ccm-ldn-subsite/src/com/arsdigita/london/subsite/Site.java @@ -18,19 +18,24 @@ package com.arsdigita.london.subsite; -import com.arsdigita.util.Assert; -import com.arsdigita.kernel.ACSObject; -import com.arsdigita.web.Application; import com.arsdigita.categorization.Category; +import com.arsdigita.cms.TemplateContext; +import com.arsdigita.domain.DataObjectNotFoundException; +import com.arsdigita.domain.DomainObjectFactory; +import com.arsdigita.kernel.ACSObject; import com.arsdigita.persistence.DataObject; import com.arsdigita.persistence.DataCollection; import com.arsdigita.persistence.OID; import com.arsdigita.persistence.SessionManager; -import com.arsdigita.domain.DataObjectNotFoundException; -import com.arsdigita.domain.DomainObjectFactory; -import com.arsdigita.cms.TemplateContext; +import com.arsdigita.util.Assert; +import com.arsdigita.web.Application; + import java.math.BigDecimal; +/** + * Represents a single subsite (as created by the admin interface) + * + */ public class Site extends ACSObject { public static final String BASE_DATA_OBJECT_TYPE = @@ -43,10 +48,17 @@ public class Site extends ACSObject { public static final String FRONT_PAGE = "frontPage"; public static final String TEMPLATE_CONTEXT = "templateContext"; + /** + * + */ public Site() { this(BASE_DATA_OBJECT_TYPE); } + /** + * Constructor + * @param type + */ public Site(String type) { super(type); } @@ -71,6 +83,15 @@ public class Site extends ACSObject { return site; } + /** + * + * @param title + * @param description + * @param hostname + * @param styleDir + * @param root + * @param frontPage + */ protected void setup(String title, String description, String hostname, @@ -119,7 +140,13 @@ public class Site extends ACSObject { return (Site)DomainObjectFactory.newInstance(obj); } - public static Site findByHostname(String hostname) + /** + * + * @param hostname + * @return + * @throws DataObjectNotFoundException + */ + public static Site findByHostname(String hostname) throws DataObjectNotFoundException { DataCollection sites = SessionManager.getSession() .retrieve(BASE_DATA_OBJECT_TYPE); diff --git a/ccm-ldn-subsite/src/com/arsdigita/london/subsite/SubsiteContext.java b/ccm-ldn-subsite/src/com/arsdigita/london/subsite/SubsiteContext.java index 50d1270b5..c02cb7f5d 100755 --- a/ccm-ldn-subsite/src/com/arsdigita/london/subsite/SubsiteContext.java +++ b/ccm-ldn-subsite/src/com/arsdigita/london/subsite/SubsiteContext.java @@ -26,10 +26,9 @@ import com.arsdigita.dispatcher.DispatcherHelper; import com.arsdigita.london.subsite.Site; /** - * *

The entry point into all the global state that CCM Subsite code expects to * have available to it when running, e.g. the current content section, - * current item + * current item

* *

This is a session object that provides an environment in which * code can execute. The SubsiteContext contains all session-specific @@ -40,23 +39,28 @@ import com.arsdigita.london.subsite.Site; * null explicitly, then use the hasContentItem and hasContentSection * methods first. * - * @author Daniel Berrange * @see com.arsdigita.kernel.KernelContext * @see com.arsdigita.cms.Subsite + * + * @author Daniel Berrange + * @version $Id: SubsiteContext.java 755 2005-09-02 13:42:47Z sskracic $ */ public final class SubsiteContext { - public static final String versionId = - "$Id: SubsiteContext.java 755 2005-09-02 13:42:47Z sskracic $" + - "$Author: sskracic $" + - "$DateTime: 2004/01/27 16:01:55 $"; private static final Logger s_log = Logger.getLogger(SubsiteContext.class); - public static final String SITE_REQUEST_ATTRIBUTE - = Site.class.getName(); + public static final String SITE_REQUEST_ATTRIBUTE = Site.class.getName(); + + /** + * + */ SubsiteContext() {} - + + /** + * + * @return + */ public final String getDebugInfo() { String info = "Current state of " + this + ":\n" + " getSite() -> " + getSite() + "\n"; diff --git a/ccm-ldn-subsite/src/com/arsdigita/london/subsite/SubsiteFilter.java b/ccm-ldn-subsite/src/com/arsdigita/london/subsite/SubsiteFilter.java index 01d51dbee..a172b61e1 100755 --- a/ccm-ldn-subsite/src/com/arsdigita/london/subsite/SubsiteFilter.java +++ b/ccm-ldn-subsite/src/com/arsdigita/london/subsite/SubsiteFilter.java @@ -35,10 +35,30 @@ import com.arsdigita.london.navigation.NavigationContext; import org.apache.log4j.Logger; +/** + * Package's main worker class, SubsiteFilter intercepts each incomming request + * and checks if it matches a configured subsite address (name). + * + * SubsiteFilter class uses the standard servlet filter mechanism (servlet + * specification 2.3 and beyond) so the servlet container ensures its + * invocation. + * + * Usage: SubsiteFilter has to be declared in the web.xml application configuration + * file. + */ public class SubsiteFilter extends BaseFilter { private static final Logger s_log = Logger.getLogger(SubsiteFilter.class); + /** + * Checks an incomming request if its hostname matches an existing subsite. + * + * @param sreq + * @param sresp + * @param chain + * @throws IOException + * @throws ServletException + */ protected void doService(HttpServletRequest sreq, HttpServletResponse sresp, FilterChain chain) diff --git a/ccm-ldn-subsite/web/WEB-INF/web.ccm-ldn-subsite.xml b/ccm-ldn-subsite/web/WEB-INF/web.ccm-ldn-subsite.xml index 937ad8082..b53dff8ee 100644 --- a/ccm-ldn-subsite/web/WEB-INF/web.ccm-ldn-subsite.xml +++ b/ccm-ldn-subsite/web/WEB-INF/web.ccm-ldn-subsite.xml @@ -1,6 +1,8 @@ - + subsite @@ -9,10 +11,7 @@ subsite - /ccm/* - + /* diff --git a/ccm-shp-aplaws/bundles/devel/cfg/web.xml b/ccm-shp-aplaws/bundles/devel/cfg/web.xml index 694cb48e2..9973b0322 100755 --- a/ccm-shp-aplaws/bundles/devel/cfg/web.xml +++ b/ccm-shp-aplaws/bundles/devel/cfg/web.xml @@ -56,10 +56,7 @@ subsite - /ccm/* - diff --git a/ccm-shp-aplaws/bundles/openccm-devel/cfg/web.xml b/ccm-shp-aplaws/bundles/openccm-devel/cfg/web.xml index 513297c49..d9aef3607 100755 --- a/ccm-shp-aplaws/bundles/openccm-devel/cfg/web.xml +++ b/ccm-shp-aplaws/bundles/openccm-devel/cfg/web.xml @@ -48,10 +48,7 @@ subsite - /ccm/* - diff --git a/ccm-shp-aplaws/web/WEB-INF/web.xml-aplaws b/ccm-shp-aplaws/web/WEB-INF/web.xml-aplaws index 29ff94b80..edf4507fa 100755 --- a/ccm-shp-aplaws/web/WEB-INF/web.xml-aplaws +++ b/ccm-shp-aplaws/web/WEB-INF/web.xml-aplaws @@ -27,10 +27,7 @@ subsite - /ccm/* - diff --git a/ccm-zes-aplaws/bundles/devel/cfg/web.xml b/ccm-zes-aplaws/bundles/devel/cfg/web.xml index f2a92540c..2e0b80c57 100644 --- a/ccm-zes-aplaws/bundles/devel/cfg/web.xml +++ b/ccm-zes-aplaws/bundles/devel/cfg/web.xml @@ -55,10 +55,7 @@ subsite - /ccm/* - diff --git a/ccm-zes-aplaws/web/WEB-INF/web.xml-aplaws b/ccm-zes-aplaws/web/WEB-INF/web.xml-aplaws index be52545f1..d56eee455 100644 --- a/ccm-zes-aplaws/web/WEB-INF/web.xml-aplaws +++ b/ccm-zes-aplaws/web/WEB-INF/web.xml-aplaws @@ -58,10 +58,7 @@ subsite - /ccm/* -