You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by an...@apache.org on 2004/09/23 10:25:05 UTC
svn commit: rev 47090 - cocoon/trunk/src/java/org/apache/cocoon/components/source/impl
Author: andreas
Date: Thu Sep 23 01:25:03 2004
New Revision: 47090
Modified:
cocoon/trunk/src/java/org/apache/cocoon/components/source/impl/SitemapSource.java
cocoon/trunk/src/java/org/apache/cocoon/components/source/impl/SitemapSourceInfo.java
Log:
added some javadocs, added SitemapSourceInfo.processFromRoot field (fixes bug #31363)
Modified: cocoon/trunk/src/java/org/apache/cocoon/components/source/impl/SitemapSource.java
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/components/source/impl/SitemapSource.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/components/source/impl/SitemapSource.java Thu Sep 23 01:25:03 2004
@@ -121,7 +121,7 @@
this.protocol = info.protocol;
// does the uri point to this sitemap or to the root sitemap?
- if (info.prefix.length() == 0) {
+ if (info.processFromRoot) {
this.processor = EnvironmentHelper.getCurrentProcessor().getRootProcessor();
} else {
this.processor = EnvironmentHelper.getCurrentProcessor();
Modified: cocoon/trunk/src/java/org/apache/cocoon/components/source/impl/SitemapSourceInfo.java
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/components/source/impl/SitemapSourceInfo.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/components/source/impl/SitemapSourceInfo.java Thu Sep 23 01:25:03 2004
@@ -24,19 +24,52 @@
* This is a helper class for the cocoon protocol.
*
* @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
- * @version CVS $Id: SitemapSourceInfo.java,v 1.1 2004/05/25 07:28:24 cziegeler Exp $
+ * @version CVS $Id$
*/
public final class SitemapSourceInfo {
+ /**
+ * <ul>
+ * <li><code>true</code> if the sitemap URI uses the <code>raw:</code> subprotocol,
+ * which means that request parameters of the original request are not forwarded,</li>
+ * <li><code>false</code> otherwise.
+ * </ul>
+ */
public boolean rawMode;
+
+ /** The protocol used in the sitemap URI, up to and excluding the colon. */
public String protocol;
+
+ /** The request URI, relative to the context. */
public String requestURI;
+
+ /** The system ID: <protocol><request-uri>[?<query-string>]. */
public String systemId;
+
+ /** The Cocoon view used in the sitemap URI or <code>null</code> if no view is used. */
public String view;
+
+ /**
+ * The prefix of the URI in progress for <code>cocoon:/</code> requests,
+ * or an empty string for <code>cocoon://</code> requests.
+ */
public String prefix;
+
+ /** The query string of the sitemap URI. */
public String queryString;
- public String uri;
+ /** The sitemap URI without protocol identifier and query string. */
+ public String uri;
+
+ /**
+ * Determine the initial processor for the cocoon protocol request.
+ * <ul>
+ * <li><code>true</code> - start in the root sitemap (<code>cocoon://</code>)</li>
+ * <li><code>false</code> - start in the current sitemap (<code>cocoon:/</code>)</li>
+ * </ul>
+ */
+ public boolean processFromRoot;
+
public static SitemapSourceInfo parseURI(Environment env, String sitemapURI)
throws MalformedURLException {
SitemapSourceInfo info = new SitemapSourceInfo();
@@ -58,10 +91,12 @@
// does the uri point to this sitemap or to the root sitemap?
if (sitemapURI.startsWith("//", position)) {
position += 2;
- info.prefix = ""; // start at the root
+ info.prefix = "";
+ info.processFromRoot = true;
} else if (sitemapURI.startsWith("/", position)) {
position ++;
info.prefix = env.getURIPrefix();
+ info.processFromRoot = false;
} else {
throw new MalformedURLException("Malformed cocoon URI: " + sitemapURI);
}