Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/DispatchingTest.java57
-rw-r--r--bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/registration/FilterRegistration.java7
-rw-r--r--bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/registration/MatchableRegistration.java36
-rw-r--r--bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/registration/ResourceRegistration.java7
-rw-r--r--bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/registration/ServletRegistration.java7
-rw-r--r--bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/servlet/ProxyServlet.java6
6 files changed, 7 insertions, 113 deletions
diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/DispatchingTest.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/DispatchingTest.java
index a3711f5c..c9a9990d 100644
--- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/DispatchingTest.java
+++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/DispatchingTest.java
@@ -1576,61 +1576,4 @@ public class DispatchingTest extends BaseTest {
Assert.assertEquals(10, counter.get());
}
- @Test
- public void test_Bug497510_1() throws Exception {
- Servlet servlet = new HttpServlet() {
- private static final long serialVersionUID = 1L;
-
- @Override
- protected void doGet(
- final HttpServletRequest req, final HttpServletResponse resp)
- throws ServletException, IOException {
-
- String requestURI = req.getRequestURI();
-
- Assert.assertNotNull(requestURI);
-
- PrintWriter writer = resp.getWriter();
- writer.write(requestURI);
- }
- };
-
- Dictionary<String, Object> props = new Hashtable<String, Object>();
- props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "Bug497510");
- props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/Bug497510/*");
- registrations.add(getBundleContext().registerService(Servlet.class, servlet, props));
-
- String result = requestAdvisor.request("Bug497510/a%20b%20c");
-
- Assert.assertEquals("/Bug497510/a%20b%20c", result);
- }
-
- @Test
- public void test_Bug497510_2() throws Exception {
- Servlet servlet = new HttpServlet() {
- private static final long serialVersionUID = 1L;
-
- @Override
- protected void doGet(
- final HttpServletRequest req, final HttpServletResponse resp)
- throws ServletException, IOException {
-
- String requestURI = req.getRequestURI();
-
- Assert.assertNotNull(requestURI);
-
- PrintWriter writer = resp.getWriter();
- writer.write(requestURI);
- }
- };
-
- Dictionary<String, Object> props = new Hashtable<String, Object>();
- props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "Bug 497510");
- props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/Bug 497510/*");
- registrations.add(getBundleContext().registerService(Servlet.class, servlet, props));
-
- String result = requestAdvisor.request("Bug%20497510/a%20b%20c");
-
- Assert.assertEquals("/Bug%20497510/a%20b%20c", result);
- }
} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/registration/FilterRegistration.java b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/registration/FilterRegistration.java
index 5e68ec68..27975ca8 100644
--- a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/registration/FilterRegistration.java
+++ b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/registration/FilterRegistration.java
@@ -38,7 +38,6 @@ public class FilterRegistration
private final ContextController contextController;
private final boolean initDestoyWithContextController;
private final Pattern[] compiledRegexs;
- private final boolean needDecode;
public FilterRegistration(
ServiceHolder<Filter> filterHolder, FilterDTO filterDTO, int priority,
@@ -71,7 +70,6 @@ public class FilterRegistration
} else {
initDestoyWithContextController = true;
}
- needDecode = MatchableRegistration.patternsRequireDecode(filterDTO.patterns);
}
public int compareTo(FilterRegistration otherFilterRegistration) {
@@ -274,9 +272,4 @@ public class FilterRegistration
return patterns;
}
- @Override
- public boolean needDecode() {
- return needDecode;
- }
-
}
diff --git a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/registration/MatchableRegistration.java b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/registration/MatchableRegistration.java
index 4da830e5..94143788 100644
--- a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/registration/MatchableRegistration.java
+++ b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/registration/MatchableRegistration.java
@@ -11,9 +11,6 @@
package org.eclipse.equinox.http.servlet.internal.registration;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
-import java.net.URLEncoder;
import org.eclipse.equinox.http.servlet.internal.servlet.Match;
import org.eclipse.equinox.http.servlet.internal.util.Const;
import org.osgi.dto.DTO;
@@ -28,14 +25,12 @@ public abstract class MatchableRegistration<T, D extends DTO>
super(t, d);
}
- public abstract boolean needDecode();
-
public abstract String match(
String name, String servletPath, String pathInfo, String extension,
Match match);
- private boolean isPathWildcardMatch(
- String pattern, String servletPath) {
+ protected boolean isPathWildcardMatch(
+ String pattern, String servletPath, String pathInfo) {
int cpl = pattern.length() - 2;
@@ -52,18 +47,11 @@ public abstract class MatchableRegistration<T, D extends DTO>
return false;
}
- final protected boolean doMatch(
+ protected boolean doMatch(
String pattern, String servletPath, String pathInfo,
String extension, Match match)
throws IllegalArgumentException {
- if (needDecode()) {
- try {
- servletPath = URLDecoder.decode(servletPath, "UTF-8"); //$NON-NLS-1$
- }
- catch (UnsupportedEncodingException e) {
- // do nothing
- }
- }
+
if (match == Match.EXACT) {
return pattern.equals(servletPath);
}
@@ -78,7 +66,7 @@ public abstract class MatchableRegistration<T, D extends DTO>
}
if ((match == Match.REGEX) && isPathWildcardMatch(
- pattern, servletPath)) {
+ pattern, servletPath, pathInfo)) {
return true;
}
@@ -100,18 +88,4 @@ public abstract class MatchableRegistration<T, D extends DTO>
return false;
}
- static boolean patternsRequireDecode(String[] patterns) {
- for (String pattern : patterns) {
- try {
- String encode = URLEncoder.encode(pattern, "UTF-8"); //$NON-NLS-1$
- if (!encode.equals(pattern)) {
- return true;
- }
- }
- catch (UnsupportedEncodingException e) {
- // do nothing
- }
- }
- return false;
- }
} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/registration/ResourceRegistration.java b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/registration/ResourceRegistration.java
index ff10f1bc..fc6ac646 100644
--- a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/registration/ResourceRegistration.java
+++ b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/registration/ResourceRegistration.java
@@ -29,7 +29,6 @@ public class ResourceRegistration extends EndpointRegistration<ResourceDTO> {
super(servletHolder, resourceDTO, servletContextHelper, contextController, legacyTCCL);
name = servletHolder.get().getClass().getName().concat("#").concat(getD().prefix); //$NON-NLS-1$
- needDecode = MatchableRegistration.patternsRequireDecode(resourceDTO.patterns);
}
@Override
@@ -47,12 +46,6 @@ public class ResourceRegistration extends EndpointRegistration<ResourceDTO> {
return getD().serviceId;
}
- @Override
- public boolean needDecode() {
- return needDecode;
- }
-
- private final boolean needDecode;
private final String name;
}
diff --git a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/registration/ServletRegistration.java b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/registration/ServletRegistration.java
index be982f45..63267f9e 100644
--- a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/registration/ServletRegistration.java
+++ b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/registration/ServletRegistration.java
@@ -66,7 +66,6 @@ public class ServletRegistration extends EndpointRegistration<ExtendedServletDTO
else {
multipartSupport = null;
}
- needDecode = MatchableRegistration.patternsRequireDecode(servletDTO.patterns);
}
public ErrorPageDTO getErrorPageDTO() {
@@ -117,12 +116,8 @@ public class ServletRegistration extends EndpointRegistration<ExtendedServletDTO
return multipartSupport.parseRequest(request);
}
- @Override
- public boolean needDecode() {
- return needDecode;
- }
- private final boolean needDecode;
private final ErrorPageDTO errorPageDTO;
private final MultipartSupport multipartSupport;
+
}
diff --git a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/servlet/ProxyServlet.java b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/servlet/ProxyServlet.java
index 82b21b28..08ec8f16 100644
--- a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/servlet/ProxyServlet.java
+++ b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/servlet/ProxyServlet.java
@@ -62,11 +62,7 @@ public class ProxyServlet extends HttpServlet {
checkRuntime();
- String alias = request.getRequestURI();
-
- if (request.getDispatcherType() == DispatcherType.INCLUDE) {
- alias = (String)request.getAttribute(RequestDispatcher.INCLUDE_REQUEST_URI);
- }
+ String alias = HttpServletRequestWrapperImpl.getDispatchPathInfo(request);
if (alias == null) {
alias = Const.SLASH;

Back to the top