Author: pboy
Date: 2012-04-22 15:42:43 +0000 (Sun, 22 Apr 2012)
New Revision: 2292
Added:
trunk/ccm-core/pdl/com/arsdigita/ui/Login/
trunk/ccm-core/pdl/com/arsdigita/ui/Login/Login.pdl
trunk/ccm-core/src/com/arsdigita/ui/login/DummyDispatcher.java
trunk/ccm-core/src/com/arsdigita/ui/login/Login.java
trunk/ccm-core/src/com/arsdigita/ui/login/LoginServlet.java
trunk/ccm-core/src/com/arsdigita/ui/login/UserLoginForm.java
trunk/ccm-core/web/themes/heirloom/apps/acs-subsite.deletemeSoon/
trunk/ccm-core/web/themes/heirloom/apps/acs-subsite.deletemeSoon/xsl/
trunk/ccm-core/web/themes/heirloom/apps/acs-subsite.deletemeSoon/xsl/index.xsl
trunk/ccm-core/web/themes/heirloom/apps/login/
trunk/ccm-core/web/themes/heirloom/apps/login/xsl/
trunk/ccm-core/web/themes/heirloom/apps/login/xsl/index.xsl
trunk/ccm-core/web/themes/heirloom/packages/admin/
trunk/ccm-core/web/themes/heirloom/packages/admin/xsl/
trunk/ccm-core/web/themes/heirloom/packages/admin/xsl/admin.xsl
trunk/ccm-core/web/themes/heirloom/packages/admin/xsl/admin_en.xsl
trunk/ccm-core/web/themes/heirloom/packages/admin/xsl/sitemap_en.xsl
trunk/ccm-core/web/themes/heirloom/packages/admin/xsl/split-panel.xsl
Removed:
trunk/ccm-core/src/com/arsdigita/ui/login/SubsiteDispatcher.java
trunk/ccm-core/src/com/arsdigita/ui/login/SubsiteResources.properties
trunk/ccm-core/src/com/arsdigita/ui/login/SubsiteResources_de.properties
trunk/ccm-core/src/com/arsdigita/ui/login/SubsiteResources_en.properties
trunk/ccm-core/src/com/arsdigita/ui/login/SubsiteResources_fr.properties
trunk/ccm-core/src/com/arsdigita/ui/login/UserRegistrationForm.java
trunk/ccm-core/web/themes/heirloom/apps/acs-subsite/
trunk/ccm-core/web/themes/heirloom/packages/acs-admin/
Modified:
trunk/ccm-core/src/com/arsdigita/bebop/form/CheckboxGroup.java
trunk/ccm-core/src/com/arsdigita/bebop/page/BebopApplicationServlet.java
trunk/ccm-core/src/com/arsdigita/core/Initializer.java
trunk/ccm-core/src/com/arsdigita/dispatcher/DispatcherConfig.java
trunk/ccm-core/src/com/arsdigita/dispatcher/DispatcherConfig_parameter.properties
trunk/ccm-core/src/com/arsdigita/kernel/KernelHelper.java
trunk/ccm-core/src/com/arsdigita/kernel/UserAuthentication.java
trunk/ccm-core/src/com/arsdigita/loader/CoreLoader.java
trunk/ccm-core/src/com/arsdigita/packaging/Load.java
trunk/ccm-core/src/com/arsdigita/ui/UI.java
trunk/ccm-core/src/com/arsdigita/ui/UIConfig.java
trunk/ccm-core/src/com/arsdigita/ui/UIConfig_parameter.properties
trunk/ccm-core/src/com/arsdigita/ui/login/LoginResources_fr.properties
trunk/ccm-core/src/com/arsdigita/ui/login/RecoverPasswordPanel.java
trunk/ccm-core/src/com/arsdigita/ui/login/UserForm.java
trunk/ccm-core/src/com/arsdigita/ui/login/UserInfo.java
trunk/ccm-core/src/com/arsdigita/ui/login/UserNewForm.java
trunk/ccm-core/src/com/arsdigita/web/Application.java
trunk/ccm-core/src/com/arsdigita/web/URL.java
trunk/ccm-core/web/themes/heirloom/apps/admin/xsl/index.xsl
trunk/ccm-core/web/themes/heirloom/packages/login/xsl/login_en.xsl
Log:
Core login package refactored as a new style legacy free application (previously package style node).
Added: trunk/ccm-core/pdl/com/arsdigita/ui/Login/Login.pdl
===================================================================
--- trunk/ccm-core/pdl/com/arsdigita/ui/Login/Login.pdl (rev 0)
+++ trunk/ccm-core/pdl/com/arsdigita/ui/Login/Login.pdl 2012-04-22 15:42:43 UTC (rev 2292)
@@ -0,0 +1,27 @@
+//
+// Copyright (C) 2012 Peter Boy 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
+//
+// $Id: Login.pdl 1550 2012-03-22 11:50:59Z pboy $
+model com.arsdigita.ui.login;
+
+import com.arsdigita.web.Application;
+
+object type Login extends Application {
+ // Nothing to store yet
+ // reference key (login_app.application_id);
+}
+
Property changes on: trunk/ccm-core/pdl/com/arsdigita/ui/Login/Login.pdl
___________________________________________________________________
Added: svn:executable
+
Modified: trunk/ccm-core/src/com/arsdigita/bebop/form/CheckboxGroup.java
===================================================================
--- trunk/ccm-core/src/com/arsdigita/bebop/form/CheckboxGroup.java 2012-04-22 15:41:24 UTC (rev 2291)
+++ trunk/ccm-core/src/com/arsdigita/bebop/form/CheckboxGroup.java 2012-04-22 15:42:43 UTC (rev 2292)
@@ -56,6 +56,7 @@
/** The XML tag.
* @return The tag to be used for the top level DOM element
* generated for this type of Widget. */
+ @Override
protected String getElementTag() {
return BEBOP_CHECKBOXGROUP;
}
Modified: trunk/ccm-core/src/com/arsdigita/bebop/page/BebopApplicationServlet.java
===================================================================
--- trunk/ccm-core/src/com/arsdigita/bebop/page/BebopApplicationServlet.java 2012-04-22 15:41:24 UTC (rev 2291)
+++ trunk/ccm-core/src/com/arsdigita/bebop/page/BebopApplicationServlet.java 2012-04-22 15:42:43 UTC (rev 2292)
@@ -51,7 +51,7 @@
* This class is a servlet based version of BebopMapDispatcher and associated
* classes and is generally used in the same way by legacy free applications.
*
- * Subclasses usually overwrite the doService method to create Page objects
+ * Subclasses usually overwrite the doInit() method to create Page objects
* and use this.put method to construct the mapping.
*
* Subclasses may overwrite the doService method to add additional functionality,
@@ -116,7 +116,9 @@
}
/**
- * disable client/middleware caching of specified page (Chris Gilbert).
+ * Adds the provided page as specified by its pathInfo information to an
+ * internal list of pages for which client/middleware caching will be
+ * disabled when serving the page (added by Chris Gilbert).
*
* @param pathInfo - the same path used to add the page when put was called
*/
@@ -156,6 +158,7 @@
if (m_clientCacheDisabledPages.contains(pathInfo)) {
DispatcherHelper.cacheDisable(sresp);
}
+ preprocessRequest(sreq, sresp, app, pathInfo);
final Document doc = page.buildDocument(sreq, sresp);
DeveloperSupport.endStage("Dispatcher page.buildDocument");
@@ -166,4 +169,18 @@
DeveloperSupport.endStage("Dispatcher presMgr.servePage");
}
}
+
+ /**
+ * Provides the opportunity for subclasses to do some preprocessing
+ * of a given url, before it is handed off to main service process.
+ * One typical action is to ensure permissions.
+ */
+ protected void preprocessRequest(HttpServletRequest sreq,
+ HttpServletResponse sresp,
+ Application app,
+ String url)
+ throws ServletException, IOException {
+ // Nothing to do by default.
+ }
+
}
Modified: trunk/ccm-core/src/com/arsdigita/core/Initializer.java
===================================================================
--- trunk/ccm-core/src/com/arsdigita/core/Initializer.java 2012-04-22 15:41:24 UTC (rev 2291)
+++ trunk/ccm-core/src/com/arsdigita/core/Initializer.java 2012-04-22 15:42:43 UTC (rev 2292)
@@ -52,6 +52,7 @@
import com.arsdigita.search.converter.WordConverter;
import com.arsdigita.search.converter.TextConverter;
+import com.arsdigita.ui.login.Login;
import com.arsdigita.ui.permissions.Permissions;
import com.arsdigita.webdevsupport.WebDevSupport;
import org.apache.log4j.Logger;
@@ -152,6 +153,15 @@
});
e.getFactory().registerInstantiator
+ (Login.BASE_DATA_OBJECT_TYPE,
+ new ACSObjectInstantiator() {
+ @Override
+ public DomainObject doNewInstance(final DataObject data) {
+ return new Login(data);
+ }
+ });
+
+ e.getFactory().registerInstantiator
(Admin.BASE_DATA_OBJECT_TYPE,
new ACSObjectInstantiator() {
@Override
Modified: trunk/ccm-core/src/com/arsdigita/dispatcher/DispatcherConfig.java
===================================================================
--- trunk/ccm-core/src/com/arsdigita/dispatcher/DispatcherConfig.java 2012-04-22 15:41:24 UTC (rev 2291)
+++ trunk/ccm-core/src/com/arsdigita/dispatcher/DispatcherConfig.java 2012-04-22 15:42:43 UTC (rev 2292)
@@ -36,8 +36,17 @@
private final Parameter m_staticURLPrefix;
private final Parameter m_cachingActive;
private final Parameter m_defaultExpiry;
- private final Parameter m_defaultPageClass;
+ /** Default top-level container for all Bebop components and containersPage.
+ * to use for dispatching Bebop pages. A custom installation may provide
+ * it's own implementation. Use with care because all pages inherit from
+ * this class!
+ * Default is {@see com.arsdigita.bebop.Page} */
+ private final Parameter m_defaultPageClass= new
+ StringParameter("waf.dispatcher.default_page_class",
+ Parameter.OPTIONAL,
+ "com.arsdigita.bebop.Page");
+
public DispatcherConfig() {
m_staticURLPrefix = new StringParameter
("waf.dispatcher.static_url_prefix", Parameter.REQUIRED,
@@ -52,11 +61,6 @@
("waf.dispatcher.default_expiry", Parameter.REQUIRED,
new Integer(259200));
- m_defaultPageClass = new StringParameter
- ("waf.dispatcher.default_page_class",
- Parameter.OPTIONAL,
- "com.arsdigita.bebop.Page");
-
register(m_staticURLPrefix);
register(m_cachingActive);
register(m_defaultExpiry);
@@ -90,6 +94,12 @@
return (Integer)get(m_defaultExpiry);
}
+ /**
+ * Retrieve the top-level container for all Bebop components and
+ * containersPage to use by dispatcher.
+ * Most installation should use the provided default implementation in
+ * {@see com.arsdigita.bebop.Page}
+ */
public String getDefaultPageClass() {
return (String)get(m_defaultPageClass);
}
Modified: trunk/ccm-core/src/com/arsdigita/dispatcher/DispatcherConfig_parameter.properties
===================================================================
--- trunk/ccm-core/src/com/arsdigita/dispatcher/DispatcherConfig_parameter.properties 2012-04-22 15:41:24 UTC (rev 2291)
+++ trunk/ccm-core/src/com/arsdigita/dispatcher/DispatcherConfig_parameter.properties 2012-04-22 15:42:43 UTC (rev 2292)
@@ -2,14 +2,18 @@
waf.dispatcher.static_url_prefix.purpose=Prefix used for serving static files
waf.dispatcher.static_url_prefix.example=/STATIC/
waf.dispatcher.static_url_prefix.format=[url]
+
waf.dispatcher.is_caching_active.title=Dispatcher caching enabled
waf.dispatcher.is_caching_active.purpose=Toggle whether or not to use HTTP/1.1 caching
waf.dispatcher.is_caching_active.example=true
waf.dispatcher.is_caching_active.format=true|false
+
waf.dispatcher.default_expiry.title=Default cache expiration
waf.dispatcher.default_expiry.purpose=Set the default expiration time for HTTP caching
waf.dispatcher.default_expiry.example=259200
waf.dispatcher.default_expiry.format=[integer]
+
waf.dispatcher.default_page_class.title=Default page class
waf.dispatcher.default_page_class.purpose=the default page class
waf.dispatcher.default_page_class.example=com.arsdigita.bebop.Page
+waf.dispatcher.default_page_class.format=[String]
Modified: trunk/ccm-core/src/com/arsdigita/kernel/KernelHelper.java
===================================================================
--- trunk/ccm-core/src/com/arsdigita/kernel/KernelHelper.java 2012-04-22 15:41:24 UTC (rev 2291)
+++ trunk/ccm-core/src/com/arsdigita/kernel/KernelHelper.java 2012-04-22 15:42:43 UTC (rev 2292)
@@ -200,14 +200,6 @@
}
/**
- * @deprecated Use
- * <code>Kernel.getConfig().getPrimaryUserIdentifier()</code>
- */
- public static synchronized boolean emailIsPrimaryIdentifier() {
- return Kernel.getConfig().getPrimaryUserIdentifier().equals("email");
- }
-
- /**
*
*
* Fetches the currently logged in user, or null. This is a
Modified: trunk/ccm-core/src/com/arsdigita/kernel/UserAuthentication.java
===================================================================
--- trunk/ccm-core/src/com/arsdigita/kernel/UserAuthentication.java 2012-04-22 15:41:24 UTC (rev 2291)
+++ trunk/ccm-core/src/com/arsdigita/kernel/UserAuthentication.java 2012-04-22 15:42:43 UTC (rev 2292)
@@ -494,8 +494,8 @@
}
set("id", user.getID());
setAssociation("user", user);
- set("primaryEmail", user.getPrimaryEmail().getEmailAddress());
- set("screenName", user.getScreenName());
+ set("primaryEmail", user.getPrimaryEmail().getEmailAddress());
+ set("screenName", user.getScreenName());
m_user = user;
}
@@ -509,10 +509,10 @@
* @return The login name used for the user.
**/
private static String getLoginNameForUser(User user) {
- if (KernelHelper.emailIsPrimaryIdentifier()) {
- return user.getPrimaryEmail().getEmailAddress();
- }
- return user.getScreenName();
+ if (Kernel.getConfig().emailIsPrimaryIdentifier()) {
+ return user.getPrimaryEmail().getEmailAddress();
+ }
+ return user.getScreenName();
}
}
Modified: trunk/ccm-core/src/com/arsdigita/loader/CoreLoader.java
===================================================================
--- trunk/ccm-core/src/com/arsdigita/loader/CoreLoader.java 2012-04-22 15:41:24 UTC (rev 2291)
+++ trunk/ccm-core/src/com/arsdigita/loader/CoreLoader.java 2012-04-22 15:42:43 UTC (rev 2292)
@@ -42,6 +42,7 @@
import com.arsdigita.runtime.ConfigError;
import com.arsdigita.runtime.ScriptContext;
import com.arsdigita.ui.admin.Admin;
+import com.arsdigita.ui.login.Login;
import com.arsdigita.ui.permissions.Permissions;
import com.arsdigita.ui.sitemap.SiteMap;
import com.arsdigita.util.Assert;
@@ -57,8 +58,8 @@
import com.arsdigita.web.ApplicationType;
import com.arsdigita.web.Host;
import com.arsdigita.web.Web;
+import com.arsdigita.webdevsupport.WebDevSupport;
-import com.arsdigita.webdevsupport.WebDevSupport;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -127,7 +128,8 @@
private StringParameter m_dispatcher = new StringParameter
("waf.login.dispatcher", Parameter.OPTIONAL,
- "com.arsdigita.ui.login.SubsiteDispatcher");
+ "com.arsdigita.ui.login.DummyDispatcher");
+ // "com.arsdigita.ui.login.SubsiteDispatcher");
private StringParameter m_resource = new StringParameter
("waf.mime.resource", Parameter.OPTIONAL,
@@ -273,8 +275,8 @@
// !! s_log.debug("CoreLoader: Going to execute loadBebop().");
// !! loadBebop();
- s_log.debug("CoreLoader: Going to execute loadWebDev().");
- loadWebDev(); // new style legacy free
+ s_log.debug("CoreLoader: Going to execute loadLoginApp().");
+ loadLoginApp();
s_log.debug("CoreLoader: Going to execute loadAdminApp().");
loadAdminApp();
@@ -285,6 +287,9 @@
s_log.debug("CoreLoader: Going to execute loadPermissionsApp().");
loadPermissionsApp(); // new style legacy free
+ s_log.debug("CoreLoader: Going to execute loadWebDev().");
+ loadWebDev(); // new style legacy free
+
s_log.debug("CoreLoader: Going to execute loadPortal().");
loadPortal();
@@ -464,35 +469,31 @@
}
*/
+
-
/**
- * Loads WebDeveloperSupport as a new style, legacy free application into
- * database and instantiate the (only) application instance.
- *
- * Public static access needed by upgrade script Upgrade664
- * @return webDevType ApplicationType
+ *
+ * @return
*/
- public static void loadWebDev() {
-
- ApplicationType webDevType =
- new ApplicationType("WebDev Support",
- WebDevSupport.BASE_DATA_OBJECT_TYPE );
- webDevType.setDescription("WebDeveloper Support application");
- webDevType.save();
-
- Application webDev = Application.createApplication(webDevType,
- "ds",
- "WebDeveloper Support",
- null);
- webDev.setDescription("The default WEB developer service instance.");
- webDev.save();
+ private Application loadLoginApp() {
+
+ ApplicationType loginType =
+ new ApplicationType("login",
+ Login.BASE_DATA_OBJECT_TYPE );
+ loginType.setDescription("CCM user login application");
+ loginType.save();
- return;
- }
+ Application login = Application.createApplication(loginType,
+ "register",
+ "CCM Login",
+ null);
+ login.setDescription("CCM login instance");
+ return login;
+ }
+
/**
*
* @return
@@ -585,6 +586,31 @@
}
/**
+ * Loads WebDeveloperSupport as a new style, legacy free application into
+ * database and instantiate the (only) application instance.
+ *
+ * Public static access needed by upgrade script Upgrade664
+ * @return webDevType ApplicationType
+ */
+ public static void loadWebDev() {
+
+ ApplicationType webDevType =
+ new ApplicationType("WebDev Support",
+ WebDevSupport.BASE_DATA_OBJECT_TYPE );
+ webDevType.setDescription("WebDeveloper Support application");
+ webDevType.save();
+
+ Application webDev = Application.createApplication(webDevType,
+ "ds",
+ "WebDeveloper Support",
+ null);
+ webDev.setDescription("The default WEB developer service instance.");
+ webDev.save();
+
+ return;
+ }
+
+ /**
* Load core's basic portal infrastructure.
*/
private void loadPortal() {
Modified: trunk/ccm-core/src/com/arsdigita/packaging/Load.java
===================================================================
--- trunk/ccm-core/src/com/arsdigita/packaging/Load.java 2012-04-22 15:41:24 UTC (rev 2291)
+++ trunk/ccm-core/src/com/arsdigita/packaging/Load.java 2012-04-22 15:42:43 UTC (rev 2292)
@@ -408,7 +408,8 @@
}
if (!conflicts.isEmpty()) {
- System.err.println("conflicting tables: " + conflicts);
+ System.err.println("conflicting tables (already exist): " +
+ conflicts);
}
if (conflicts.size() > 0 || missing.size() > 0) {
Modified: trunk/ccm-core/src/com/arsdigita/ui/UI.java
===================================================================
--- trunk/ccm-core/src/com/arsdigita/ui/UI.java 2012-04-22 15:41:24 UTC (rev 2291)
+++ trunk/ccm-core/src/com/arsdigita/ui/UI.java 2012-04-22 15:42:43 UTC (rev 2292)
@@ -18,6 +18,8 @@
package com.arsdigita.ui;
+import com.arsdigita.ui.login.Login;
+import com.arsdigita.ui.login.LoginServlet;
import javax.servlet.http.HttpServletRequest;
import org.apache.log4j.Logger;
@@ -38,44 +40,14 @@
private static final UIConfig s_config = UIConfig.getConfig();
- /** (Relative) URL for systems public top level page. */
- // In old LegacyInitializer ROOT_PAGE_KEY =pagemap.root= register/ | portal/
+ /** URL for systems public top level page (entry or start page). */
private static final String s_rootPageURL = s_config.getRootPage();
- /** (Relative) URL for systems login page. */
- private static final String s_loginURL = s_config.getLogin();
- /** (Relative) URL for systems logout page. */
- private static final String s_logoutURL = s_config.getLogout();
- /**
- * */
- private static final String s_userRedirectURL = s_config.getUserRedirect();
- /** (Relative) URL for workspace page. */
+ /** URL to page a user should be redirected to after login. */
+ private static final String s_userRedirectURL = s_config.getUserRedirect();
+ /** (Absolute) URL for workspace page. */
private static final String s_workspaceURL = s_config.getWorkspace();
- /** Root URL */
- // This address used to be determinded by
- // SiteNode.getRootSiteNode().getURL();
- // It provides a sitenode without a name an without any parent, i.e. "/"
- // There is no information whether the context path (in case we are not
- // installed as root application (context) of the servlet(!) container).
- // It does obviously NOT include the constant prefix, generated by the
- // new dispatcher.
- //
- // Previously an variant had been used:
- // SiteNode.getRootSiteNode().getURL(request);
- // but according to a developers comment the latter is not save:
- // "this isn't safe since you aren't neccessarily calling it from
- // the root webapp - so we can't blindly prepend the context path
- // from the current request."
- //
- // Sitenode is deprecated, web.Application should be used instead. But here
- // there is no application to invoke, but we need the root part of the URL
- // for a page to be prepended to its address. This depends on the
- // installation, not on the request or the specific application.
- //
- // XXX must be generated from an installation config record.
- private static final String s_rootURL = "/";
-
/**
* Provides a handle to the UI config record.
*
@@ -86,293 +58,71 @@
}
/**
- * Provides an absolute URL (leading slash) into the system top-level page.
- * It is relative to document root without any constant prefix if there is
- * one configured.
+ * Provides an absolute URL (leading slash) into the system top-level page
+ * (entry page / start page). It is relative to document root without any
+ * constant prefix if there is one configured.
+ *
+ * Method is typically called by servlets and especially by JSP's.
+ *
+ * Currently just a wrapper script to getRootPageURL() because req is
+ * currently ignored.
*
- * XXX This implementation starts with a leading slash and ends with a slash.
- * In previous configurations String urls began without a slash in order
- * to be able to provide a full URL which also contains the context part.
- * Since version 5.2 the context part is handled by (new) dispatcher.
- * Therefore the request parameter is not ignored! This variant is retained
- * for backwards compatibility only.
- * The leading slash it API change! It's impacts have tp be checked. (2011-02)
+ * @param req HttpServletRequest, may be used to determin the context of
+ * the current thread (application), currently not used and
+ * introduced here for backwards compatibility
*
* @return URL for top-level page as String
*/
- // In old LegacyInitializer ROOT_PAGE_KEY = pagemap.root = register/
- // (usually modif. to portal/nav)
public static String getRootPageURL(HttpServletRequest req) {
- if (s_log.isDebugEnabled()) {
- s_log.debug("Root is " + s_rootURL + ", url is " + s_rootPageURL);
- }
-
- if ((s_rootURL == null) || (s_rootPageURL == null)) {
- return null;
- }
- return s_rootURL + s_rootPageURL;
+ return getRootPageURL();
}
/**
- * Provides an absolute URL (leading slash) into the system top-level page.
- * It is relative to document root without any constant prefix if there is
- * one configured.
+ * Provides an absolute URL (leading slash) into the system top-level page
+ * (entry page / start page). It is relative to document root without any
+ * constant prefix if there is one configured.
+ *
+ * Method is typically called by servlets and especially by JSP's.
*
- * XXX This implementation starts with a leading slash and ends with a slash.
- * In previous configurations String urls began without a slash in order
- * to be able to provide a full URL which also contains the context part.
- * Since version 5.2 the context part is handled by (new) dispatcher.
- * The leading slash it API change! It's impacts have tp be checked. (2011-02)
- *
* @return URL for top-level page as String
*/
- // In old LegacyInitializer ROOT_PAGE_KEY = register/ (modif. to portal/nav)
public static String getRootPageURL() {
- if (s_log.isDebugEnabled()) {
- s_log.debug("Root is " + s_rootURL + ", url is " + s_rootPageURL);
- }
-
- if ((s_rootURL == null) || (s_rootPageURL == null)) {
- return null;
- }
- return s_rootURL + s_rootPageURL;
- // return s_rootPageURL;
+ return s_rootPageURL;
}
/**
- * Provides an absolute URL (leading slash) into the system login page.
- * It is relative to document root without any constant prefix if there is
- * one configured.
- *
- * XXX This implementation starts with a leading slash and ends with a slash.
- * In previous configurations String urls began without a slash in order
- * to be able to provide a full URL which also contains the context part.
- * Since version 5.2 the context part is handled by (new) dispatcher.
- * The leading slash it API change! It's impacts have tp be checked. (2011-02)
- *
- * @return URL for login page as String
- */
- // In old LegacyInitializer
- // LOGIN_PAGE_KEY = page.kernel.login = register/
- public static String getLoginPageURL() {
- return s_rootURL + s_loginURL;
- }
-
- /**
- * Provides an absolute URL (leading slash) for a login expired info page.
- * It is relative to document root without any constant prefix if there is
- * one configured.
- *
- * XXX This implementation starts with a leading slash and ends with a slash.
- * In previous configurations String urls began without a slash in order
- * to be able to provide a full URL which also contains the context part.
- * Since version 5.2 the context part is handled by (new) dispatcher.
- * The leading slash it API change! It's impacts have tp be checked. (2011-02)
- *
- * @return url String for new user registration page as String
- */
- // In old LegacyInitializer
- // EXPIRED_PAGE_KEY =page.kernel.expired=register/login-expired/
- public static String getLoginExpiredPageURL() {
- return s_rootURL + s_loginURL + "login-expired/";
- }
-
- /**
- * Provides an absolute URL (leading slash) for a cookie explanation page.
- * It is relative to document root without any constant prefix if there is
- * one configured.
- *
- * XXX This implementation starts with a leading slash and ends with a slash.
- * In previous configurations String urls began without a slash in order
- * to be able to provide a full URL which also contains the context part.
- * Since version 5.2 the context part is handled by (new) dispatcher.
- * The leading slash it API change! It's impacts have tp be checked. (2011-02)
- *
- * @return url String for new user registration page as String
- */
- // In old LegacyInitializer
- //COOKIES_PAGE_KEY =page.kernel.cookies=register/explain-persistent-cookies/
- public static String getCookiesExplainPageURL() {
- return s_rootURL + s_loginURL + "explain-persistent-cookies/";
- }
-
- /**
- * Provides an absolute URL (leading slash) for a password recovery page.
- * It is relative to document root without any constant prefix if there is
- * one configured.
- *
- * XXX This implementation starts with a leading slash and ends with a slash.
- * In previous configurations String urls began without a slash in order
- * to be able to provide a full URL which also contains the context part.
- * Since version 5.2 the context part is handled by (new) dispatcher.
- * The leading slash it API change! It's impacts have tp be checked. (2011-02)
- *
- * @return url String for new user registration page as String
- */
- // In old LegacyInitializer
- // RECOVER_PAGE_KEY =page.kernel.recover = register/recover-password/
- public static String getRecoverPasswordPageURL() {
- return s_rootURL + s_loginURL + "recover-password/";
- }
-
- /**
- * Provides an absolute URL (leading slash) to a user profile editig page.
- * It is relative to document root without any constant prefix if there is
- * one configured.
- *
- * XXX This implementation starts with a leading slash and ends with a slash.
- * In previous configurations String urls began without a slash in order
- * to be able to provide a full URL which also contains the context part.
- * Since version 5.2 the context part is handled by (new) dispatcher.
- * The leading slash it API change! It's impacts have tp be checked. (2011-02)
- *
- * @return url String for new user registration page as String
- */
- // In old LegacyInitializer
- // EDIT_PAGE_KEY = page.kernel.edit = register/edit-profile/
- public static String getEditUserProfilePageURL() {
- return s_rootURL + s_loginURL + "edit-profile/";
- }
-
- /**
- * Provides an absolute URL (leading slash) for an edit (change) password
- * page. It is relative to document root without any constant prefix if
- * there is one configured.
- *
- * XXX This implementation starts with a leading slash and ends with a slash.
- * In previous configurations String urls began without a slash in order
- * to be able to provide a full URL which also contains the context part.
- * Since version 5.2 the context part is handled by (new) dispatcher. The
- * leading slash it API change! It's impacts have to be checked. (2011-02)
- *
- * @return url String for new user registration page as String
- */
- // In old LegacyInitializer
- // CHANGE_PAGE_KEY = page.kernel.change = register/change-password/
- public static String getChangePasswordPageURL() {
- return s_rootURL + s_loginURL + "change-password/";
- }
-
- /**
- * Provides an absolute URL (leading slash) to an optional new user
- * registration page (accessible only if activated). It is relative to
- * document root without any constant prefix if there is one configured.
- *
- * XXX This implementation starts with a leading slash and ends with a slash.
- * In previous configurations String urls began without a slash in order
- * to be able to provide a full URL which also contains the context part.
- * Since version 5.2 the context part is handled by (new) dispatcher.
- * The leading slash it API change! It's impacts have tp be checked. (2011-02)
- *
- * @return url String for new user registration page as String
- */
- // In old LegacyInitializer
- // NEWUSER_PAGE_KEY = page.kernel.newuser = register/new-user/
- public static String getNewUserPageURL() {
- return s_rootURL + s_loginURL + "new-user/";
- }
-
- /**
- * Provides an absolute URL (leading slash) for the system logout page. It
- * is relative to document root without any constant prefix if there is one
- * configured.
- *
- * XXX This implementation starts with a leading slash and ends with a slash.
- * In previous configurations String urls began without a slash in order
- * to be able to provide a full URL which also contains the context part.
- * Since version 5.2 the context part is handled by (new) dispatcher.
- * The leading slash it API change! It's impacts have tp be checked. (2011-02)
- *
- * @return URL for logout page as String
- */
- // In old LegacyInitializer
- // LOGOUT_PAGE_KEY =page.kernel.logout=register/logout/
- public static String getLogoutPageURL() {
- return s_rootURL + s_logoutURL;
- }
-
- /**
* Provides the absolute URL of a page, which redirects an incomming request
* based on some clients property, usually whether the user is logged in,
* either to a general public page or to a user (client) specific page.
- *
+ *
* It is relative to document root including leading slash but without any
* constant prefix if there is one configured.
*
- * It is used by the ccm index page (home/start page) ~/index.jsp. By default
- * it is configured as "pvt/" which redirects to a user specific home page
- * if the initial incomming request comes from a logged in user.
- * Applications may configure a different page according to their specific
- * purposes. e.g ccm-cms provides a page content/content-center-redirect.jsp
- * which redirects a user to the content-center if logged in.
+ * It is typically used after login to redirect to an appropriate page, by
+ * default to /peremissions/. A site should configure an application
+ * to their specific purposes. e.g ccm-cms provides a page
+ * content-center/redirect.jsp which redirects a user to the content-center
+ * if logged in.
*
- * XXX This implementation starts with a leading slash and ends with a slash.
- * In previous configurations String urls began without a slash in order
- * to be able to provide a full URL which also contains the context part.
- * Since version 5.2 the context part is handled by (new) dispatcher.
- * Previous implementation of this method signature (no parameter) returned
- * an url without leading slash.
- * The leading slash it API change! It's impacts have tp be checked. (2011-02)
- *
* @return full URL of a user redirect page, may be null
*/
- // In old LegacyInitializer
- // LOGIN_REDIRECT_PAGE_KEY =page.kernel.login.redirect=pvt/
- // (usually modified to "content/content-center-redirect-page.jsp")
public static String getUserRedirectURL() {
- if (s_log.isDebugEnabled()) {
- s_log.debug("Root is " + s_rootURL + ", url is " + s_userRedirectURL);
- }
-
- if ((s_rootURL == null) || (s_userRedirectURL == null)) {
- return null;
- }
- return s_rootURL + s_userRedirectURL;
+ return s_userRedirectURL;
}
/**
- * Provides the absolute URL of a page, which redirects an incomming request
- * based on some clients property, usually whether the user is logged in,
- * either to a general public page or to a user (client) specific page.
- *
- * It is relative to document root including leading slash but without any
- * constant prefix if there is one configured.
- *
- * It is used by the ccm index page (home/start page) ~/index.jsp. By default
- * it is configured as "pvt/" which redirects to a user specific home page
- * if the initial incomming request comes from a logged in user.
- * Applications may configure a different page according to their specific
- * purposes. e.g ccm-cms provides a page content/content-center-redirect.jsp
+ * Wrapper method for {@see getUserRedirectURL()}
* which redirects a user to the content-center if logged in.
+ *
+ * Method is specifically used by various redirect JSP's.
*
- * XXX This implementation starts with a leading slash and ends with a slash.
- * In previous configurations String urls began without a slash in order
- * to be able to provide a full URL which also contains the context part.
- * Since version 5.2 the context part is handled by (new) dispatcher.
- * Previous implementation of this method signature (HTTPServletRequest)
- * returned an url to a registration redirect page either starting with a
- * slash for root context or the context path part. HTTPServletRequest is
- * no longer significant here and method signature retained here for
- * backwards compatibility only.
- *
* @param req HttpServletRequest, may be used to determin the context of
* the current thread (application), currently not used and
* introduced here for backwards compatibility
* @return full URL of a user redirect page, may be null
*/
- // see comment at top about getRootURL(req) for details!
- // In old LegacyInitializer
- // LOGIN_REDIRECT_PAGE_KEY =page.kernel.login.redirect=pvt/
- // (usually modified to "content/content-center-redirect-page.jsp")
public static String getUserRedirectURL(HttpServletRequest req) {
- if (s_log.isDebugEnabled()) {
- s_log.debug("Root is " + s_rootURL + ", url is " + s_userRedirectURL);
- }
-
- if ((s_rootURL == null) || (s_userRedirectURL == null)) {
- return null;
- }
- return s_rootURL + s_userRedirectURL;
+ return getUserRedirectURL();
}
/**
@@ -386,73 +136,99 @@
* defines a different page according to their specific purposes, e.g.
* portal or navigation.
*
- * XXX This implementation starts with a leading slash and ends with a slash.
- * In previous configurations String urls began without a slash in order
- * to be able to provide a full URL which also contains the context part.
- * Since version 5.2 the context part is handled by (new) dispatcher.
- * Previous implementation of this method signature (no parameter) returned
- * an url without leading slash.
- * The leading slash it API change! It's impacts have tp be checked. (2011-02)
- *
* @return URL for workspace page as String
*/
- // In old LegacyInitializer
- // WORKSPACE_PAGE_KEY = page.kernel.workspace=pvt/ (mod- t0 portal/nav)
public static String getWorkspaceURL() {
- if (s_log.isDebugEnabled()) {
- s_log.debug("Root is " + s_rootURL + ", url is " + s_workspaceURL);
- }
-
- if ((s_rootURL == null) || (s_workspaceURL == null)) {
- return null;
- }
- return s_rootURL + s_workspaceURL;
+ return s_workspaceURL;
}
/**
* Provides the absolute URL for the system workspace page.
* It is relative to document root including leading slash but without any
* constant prefix if there is one configured.
+ *
+ * Method is typically called by servlets and especially by JSP's.
+ *
+ * Currently just a wrapper script to getWorkspaceURL() because req is
+ * currently ignored.
*
- * It is used by the user redirection page (see above) as redirection target
- * if no logged in user exists or no user specific page is configured. By
- * default it is configured as "pvt/" as well. An installation usually
- * defines a different page according to their specific purposes, e.g.
- * portal or navigation.
- *
- * XXX This implementation starts with a leading slash and ends with a slash.
- * In previous configurations String urls began without a slash in order
- * to be able to provide a full URL which also contains the context part.
- * Since version 5.2 the context part is handled by (new) dispatcher.
- * Previous implementation of this method signature (HTTPServletRequest)
- * returned an url to a workspace page either starting with a
- * slash for root context or the context path part. HTTPServletRequest is
- * no longer significant here and method signature retained here for
- * backwards compatibility only.
- *
- *
* @param req HttpServletRequest, may be used to determin the context of
* the current thread (application), currently not used and
* introduced here for backwards compatibility
+ *
* @return URL for workspace page as String
*/
// In old LegacyInitializer
// WORKSPACE_PAGE_KEY = page.kernel.workspace=pvt/ (mod- t0 portal/nav)
public static String getWorkspaceURL(HttpServletRequest req) {
- if (s_log.isDebugEnabled()) {
- s_log.debug("Root is " + s_rootURL + ", url is " + s_workspaceURL);
- }
+ return getWorkspaceURL();
+ }
- if ((s_rootURL == null) || (s_workspaceURL == null)) {
- return null;
- }
- return s_rootURL + s_workspaceURL;
+
+ // ////////////////////////////////////////////////////////////////////////
+ // Various deprfecated methods, to be removed as soon as invoking code is
+ // refactored.
+ // ////////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Provides an absolute URL (leading slash) into the system login page.
+ * It is relative to document root without any constant prefix if there is
+ * one configured.
+ *
+ * @return URL for login page as String
+ * @deprecated use Login.getLoginPageURL()() instead
+ */
+ public static String getLoginPageURL() {
+ return Login.getLoginPageURL();
}
- // In old LegacyInitializer
- // PERMISSION_PAGE_KEY = page.kernel.permission = permissions/
+ /**
+ * Provides an absolute URL (leading slash) for a cookie explanation page.
+ * It is relative to document root without any constant prefix if there is
+ * one configured.
+ *
+ * @return url String for new user registration page as String
+ * @deprecated use LoginServlet.getCookiesExplainPageURL() instead
+ */
+ public static String getCookiesExplainPageURL() {
+ return LoginServlet.getCookiesExplainPageURL();
+ }
- // In old LegacyInitializer
- // PERM_SINGLE_PAGE_KEY = page.kernel.perm-single = permissions/one/
+ /**
+ * Provides an absolute URL (leading slash) for a password recovery page.
+ * It is relative to document root without any constant prefix if there is
+ * one configured.
+ *
+ * @return url String for new user registration page as String
+ * @deprecated use LoginServlet.getRecoverPasswordPageURL() instead
+ */
+ public static String getRecoverPasswordPageURL() {
+ return LoginServlet.getRecoverPasswordPageURL();
+ }
+ /**
+ * Provides an absolute URL (leading slash) to a user profile editig page.
+ * It is relative to document root without any constant prefix if there is
+ * one configured.
+ *
+ * @return url String for new user registration page as String
+ * @deprecated use LoginServlet.getEditUserProfilePageURL() instead
+ */
+ public static String getEditUserProfilePageURL() {
+ return LoginServlet.getEditUserProfilePageURL();
+ }
+
+ /**
+ * Provides an absolute URL (leading slash) for the system logout page. It
+ * is relative to document root without any constant prefix if there is one
+ * configured.
+ *
+ * @return URL for logout page as String
+ * @deprecated use LoginServlet.getLogoutPageURL() instead
+ */
+ public static String getLogoutPageURL() {
+ return LoginServlet.getLogoutPageURL();
+ }
+
}
Modified: trunk/ccm-core/src/com/arsdigita/ui/UIConfig.java
===================================================================
--- trunk/ccm-core/src/com/arsdigita/ui/UIConfig.java 2012-04-22 15:41:24 UTC (rev 2291)
+++ trunk/ccm-core/src/com/arsdigita/ui/UIConfig.java 2012-04-22 15:42:43 UTC (rev 2292)
@@ -138,33 +138,23 @@
);
/** String containing the relative URL for the top level page
- * (or entry page / home page) of the site, Without leading slash but with
- * trailing slash in case of a directory.
- * By default it is the login page, but usually the root page of the main
- * presentation application, e.g. portal, navigation, forum, etc. */
- // Old initializer: waf.pagemap.root
- private final Parameter m_rootPageURL = new StringParameter
- ("core.ui.pagemap.root_page_url", Parameter.REQUIRED, "register/");
+ * (or entry page / home page) of the site, Without leading slash but
+ * with trailing slash in case of a directory.
+ * By default it is the login page, but usually the root page of the
+ * main presentation application, e.g. portal, navigation, forum, etc. */
+ private final Parameter m_rootPageURL =
+ new StringParameter("core.ui.pagemap.root_page_url",
+ Parameter.REQUIRED, "/register/");
- /**String containing the URL for the login page, Without leading slash but
- * with trailing slash in case of a directory. */
- // Old initializer: waf.pagemap.login
- private final Parameter m_loginURL = new StringParameter
- ("core.ui.pagemap.login_url", Parameter.REQUIRED, "register/");
-
- /** String containing the URL for the logout page, Without leading slash
- * but with trailing slash in case of a directory. */
- // Old initializer: waf.pagemap.logout
- private final Parameter m_logoutURL = new StringParameter
- ("core.ui.pagemap.logout_url", Parameter.REQUIRED, "register/logout");
-
- /** String containing the URL for a page which may perform a user specific
- * redirect if logged in or to a general public page if not. */
- // Used to be LOGIN_REDIRECT_PAGE_KEY in old kernel/security/initializer
- // parameter waf.pagemap.login_redirect = pvt/
- // XXX url pvt seems not to exist anymore! (pboy 2011-02-03)
- private final Parameter m_userRedirectURL = new StringParameter
- ("core.ui.pagemap.user_redirect_url", Parameter.REQUIRED, "pvt/");
+ /** String containing the URL of a page, a servlet or a jsp, to which a
+ * user after login will be redirected to.
+ * In case of a jsp or servlet it may contain user specific logic to
+ * redirect to a page specific for the user or a group of users.
+ * By default it is the /permissions/ page, but usually it is an
+ * application like personal-portal or content-center. */
+ private final Parameter m_userRedirectURL =
+ new StringParameter("core.ui.pagemap.user_redirect_url",
+ Parameter.REQUIRED, "/permissions/");
/** String containing the URL for the workspace of the site. */
// Old initializer: waf.pagemap.workspace
@@ -185,8 +175,6 @@
register(m_applicationLayouts);
register(m_rootPageURL);
- register(m_loginURL);
- register(m_logoutURL);
register(m_userRedirectURL);
register(m_workspaceURL);
@@ -249,34 +237,27 @@
* @return root page url
*/
public String getRootPage() {
- return (String)get(m_rootPageURL) ;
+ String rootPageURL = (String)get(m_rootPageURL) ;
+ // Previous configurations required NO leading slash. Just in case an
+ // old configuration is in place we have to translate.
+ return ( rootPageURL.startsWith("/") ?
+ rootPageURL : "/"+rootPageURL );
}
/**
- * Retrieve systems login page url.
+ * Retrieve systems user login redirect page url, that is the page, a
+ * servlet oder a JSP ti which a user is redirected to after login.
+ * By default it is the /permissions/ page, but usually it is an application
+ * like personal-portal or content-center.
*
- * @return login page url
- */
- public String getLogin() {
- return (String)get(m_loginURL) ;
- }
-
- /**
- * Retrieve systems logout page url.
- *
- * @return logout page url
- */
- public String getLogout() {
- return (String)get(m_logoutURL) ;
- }
-
- /**
- * Retrieve systems user login redirect page url.
- *
* @return user login redirect page url
*/
public String getUserRedirect() {
- return (String)get(m_userRedirectURL) ;
+ String userRedirectURL = (String)get(m_userRedirectURL);
+ // Previous configurations required NO leading slash. Just in case an
+ // old configuration is in place we have to translate.
+ return ( userRedirectURL.startsWith("/") ?
+ userRedirectURL : "/"+userRedirectURL );
}
/**
@@ -285,7 +266,11 @@
* @return workspace page url
*/
public String getWorkspace() {
- return (String)get(m_workspaceURL) ;
+ String workspaceURL = (String)get(m_workspaceURL);
+ // Previous configurations required NO leading slash. Just in case an
+ // old configuration is in place we have to translate.
+ return ( workspaceURL.startsWith("/") ?
+ workspaceURL : "/"+workspaceURL );
}
}
Modified: trunk/ccm-core/src/com/arsdigita/ui/UIConfig_parameter.properties
===================================================================
--- trunk/ccm-core/src/com/arsdigita/ui/UIConfig_parameter.properties 2012-04-22 15:41:24 UTC (rev 2291)
+++ trunk/ccm-core/src/com/arsdigita/ui/UIConfig_parameter.properties 2012-04-22 15:42:43 UTC (rev 2292)
@@ -13,16 +13,6 @@
core.ui.pagemap.root_page_url.example=register/
core.ui.pagemap.root_page_url.format=[string]
-core.ui.pagemap.login_url.title=Login Page
-core.ui.pagemap.login_url.purpose=Enter the relative URL for the Login page (to document root and without constant prefix if configured)
-core.ui.pagemap.login_url.example=register/
-core.ui.pagemap.login_url.format=[string]
-
-core.ui.pagemap.logout_url.title=Logout Page
-core.ui.pagemap.logout_url.purpose=Enter the relative URL for the Logout Page (to document root and without constant prefix if configured)
-core.ui.pagemap.logout_url.example=register/logout
-core.ui.pagemap.logout_url.format=[string]
-
core.ui.pagemap.user_redirect_url.title=User Redirect Page
core.ui.pagemap.user_redirect_url.purpose=Enter the relative URL to a page which redirects the request according to the logged in user (if exists)
core.ui.pagemap.user_redirect_url.example=pvt/
@@ -34,32 +24,6 @@
core.ui.pagemap.workspace_url.format=[string]
-
-#waf.pagemap.newuser.title=New User Page
-#waf.pagemap.newuser.purpose=Enter the relative URL for the New User Page
-#waf.pagemap.newuser.example=register/new-user
-#waf.pagemap.newuser.format=[string]
-
-#waf.pagemap.cookies.title=Cookies Explanation Page
-#waf.pagemap.cookies.purpose=Enter the relative URL for the Cookies explanation page
-#waf.pagemap.cookies.example=register/explain-persistent-cookies
-#waf.pagemap.cookies.format=[string]
-
-#waf.pagemap.change.title=Change Password Page
-#waf.pagemap.change.purpose=Enter the relative URL for the Change Password Page
-#waf.pagemap.change.example=register/change-password
-#waf.pagemap.change.format=[string]
-
-#waf.pagemap.recover.title=Recover Password Page
-#waf.pagemap.recover.purpose=Enter the relative URL for the Recover Password Page
-#waf.pagemap.recover.example=register/recover-password
-#waf.pagemap.recover.format=[string]
-
-#waf.pagemap.expired.title=Expired Login Page
-#waf.pagemap.expired.purpose=Enter the relative URL for the expired login message
-#waf.pagemap.expired.example=register/login-expired
-#waf.pagemap.expired.format=[string]
-
#waf.pagemap.permission.title=Permissions Page
#waf.pagemap.permission.purpose=Enter the relative URL for the main Permissions administration page
#waf.pagemap.permission.example=permissions/
Added: trunk/ccm-core/src/com/arsdigita/ui/login/DummyDispatcher.java
===================================================================
--- trunk/ccm-core/src/com/arsdigita/ui/login/DummyDispatcher.java (rev 0)
+++ trunk/ccm-core/src/com/arsdigita/ui/login/DummyDispatcher.java 2012-04-22 15:42:43 UTC (rev 2292)
@@ -0,0 +1,171 @@
+/*
+ * 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.ui.login;
+
+import com.arsdigita.bebop.page.BebopMapDispatcher;
+import com.arsdigita.bebop.Component;
+import com.arsdigita.bebop.ElementComponent;
+import com.arsdigita.bebop.SimpleContainer;
+import com.arsdigita.bebop.Label;
+import com.arsdigita.bebop.Page;
+import com.arsdigita.bebop.PageState;
+import com.arsdigita.bebop.PageFactory;
+import com.arsdigita.bebop.event.ActionListener;
+import com.arsdigita.bebop.event.ActionEvent;
+// import com.arsdigita.dispatcher.Dispatcher;
+// import com.arsdigita.dispatcher.DispatcherConfig;
+// import com.arsdigita.dispatcher.DispatcherHelper;
+// import com.arsdigita.dispatcher.RequestContext;
+import com.arsdigita.kernel.Kernel;
+// import com.arsdigita.kernel.security.LegacyInitializer;
+import com.arsdigita.ui.UI;
+import com.arsdigita.web.URL;
+import com.arsdigita.web.ParameterMap;
+import com.arsdigita.web.ReturnSignal;
+import com.arsdigita.web.RedirectSignal;
+
+import java.util.HashMap;
+import java.util.Map;
+import com.arsdigita.dispatcher.Dispatcher;
+import com.arsdigita.dispatcher.DispatcherConfig;
+import com.arsdigita.dispatcher.RequestContext;
+import java.io.IOException;
+import com.arsdigita.dispatcher.DispatcherHelper;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.ServletException;
+
+import org.apache.log4j.Logger;
+
+
+/**
+ * DummyDispatcher for the old acs-subsite package login package.
+ * Has to be deleted as soon as all application modules are legacy free!
+ *
+ * @author Sameer Ajmani
+ * @version $Id: SubsiteDispatcher.java 1225 2006-06-19 09:27:21Z apevec
+ **/
+public class DummyDispatcher extends BebopMapDispatcher {
+
+ public static final String APPLICATION_NAME = "login";
+
+ private static final Logger s_log =
+ Logger.getLogger(DummyDispatcher.class.getName());
+
+ // define namespace URI
+ final static String SUBSITE_NS_URI =
+ "http://www.arsdigita.com/subsite/1.0";
+
+ /** Dispatcher map class to store url - page mapping */
+ public class SubsiteDispatcherMap extends HashMap implements Map {
+
+ public SubsiteDispatcherMap() {
+ super();
+ // TODO Auto-generated constructor stub
+ }
+ }
+
+ /**
+ * Constructor initializes dispatcher by registering URLs with bebop pages.
+ */
+ public DummyDispatcher() {
+ s_log.debug("SubsiteDispatcher Constructor entered.");
+
+ Map map = new SubsiteDispatcherMap();
+
+ // special-case the empty URL
+// String redirect = LegacyInitializer.getURL(LegacyInitializer.ROOT_PAGE_KEY);
+ String redirect = UI.getRootPageURL();
+ Dispatcher root = new RedirectDispatcher(redirect);
+
+ map.put("", root);
+ map.put("index", root);
+
+
+ setMap(map);
+ }
+
+ /**
+ * Adds <url, page> to the given map. If the URL represents a directory
+ * (ends with "/"), URL+"index" is also added to the map and URL-"/" is
+ * redirected to URL.
+ **/
+ private void put(Map map, String url, Page page) {
+ // String url = LegacyInitializer.getURL(key);
+ if (url.startsWith("/")) {
+ // Currently the getter method provide a leading slash (API change)
+ // but the dispatcher needs an url without
+ // Needs to be checked when the old style sitenode based Dispatcher
+ // is eliminated.
+ url = url.substring(1);
+ }
+ map.put(url, page);
+ if (url.endsWith("/")) {
+ map.put(url+"index", page);
+ requireTrailingSlash(url.substring(0, url.length()-1));
+ }
+ }
+
+ @Override
+ protected void preprocessRequest(HttpServletRequest req,
+ HttpServletResponse resp,
+ RequestContext ctx,
+ String url) {
+ // Allow world caching for pages without authentication,
+ // ie, /register, /register/explain-persistent-cookies,
+ // /register/login-expired, /register/recover-password
+ // NB, although you'd think /register is cachable, it
+ // stores a timestamp in the login form :(
+ //
+ // url comes without leading "/" and we have to compensate for the
+ // leading slash provided by the UI.get... methods here.
+ if (("/"+url).equals(UI.getCookiesExplainPageURL()) ||
+ // ("/"+url).equals(UI.getLoginExpiredPageURL()) ||
+ ("/"+url).equals(UI.getRecoverPasswordPageURL()) ) {
+ DispatcherHelper.cacheForWorld(resp);
+ } else {
+ DispatcherHelper.cacheDisable(resp);
+ }
+ }
+
+
+
+ private class RedirectDispatcher implements Dispatcher {
+ private String m_path;
+
+ public RedirectDispatcher(String path) {
+ m_path = path;
+ }
+
+ public void dispatch(final HttpServletRequest req,
+ final HttpServletResponse resp,
+ final RequestContext actx)
+ throws IOException, ServletException {
+ // URL requires that its path argument start with a /,
+ // while the old dispatcher stuff assumes paths do not
+ // start with a slash. We translate.
+
+ final URL url = URL.there(req,
+ "/" + m_path,
+ new ParameterMap(req));
+
+ throw new RedirectSignal(url, false);
+ }
+ }
+}
Property changes on: trunk/ccm-core/src/com/arsdigita/ui/login/DummyDispatcher.java
___________________________________________________________________
Added: svn:executable
+
Added: trunk/ccm-core/src/com/arsdigita/ui/login/Login.java
===================================================================
--- trunk/ccm-core/src/com/arsdigita/ui/login/Login.java (rev 0)
+++ trunk/ccm-core/src/com/arsdigita/ui/login/Login.java 2012-04-22 15:42:43 UTC (rev 2292)
@@ -0,0 +1,112 @@
+/*
+ * Copyright (C) 2010 Peter Boy <pb...@ze...> All Rights Reserved.
+ *
+ * This library is free software; y...
[truncated message content] |