You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cz...@apache.org on 2015/06/12 14:52:01 UTC
svn commit: r1685080 -
/felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/dispatch/Dispatcher.java
Author: cziegeler
Date: Fri Jun 12 12:52:01 2015
New Revision: 1685080
URL: http://svn.apache.org/r1685080
Log:
FELIX-4925 : Request path is not decoded
Modified:
felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/dispatch/Dispatcher.java
Modified: felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/dispatch/Dispatcher.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/dispatch/Dispatcher.java?rev=1685080&r1=1685079&r2=1685080&view=diff
==============================================================================
--- felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/dispatch/Dispatcher.java (original)
+++ felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/dispatch/Dispatcher.java Fri Jun 12 12:52:01 2015
@@ -31,8 +31,6 @@ import static org.apache.felix.http.base
import static org.apache.felix.http.base.internal.util.UriUtils.removeDotSegments;
import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
@@ -580,28 +578,22 @@ public final class Dispatcher implements
this.whiteboardManager.sessionDestroyed(session, ids);
}
- // get full requested path
- // we can't use req.getRequestURI() as this is returning the encoded path
- String path = "";
- try
+ // get full path
+ // we can't use req.getRequestURI() or req.getRequestURL() as these are returning the encoded path
+ String path = req.getServletPath();
+ if ( path == null )
{
- final URL url = new URL(req.getRequestURL().toString());
- path = UriUtils.relativePath(req.getContextPath(), url.getPath());
-
+ path = "";
}
- catch (final MalformedURLException mue)
+ if ( req.getPathInfo() != null )
{
- // we ignore this and revert to servlet path and path info
- path = req.getServletPath();
- if ( path == null )
- {
- path = "";
- }
- if ( req.getPathInfo() != null )
- {
- path = path.concat(req.getPathInfo());
- }
-
+ path = path.concat(req.getPathInfo());
+ }
+ // Workaround to get path parameters (FELIX-4925)
+ // This fails if the path part contains encoded characters!
+ if ( req.getRequestURI().contains(";") )
+ {
+ path = UriUtils.relativePath(req.getContextPath(), req.getRequestURI());
}
final String requestURI = path;