You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by vg...@apache.org on 2005/06/28 21:03:17 UTC

svn commit: r202268 - in /cocoon/trunk: ./ src/java/org/apache/cocoon/environment/ src/java/org/apache/cocoon/environment/commandline/ src/java/org/apache/cocoon/environment/http/ src/java/org/apache/cocoon/environment/wrapper/ src/test/org/apache/coco...

Author: vgritsenko
Date: Tue Jun 28 12:03:15 2005
New Revision: 202268

URL: http://svn.apache.org/viewcvs?rev=202268&view=rev
Log:
    <action dev="VG" type="add" fixes-bug="35435" due-to="Nico Verwer" due-to-email="nverwer@email.com">
      Added getSitemapURIPrefix method to the Request interface.
    </action>


Modified:
    cocoon/trunk/src/java/org/apache/cocoon/environment/Request.java
    cocoon/trunk/src/java/org/apache/cocoon/environment/commandline/CommandLineRequest.java
    cocoon/trunk/src/java/org/apache/cocoon/environment/http/HttpRequest.java
    cocoon/trunk/src/java/org/apache/cocoon/environment/wrapper/RequestWrapper.java
    cocoon/trunk/src/test/org/apache/cocoon/environment/mock/MockRequest.java
    cocoon/trunk/status.xml

Modified: cocoon/trunk/src/java/org/apache/cocoon/environment/Request.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/environment/Request.java?rev=202268&r1=202267&r2=202268&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/environment/Request.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/environment/Request.java Tue Jun 28 12:03:15 2005
@@ -1,12 +1,12 @@
 /*
- * Copyright 1999-2004 The Apache Software Foundation.
- * 
+ * Copyright 1999-2005 The Apache Software Foundation.
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -39,10 +39,8 @@
  * @author <a href="mailto:dims@yahoo.com">Davanum Srinivas</a>
  * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
  * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
- * @version CVS $Id$
- *
+ * @version $Id$
  */
