You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2005/03/16 14:57:00 UTC
svn commit: r157749 -
lenya/trunk/src/java/org/apache/lenya/cms/cocoon/source/FallbackSourceFactory.java
Author: andreas
Date: Wed Mar 16 05:56:58 2005
New Revision: 157749
URL: http://svn.apache.org/viewcvs?view=rev&rev=157749
Log:
fallback source factory works now for non-publication URLs
Modified:
lenya/trunk/src/java/org/apache/lenya/cms/cocoon/source/FallbackSourceFactory.java
Modified: lenya/trunk/src/java/org/apache/lenya/cms/cocoon/source/FallbackSourceFactory.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/cocoon/source/FallbackSourceFactory.java?view=diff&r1=157748&r2=157749
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/cocoon/source/FallbackSourceFactory.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/cocoon/source/FallbackSourceFactory.java Wed Mar 16 05:56:58 2005
@@ -39,6 +39,7 @@
import org.apache.excalibur.source.URIAbsolutizer;
import org.apache.lenya.cms.publication.Publication;
import org.apache.lenya.cms.publication.PublicationFactory;
+import org.apache.lenya.cms.publication.URLInformation;
import org.apache.lenya.cms.publication.templating.ExistingSourceResolver;
import org.apache.lenya.cms.publication.templating.PublicationTemplateManager;
import org.apache.lenya.cms.usecase.AbstractOperation;
@@ -103,12 +104,18 @@
String webappUrl = request.getRequestURI().substring(request.getContextPath().length());
PublicationFactory factory = PublicationFactory.getInstance(getLogger());
- Publication pub = factory.getPublication(webappUrl, SourceUtil.getFile(contextSource));
- templateManager.setup(pub);
-
- ExistingSourceResolver resolver = new ExistingSourceResolver();
- templateManager.visit(path, resolver);
- resolvedUri = resolver.getURI();
+
+ String contextPath = SourceUtil.getFile(contextSource).getAbsolutePath();
+ URLInformation info = new URLInformation(webappUrl);
+ String publicationId = info.getPublicationId();
+
+ if (publicationId != null && PublicationFactory.existsPublication(publicationId, contextPath)) {
+ Publication pub = factory.getPublication(publicationId, contextPath);
+ templateManager.setup(pub);
+ ExistingSourceResolver resolver = new ExistingSourceResolver();
+ templateManager.visit(path, resolver);
+ resolvedUri = resolver.getURI();
+ }
if (getLogger().isDebugEnabled()) {
getLogger().debug("Resolved URI: [" + resolvedUri + "]");
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org