You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by ba...@apache.org on 2001/05/04 21:03:07 UTC
cvs commit: xml-cocoon/src/org/apache/cocoon/matching RegexpURIMatcherFactory.java WildcardURIMatcherFactory.java
balld 01/05/04 12:03:06
Modified: src/org/apache/cocoon/components/language/markup/xsp Tag:
xml-cocoon2 XSPRequestHelper.java
src/org/apache/cocoon/components/language/markup/xsp/java
Tag: xml-cocoon2 request.xsl
src/org/apache/cocoon/environment Tag: xml-cocoon2
Request.java
src/org/apache/cocoon/environment/commandline Tag:
xml-cocoon2 CommandLineRequest.java
src/org/apache/cocoon/environment/http Tag: xml-cocoon2
HttpRequest.java
src/org/apache/cocoon/matching Tag: xml-cocoon2
RegexpURIMatcherFactory.java
WildcardURIMatcherFactory.java
Log:
a patch to make Request.getRequestURI actually do what it claims to do again, and adds a Request.getSitemapURI method for components to ask for the c2 sitemap URI of the site being processed.
Revision Changes Path
No revision
No revision
1.1.2.19 +14 -4 xml-cocoon/src/org/apache/cocoon/components/language/markup/xsp/Attic/XSPRequestHelper.java
Index: XSPRequestHelper.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/markup/xsp/Attic/XSPRequestHelper.java,v
retrieving revision 1.1.2.18
retrieving revision 1.1.2.19
diff -u -r1.1.2.18 -r1.1.2.19
--- XSPRequestHelper.java 2001/04/30 20:39:54 1.1.2.18
+++ XSPRequestHelper.java 2001/05/04 19:02:38 1.1.2.19
@@ -21,7 +21,7 @@
* The <code>Request</code> object helper
*
* @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
- * @version CVS $Revision: 1.1.2.18 $ $Date: 2001/04/30 20:39:54 $
+ * @version CVS $Revision: 1.1.2.19 $ $Date: 2001/05/04 19:02:38 $
*/
public class XSPRequestHelper extends XSPObjectHelper {
/**
@@ -39,14 +39,14 @@
* @param contentHandler The SAX content handler
* @exception SAXException If a SAX error occurs
*/
- public static void getUri(
+ public static void getRequestURI(
Map objectModel,
ContentHandler contentHandler
)
throws SAXException
{
Request request = (Request)objectModel.get(Constants.REQUEST_OBJECT);
- elementData(contentHandler, "uri", request.getRequestURI());
+ elementData(contentHandler, "request-uri", request.getRequestURI());
}
/**
@@ -54,12 +54,22 @@
*
* @param objectModel The Map objectModel
*/
- public static String getUri(
+ public static String getURI(
Map objectModel
)
{
Request request = (Request)objectModel.get(Constants.REQUEST_OBJECT);
return request.getRequestURI();
+ }
+
+ /**
+ * Outputs the sitemap uri associated with the given objectModel
+ *
+ * @param objectModel the Map objectModel
+ */
+ public static String getSitemapURI(Map objectModel) {
+ Request request = (Request)objectModel.get(Constants.REQUEST_OBJECT);
+ return request.getSitemapURI();
}
/**
No revision
No revision
1.1.2.13 +4 -4 xml-cocoon/src/org/apache/cocoon/components/language/markup/xsp/java/Attic/request.xsl
Index: request.xsl
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/markup/xsp/java/Attic/request.xsl,v
retrieving revision 1.1.2.12
retrieving revision 1.1.2.13
diff -u -r1.1.2.12 -r1.1.2.13
--- request.xsl 2001/04/30 20:40:01 1.1.2.12
+++ request.xsl 2001/05/04 19:02:43 1.1.2.13
@@ -11,7 +11,7 @@
<!--
* @author <a href="mailto:ricardo@apache.org>Ricardo Rocha</a>
- * @version CVS $Revision: 1.1.2.12 $ $Date: 2001/04/30 20:40:01 $
+ * @version CVS $Revision: 1.1.2.13 $ $Date: 2001/05/04 19:02:43 $
-->
<!-- XSP Request logicsheet for the Java language -->
@@ -32,13 +32,13 @@
<xsl:choose>
<xsl:when test="$as = 'string'">
<xsp:expr>
- (XSPRequestHelper.getUri(objectModel))
+ (XSPRequestHelper.getURI(objectModel))
</xsp:expr>
</xsl:when>
<xsl:when test="$as = 'xml'">
<!-- <xsp-request:uri> -->
<xsp:logic>
- XSPRequestHelper.getUri(objectModel, this.contentHandler);
+ XSPRequestHelper.getURI(objectModel, this.contentHandler);
</xsp:logic>
</xsl:when>
</xsl:choose>
@@ -411,4 +411,4 @@
</xsl:copy>
</xsl:template>
- </xsl:stylesheet>
\ No newline at end of file
+ </xsl:stylesheet>
No revision
No revision
1.1.2.5 +20 -1 xml-cocoon/src/org/apache/cocoon/environment/Attic/Request.java
Index: Request.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/environment/Attic/Request.java,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -r1.1.2.4 -r1.1.2.5
--- Request.java 2001/04/25 17:07:02 1.1.2.4
+++ Request.java 2001/05/04 19:02:48 1.1.2.5
@@ -18,7 +18,7 @@
*
* @author <a href="mailto:dims@yahoo.com">Davanum Srinivas</a>
* @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
- * @version CVS $Revision: 1.1.2.4 $ $Date: 2001/04/25 17:07:02 $
+ * @version CVS $Revision: 1.1.2.5 $ $Date: 2001/05/04 19:02:48 $
*
*/
@@ -595,6 +595,25 @@
*/
String getRequestURI();
+
+ /**
+ * <p>
+ * Returns the URI of the requested resource as interpreted by the sitemap.
+ * For example, if your webapp is mounted at "/webapp" and the HTTP request
+ * is for "/webapp/foo", this method returns "foo". Consequently, if the
+ * request is for "/webapp", this method returns an empty string.
+ * </p>
+ * <p>
+ * Note that if the request is mapped to a pipeline that contains
+ * aggregated content, and if this method is called in the context of
+ * one of the aggregated parts (e.g. a server page), this method will
+ * return the URI of the aggregated part, not the original requested URI.
+ * </p>
+ *
+ * @return a <code>String</code> containing the URL as mangled by the
+ * sitemap
+ */
+ String getSitemapURI();
/**
*
No revision
No revision
1.1.2.14 +5 -1 xml-cocoon/src/org/apache/cocoon/environment/commandline/Attic/CommandLineRequest.java
Index: CommandLineRequest.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/environment/commandline/Attic/CommandLineRequest.java,v
retrieving revision 1.1.2.13
retrieving revision 1.1.2.14
diff -u -r1.1.2.13 -r1.1.2.14
--- CommandLineRequest.java 2001/04/25 17:07:12 1.1.2.13
+++ CommandLineRequest.java 2001/05/04 19:02:52 1.1.2.14
@@ -24,7 +24,7 @@
* Creates a specific servlet request simulation from command line usage.
*
* @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
- * @version CVS $Revision: 1.1.2.13 $ $Date: 2001/04/25 17:07:12 $
+ * @version CVS $Revision: 1.1.2.14 $ $Date: 2001/05/04 19:02:52 $
*/
/*
@@ -95,6 +95,10 @@
if (contextPath != null) buffer.append(contextPath);
if (pathInfo != null) buffer.append(pathInfo);
return buffer.toString();
+ }
+ // FIXME
+ public String getSitemapURI() {
+ return "";
}
public String getQueryString() { return null; } // use parameters instead
public String getPathTranslated() { return null; } // FIXME (SM) this is legal but should we do something more?
No revision
No revision
1.1.2.12 +5 -1 xml-cocoon/src/org/apache/cocoon/environment/http/Attic/HttpRequest.java
Index: HttpRequest.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/environment/http/Attic/HttpRequest.java,v
retrieving revision 1.1.2.11
retrieving revision 1.1.2.12
diff -u -r1.1.2.11 -r1.1.2.12
--- HttpRequest.java 2001/04/25 17:07:24 1.1.2.11
+++ HttpRequest.java 2001/05/04 19:02:56 1.1.2.12
@@ -25,7 +25,7 @@
* to provide request information for HTTP servlets.
*
* @author <a href="mailto:giacomo@apache,org">Giacomo Pati</a>
- * @version CVS $Id: HttpRequest.java,v 1.1.2.11 2001/04/25 17:07:24 donaldp Exp $
+ * @version CVS $Id: HttpRequest.java,v 1.1.2.12 2001/05/04 19:02:56 balld Exp $
*/
public class HttpRequest implements Request {
@@ -148,6 +148,10 @@
}
public String getRequestURI() {
+ return this.req.getRequestURI();
+ }
+
+ public String getSitemapURI() {
return this.env.getURI();
}
No revision
No revision
1.1.2.29 +2 -2 xml-cocoon/src/org/apache/cocoon/matching/Attic/RegexpURIMatcherFactory.java
Index: RegexpURIMatcherFactory.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/matching/Attic/RegexpURIMatcherFactory.java,v
retrieving revision 1.1.2.28
retrieving revision 1.1.2.29
diff -u -r1.1.2.28 -r1.1.2.29
--- RegexpURIMatcherFactory.java 2001/04/30 14:17:30 1.1.2.28
+++ RegexpURIMatcherFactory.java 2001/05/04 19:03:01 1.1.2.29
@@ -21,7 +21,7 @@
*
* @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
* @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
- * @version CVS $Revision: 1.1.2.28 $ $Date: 2001/04/30 14:17:30 $
+ * @version CVS $Revision: 1.1.2.29 $ $Date: 2001/05/04 19:03:01 $
*/
public class RegexpURIMatcherFactory extends AbstractLoggable implements CodeFactory {
@@ -90,7 +90,7 @@
throws ConfigurationException {
StringBuffer sb = new StringBuffer ();
sb.append("HashMap map = new HashMap ();")
- .append("String uri = XSPRequestHelper.getUri(objectModel);")
+ .append("String uri = XSPRequestHelper.getSitemapURI(objectModel);")
.append("if(uri.startsWith(\"/\")) uri = uri.substring(1);")
.append("if(pattern.match(uri)) {");
/* Handle parenthesised subexpressions. XXX: could be faster if we count
1.1.2.37 +2 -2 xml-cocoon/src/org/apache/cocoon/matching/Attic/WildcardURIMatcherFactory.java
Index: WildcardURIMatcherFactory.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/matching/Attic/WildcardURIMatcherFactory.java,v
retrieving revision 1.1.2.36
retrieving revision 1.1.2.37
diff -u -r1.1.2.36 -r1.1.2.37
--- WildcardURIMatcherFactory.java 2001/04/30 14:17:30 1.1.2.36
+++ WildcardURIMatcherFactory.java 2001/05/04 19:03:03 1.1.2.37
@@ -19,7 +19,7 @@
* @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
* @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
* @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
- * @version CVS $Revision: 1.1.2.36 $ $Date: 2001/04/30 14:17:30 $
+ * @version CVS $Revision: 1.1.2.37 $ $Date: 2001/05/04 19:03:03 $
*/
public class WildcardURIMatcherFactory extends AbstractLoggable implements CodeFactory {
@@ -52,7 +52,7 @@
public String generateMethodSource (NodeList conf)
throws ConfigurationException {
return "HashMap map = new HashMap();" +
- "String uri = XSPRequestHelper.getUri(objectModel);" +
+ "String uri = XSPRequestHelper.getSitemapURI(objectModel);" +
"if (uri.startsWith(\"/\")) uri = uri.substring(1);" +
"if (org.apache.cocoon.matching.helpers.WildcardURIMatcher.match (map, uri, pattern)) {" +
"return map;" +
----------------------------------------------------------------------
In case of troubles, e-mail: webmaster@xml.apache.org
To unsubscribe, e-mail: cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org