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 2007/05/14 16:59:01 UTC
svn commit: r537863 -
/lenya/trunk/src/java/org/apache/lenya/cms/cocoon/source/RepositorySource.java
Author: andreas
Date: Mon May 14 07:59:01 2007
New Revision: 537863
URL: http://svn.apache.org/viewvc?view=rev&rev=537863
Log:
RepositorySource: Apply revision parameter only if the source matches the source of the main document of the current request. This fixes bug 42394.
Modified:
lenya/trunk/src/java/org/apache/lenya/cms/cocoon/source/RepositorySource.java
Modified: lenya/trunk/src/java/org/apache/lenya/cms/cocoon/source/RepositorySource.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/cocoon/source/RepositorySource.java?view=diff&rev=537863&r1=537862&r2=537863
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/cocoon/source/RepositorySource.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/cocoon/source/RepositorySource.java Mon May 14 07:59:01 2007
@@ -33,18 +33,24 @@
import org.apache.avalon.framework.logger.Logger;
import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.cocoon.environment.Request;
import org.apache.excalibur.source.ModifiableTraversableSource;
import org.apache.excalibur.source.Source;
import org.apache.excalibur.source.SourceException;
import org.apache.excalibur.source.SourceNotFoundException;
import org.apache.excalibur.source.SourceValidity;
import org.apache.excalibur.source.impl.AbstractSource;
+import org.apache.lenya.cms.cocoon.components.context.ContextUtility;
+import org.apache.lenya.cms.publication.Document;
+import org.apache.lenya.cms.publication.Publication;
+import org.apache.lenya.cms.publication.PublicationUtil;
import org.apache.lenya.cms.repository.ContentHolder;
import org.apache.lenya.cms.repository.Node;
import org.apache.lenya.cms.repository.NodeFactory;
import org.apache.lenya.cms.repository.RepositoryException;
import org.apache.lenya.cms.repository.Session;
import org.apache.lenya.util.Query;
+import org.apache.lenya.util.ServletHelper;
/**
* Repository source.
@@ -113,7 +119,24 @@
Query query = new Query(uri.substring(questionMarkIndex + 1));
String revisionString = query.getValue("rev", null);
if (revisionString != null) {
- revisionNumber = Integer.valueOf(revisionString).intValue();
+
+ ContextUtility util = null;
+ try {
+ util = (ContextUtility) this.manager.lookup(ContextUtility.ROLE);
+ Request request = util.getRequest();
+ String webappUrl = ServletHelper.getWebappURI(request);
+
+ Publication pub = PublicationUtil.getPublication(this.manager, request);
+ Document currentDoc = pub.getFactory().getFromURL(webappUrl);
+ if (currentDoc.getSourceURI().equals(sourceUri)) {
+ revisionNumber = Integer.valueOf(revisionString).intValue();
+ }
+ }
+ finally {
+ if (util != null) {
+ this.manager.release(util);
+ }
+ }
}
}
else {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org