cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r422647 - /cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/RequestUtil.java
Date Mon, 17 Jul 2006 07:33:18 GMT
Author: cziegeler
Date: Mon Jul 17 00:33:15 2006
New Revision: 422647

URL: http://svn.apache.org/viewvc?rev=422647&view=rev
Log:
New utility method

Modified:
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/RequestUtil.java

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/RequestUtil.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/RequestUtil.java?rev=422647&r1=422646&r2=422647&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/RequestUtil.java
(original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/RequestUtil.java
Mon Jul 17 00:33:15 2006
@@ -78,6 +78,19 @@
         return new HttpServletRequestImpl(request, servletPath, pathInfo);
     }
 
+    public static HttpServletRequest createRequestByRemovingPrefixFromUri(HttpServletRequest
request, String prefix) {
+        String servletPath = request.getServletPath();
+        String pathInfo = request.getPathInfo();
+        String newPathInfo = pathInfo.substring(prefix.length()+1);
+        String newServletPath;
+        if ( servletPath == null ) {
+            newServletPath = pathInfo.substring(0, prefix.length()+1);
+        } else {
+            newServletPath = servletPath + pathInfo.substring(0, prefix.length()+1);
+        }
+        return new HttpServletRequestImpl(request, newServletPath, newPathInfo);
+    }
+
     protected static final class HttpServletRequestImpl extends HttpServletRequestWrapper
{
 
         final private String servletPath;



Mime
View raw message