Fix zu r1520: Login funktioniert wieder.

git-svn-id: https://svn.libreccm.org/ccm/trunk@1521 8810af33-2d31-482b-a856-94f89814c4df
master
pb 2012-02-26 12:38:45 +00:00
parent 0171ad1c91
commit a1dd35d97d
6 changed files with 25 additions and 121 deletions

View File

@ -181,7 +181,7 @@ public class Loader extends PackageLoader {
public static ApplicationType loadWorkspaceApplicationType() {
s_log.debug("Creating CMS Workspace...");
/* Create new stype legacy compatible application type */
/* Create new type legacy compatible application type */
ApplicationType type = ApplicationType
.createApplicationType(Workspace.PACKAGE_KEY,
Workspace.INSTANCE_NAME,

View File

@ -1,108 +0,0 @@
/*
* Copyright (C) 2003-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.templating;
import com.arsdigita.dispatcher.DispatcherHelper;
import com.arsdigita.kernel.PackageInstance;
import com.arsdigita.kernel.SiteNode;
import com.arsdigita.kernel.Stylesheet;
import com.arsdigita.sitenode.SiteNodeRequestContext;
import com.arsdigita.util.UncheckedWrapperException;
import com.arsdigita.web.Web;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Locale;
import javax.servlet.http.HttpServletRequest;
import org.apache.log4j.Logger;
/**
* <p>
* This is the "legacy" stylesheet resolver class. It resolves stylesheets
* using the old packagetype <-> stylesheet and sitenode <-> stylesheet
* mappings in the database.
* </p>
* @version $Id: LegacyStylesheetResolver.java 287 2005-02-22 00:29:02Z sskracic $
*
* @deprecated use {@link PatternStylesheetResolver} in new code.
*/
public class LegacyStylesheetResolver implements StylesheetResolver {
private static final Logger s_log = Logger.getLogger
(LegacyStylesheetResolver.class);
public URL resolve(HttpServletRequest request) {
// TransactionContext tctx =
// SessionManager.getSession().getTransactionContext();
// boolean callerStartedTransaction = tctx.inTxn();
// if (!callerStartedTransaction)
// tctx.beginTxn();
// Get the site node.
final SiteNodeRequestContext context = (SiteNodeRequestContext)
DispatcherHelper.getRequestContext(request);
final Locale locale = context.getLocale();
final String output = context.getOutputType();
final SiteNode node = context.getSiteNode();
SiteNode sn = node;
Stylesheet ss = null;
while (sn != null && ss == null) {
// No style for this site node, but we can try the parent.
ss = sn.getStylesheet(locale, output);
sn = sn.getParent();
}
sn = node;
while (sn != null && ss == null) {
final PackageInstance pi = sn.getPackageInstance();
if (pi != null) {
ss = pi.getType().getStylesheet(locale, output);
}
sn = sn.getParent();
}
if (ss == null) {
throw new IllegalStateException
("No path to XSL stylesheet found");
}
// Get the actual path for the Stylesheet we've found.
final String filename = ss.getPath();
if (s_log.isDebugEnabled()) {
s_log.debug("Trying path " + filename);
}
try {
return new URL(Web.getConfig().getDefaultScheme(),
Web.getConfig().getHost().getName(),
Web.getConfig().getHost().getPort(),
filename);
} catch (MalformedURLException ex) {
throw new UncheckedWrapperException(ex);
}
}
}

View File

@ -23,6 +23,8 @@ import com.arsdigita.web.Web;
import com.arsdigita.util.StringUtils;
import com.arsdigita.dispatcher.DispatcherHelper;
import com.arsdigita.kernel.SiteNode;
import com.arsdigita.sitenode.SiteNodeRequestContext;
import com.arsdigita.util.Assert;
import com.arsdigita.web.Application;
@ -32,10 +34,9 @@ import org.apache.log4j.Logger;
/**
* Generates a set of pattern values based on the URL path info
* for the current request. Slashes in the request are
* translated into hyphens; the file extension is stripped;
* the any 'index' is removed, except for the top level.
* Generates a set of pattern values based on the URL path info for the current
* request. Slashes in the request are translated into hyphens; the file
* extension is stripped; any 'index' is removed, except for the top level.
*
* So some examples:
*
@ -52,6 +53,12 @@ public class URLPatternGenerator implements PatternGenerator {
private static final String DEFAULT_URL_MATCH = "index";
/**
*
* @param key
* @param req
* @return
*/
public String[] generateValues(String key,
HttpServletRequest req) {
String path = getPath();
@ -141,25 +148,30 @@ public class URLPatternGenerator implements PatternGenerator {
/**
* Provides the base URL of the application in the current Web request
* (i.e. application's PrimaryURL)
* (i.e. application's PrimaryURL). If no application can be found or
* no PrimaryURL can be determined ROOT ("/") is returned.
*
* XXX fix me, why can't we get this from Web.getConfig.getRequestURL
*
* @return primary url of an application
* @return primary url of an application or ROOT
*/
private String getBasePath() {
// OLD code using kernel.SiteNode etc which is deprecatged and no longer
// available
// SiteNodeRequestContext ctx = (SiteNodeRequestContext)
// DispatcherHelper.getRequestContext(Web.getRequest());
// SiteNode node = ctx.getSiteNode();
// Assert.exists(node, SiteNode.class);
// return node.getURL();
// SiteNodeRequestContext ctx = (SiteNodeRequestContext)
// DispatcherHelper.getRequestContext(Web.getRequest());
// SiteNode node = ctx.getSiteNode();
// Assert.exists(node, SiteNode.class);
// return node.getURL();
// retrieve the application of the request
Application app = Web.getContext().getApplication();
if (app == null) {
return "/";
} else {
return app.getPrimaryURL();
}
}
}