-
 public interface Request {
 
     /**
@@ -79,6 +77,7 @@
      *                        the parameter does not exist
      *
      */
+
     Object get(String name);
 
     /**
@@ -259,6 +258,7 @@
      *                        protect the servlet, or null if the servlet was
      *                        not protected
      */
+
     String getAuthType();
 
     /**
@@ -275,10 +275,11 @@
 
     String getCharacterEncoding();
 
-     /**
+    /**
      * Overrides the charactor encoding of parameters.
      *
      * @throws java.io.UnsupportedEncodingException if this is not a valid encoding.
+     *
      */
 
     void setCharacterEncoding(String enc) throws java.io.UnsupportedEncodingException;
@@ -850,6 +851,19 @@
 
     /**
      * <p>
+     * Returns the URI Prefix of the requested resource where the sitemap is mounted.
+     * For example, if your webapp is mounted at "/webapp" and the HTTP request
+     * is for "/webapp/foo", this method returns "webapp/".
+     * </p>
+     *
+     * @return a <code>String</code> containing the URI prefix as mangled by the
+     *         sitemap
+     */
+
+    String getSitemapURIPrefix();
+
+    /**
+     * <p>
      * Returns the path to the sitemap of the requested resource as interpreted 
      * by the sitemap.
      * For example, if your webapp is mounted at "webapp" and the HTTP request
@@ -860,6 +874,7 @@
      * @return a <code>String</code> containing the path to the sitemap
      * @since 2.2
      */
+
     String getSitemapPath();
     
     /**

Modified: cocoon/trunk/src/java/org/apache/cocoon/environment/commandline/CommandLineRequest.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/environment/commandline/CommandLineRequest.java?rev=202268&r1=202267&r2=202268&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/environment/commandline/CommandLineRequest.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/environment/commandline/CommandLineRequest.java Tue Jun 28 12:03:15 2005
@@ -1,12 +1,12 @@
 /*
- * Copyright 1999-2004 The Apache Software Foundation.
- * 
+ * Copyright 1999-2005 The Apache Software Foundation.
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -37,7 +37,7 @@
  *
  * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
- * @version CVS $Id$
+ * @version $Id$
  */
 
 /*
@@ -109,7 +109,7 @@
     /* (non-Javadoc)
      * @see org.apache.cocoon.environment.Request#get(java.lang.String)
      */
-    public Object get(String name) { 
+    public Object get(String name) {
         String[] values = this.getParameterValues(name);
         if (values == null || values.length == 0) {
             return null;
@@ -138,7 +138,9 @@
     public String getSitemapURI() {
         return this.env.getURI();
     }
-    
+    public String getSitemapURIPrefix() {
+        return this.env.getURIPrefix();
+    }
     /* (non-Javadoc)
      * @see org.apache.cocoon.environment.Request#getSitemapPath()
      */
@@ -223,7 +225,7 @@
         if (this.parameters == null) {
             return null;
         }
-        
+
         final Object value = this.parameters.get(name);
         if (value instanceof String) {
             return (String)value;
@@ -261,14 +263,13 @@
 
     public long getDateHeader(String name) {
         //FIXME
-        //throw new RuntimeException (this.getClass().getName() + ".getDateHeader(String name) method not yet implemented!");
         return 0;
     }
 
     public Enumeration getHeaders(String name) {
-        //throw new RuntimeException (this.getClass().getName() + ".getHeaders(String name) method not yet implemented!");
+        // FIXME
         return new EmptyEnumeration();
-    } // FIXME
+    }
 
     public Enumeration getHeaderNames() {
         if (headers != null) {
@@ -404,8 +405,9 @@
 
     public Locale getLocale() { return Locale.getDefault(); }
     public Enumeration getLocales() {
+        // FIXME
         throw new RuntimeException (getClass().getName() + ".getLocales() method not yet implemented!");
-    } // FIXME
+    }
 
     public String getAuthType() { return null; }
     public boolean isSecure() { return false; }

Modified: cocoon/trunk/src/java/org/apache/cocoon/environment/http/HttpRequest.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/environment/http/HttpRequest.java?rev=202268&r1=202267&r2=202268&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/environment/http/HttpRequest.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/environment/http/HttpRequest.java Tue Jun 28 12:03:15 2005
@@ -1,12 +1,12 @@
 /*
- * Copyright 1999-2004 The Apache Software Foundation.
- * 
+ * Copyright 1999-2005 The Apache Software Foundation.
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -43,9 +43,8 @@
  * to provide request information in the HTTP servlets environment.
  *
  * @author <a href="mailto:giacomo@apache.org">Giacomo Pati</a>
- * @version CVS $Id$
+ * @version $Id$
  */
-
 public final class HttpRequest extends AbstractRequest {
 
     /** The real HttpServletRequest object */
@@ -216,6 +215,10 @@
      */
     public String getSitemapURI() {
         return this.env.getURI();
+    }
+
+    public String getSitemapURIPrefix() {
+        return this.env.getURIPrefix();
     }
 
     /* (non-Javadoc)

Modified: cocoon/trunk/src/java/org/apache/cocoon/environment/wrapper/RequestWrapper.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/environment/wrapper/RequestWrapper.java?rev=202268&r1=202267&r2=202268&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/environment/wrapper/RequestWrapper.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/environment/wrapper/RequestWrapper.java Tue Jun 28 12:03:15 2005
@@ -1,12 +1,12 @@
 /*
- * Copyright 1999-2004 The Apache Software Foundation.
- * 
+ * Copyright 1999-2005 The Apache Software Foundation.
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -26,14 +26,13 @@
 import org.apache.cocoon.environment.Request;
 import org.apache.commons.collections.IteratorUtils;
 
-
 /**
  * This is a wrapper class for the <code>Request</code> object.
  * It has the same properties except that the url and the parameters
  * are different.
  *
  * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
- * @version CVS $Id$
+ * @version $Id$
  */
 public final class RequestWrapper extends AbstractRequestWrapper {
 
@@ -51,7 +50,7 @@
 
     /** The request uri */
     private String requestURI;
-    
+
     private final Map requestAttributes = new HashMap();
     
     /**
@@ -165,6 +164,10 @@
      */
     public String getSitemapURI() {
         return this.environment.getURI();
+    }
+
+    public String getSitemapURIPrefix() {
+        return this.environment.getURIPrefix();
     }
 
     /* (non-Javadoc)

Modified: cocoon/trunk/src/test/org/apache/cocoon/environment/mock/MockRequest.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/test/org/apache/cocoon/environment/mock/MockRequest.java?rev=202268&r1=202267&r2=202268&view=diff
==============================================================================
--- cocoon/trunk/src/test/org/apache/cocoon/environment/mock/MockRequest.java (original)
+++ cocoon/trunk/src/test/org/apache/cocoon/environment/mock/MockRequest.java Tue Jun 28 12:03:15 2005
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2005 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -37,6 +37,9 @@
 import org.apache.cocoon.environment.Session;
 import org.apache.cocoon.environment.impl.AbstractRequest;
 
+/**
+ * @version $Id$
+ */
 public class MockRequest extends AbstractRequest {
     
     private Hashtable attributes = new Hashtable();
@@ -285,6 +288,10 @@
         return this.environment.getURIPrefix();
     }
 
+    public String getSitemapURIPrefix() {
+        return "";
+    }
+
     public String getServletPath() {
         return servletPath;
     }
@@ -352,15 +359,15 @@
         parameters.clear();
         headers.clear();
     }
-    
+
     public void setHeader( String key, String value ) {
         this.headers.put(key, value );
     }
-    
+
     public void setMethod( String method ) {
         this.method = method;
     }
-    
+
     public void clearSession() {
         this.session = null;
     }

Modified: cocoon/trunk/status.xml
URL: http://svn.apache.org/viewcvs/cocoon/trunk/status.xml?rev=202268&r1=202267&r2=202268&view=diff
==============================================================================
--- cocoon/trunk/status.xml (original)
+++ cocoon/trunk/status.xml Tue Jun 28 12:03:15 2005
@@ -480,6 +480,9 @@
    </action>
   </release>
   <release version="2.1.8" date="TBD">
+    <action dev="VG" type="add" fixes-bug="35435" due-to="Nico Verwer" due-to-email="nverwer@email.com">
+      Added getSitemapURIPrefix method to the Request interface.
+    </action>
     <action dev="AG" type="update">
       Updated commons-digester to 1.7, commons-lang to 2.1, xercesImpl to 2.7.0.
     </action>