Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2020-05-11 15:35:30 +0000
committerThomas Watson2020-05-11 15:35:30 +0000
commitb0229b70ed4d823a36c4ecaf5eb2cbfc344ac538 (patch)
tree9bb4cc9eac2879751c4db71a9dcb9c5a094f6e40 /bundles
parent9a0d95dd4a5d08977564f4ca5930b5570bccdc8d (diff)
downloadrt.equinox.bundles-b0229b70ed4d823a36c4ecaf5eb2cbfc344ac538.tar.gz
rt.equinox.bundles-b0229b70ed4d823a36c4ecaf5eb2cbfc344ac538.tar.xz
rt.equinox.bundles-b0229b70ed4d823a36c4ecaf5eb2cbfc344ac538.zip
Bug 562843 - Do not decode already decoded servletPaths
Change-Id: I71fe217e3bb598dc02a6d1976e5475a8841eb267 Signed-off-by: Thomas Watson <tjwatson@us.ibm.com>
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/registration/ErrorPageRegistration.java7
-rw-r--r--bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/registration/FilterRegistration.java9
-rw-r--r--bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/registration/MatchableRegistration.java30
-rw-r--r--bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/registration/ResourceRegistration.java9
-rw-r--r--bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/registration/ServletRegistration.java8
5 files changed, 5 insertions, 58 deletions
diff --git a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/registration/ErrorPageRegistration.java b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/registration/ErrorPageRegistration.java
index d833b2b4b..f3b33a443 100644
--- a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/registration/ErrorPageRegistration.java
+++ b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/registration/ErrorPageRegistration.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) Feb. 1, 2019 Liferay, Inc.
+ * Copyright (c) 2019, 2020 Liferay, Inc.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -57,11 +57,6 @@ public class ErrorPageRegistration extends EndpointRegistration<ExtendedErrorPag
}
@Override
- public boolean needDecode() {
- return false;
- }
-
- @Override
public String match(
String name, String servletPath, String pathInfo, String extension,
Match match) {
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 491305aa4..1ace14f4d 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2019 IBM Corporation and others.
+ * Copyright (c) 2011, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -41,7 +41,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,
@@ -74,7 +73,6 @@ public class FilterRegistration
} else {
initDestoyWithContextController = true;
}
- needDecode = MatchableRegistration.patternsRequireDecode(filterDTO.patterns);
}
@Override
@@ -281,9 +279,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 4fc27ff39..aef016add 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014, 2019 Raymond Augé and others.
+ * Copyright (c) 2014, 2020 Raymond Augé and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -14,9 +14,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;
@@ -31,8 +28,6 @@ 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);
@@ -59,14 +54,6 @@ public abstract class MatchableRegistration<T, D extends DTO>
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);
}
@@ -108,19 +95,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;
- }
}
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 671f7d49f..557e86c03 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014, 2019 Raymond Augé and others.
+ * Copyright (c) 2014, 2020 Raymond Augé and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -34,7 +34,6 @@ public class ResourceRegistration extends EndpointRegistration<ResourceDTO> {
this.serviceReference = serviceReference;
name = servletHolder.get().getClass().getName().concat("#").concat(getD().prefix); //$NON-NLS-1$
- needDecode = MatchableRegistration.patternsRequireDecode(resourceDTO.patterns);
}
@Override
@@ -57,12 +56,6 @@ public class ResourceRegistration extends EndpointRegistration<ResourceDTO> {
return serviceReference;
}
- @Override
- public boolean needDecode() {
- return needDecode;
- }
-
- private final boolean needDecode;
private final String name;
private final ServiceReference<?> serviceReference;
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 761a39146..b40942dcb 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2019 Cognos Incorporated, IBM Corporation and others
+ * Copyright (c) 2005, 2020 Cognos Incorporated, IBM Corporation and others
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -66,7 +66,6 @@ public class ServletRegistration extends EndpointRegistration<ServletDTO> {
else {
multipartSupport = null;
}
- needDecode = MatchableRegistration.patternsRequireDecode(servletDTO.patterns);
}
@Override
@@ -96,11 +95,6 @@ public class ServletRegistration extends EndpointRegistration<ServletDTO> {
return multipartSupport.parseRequest(request);
}
- @Override
- public boolean needDecode() {
- return needDecode;
- }
- private final boolean needDecode;
private final MultipartSupport multipartSupport;
}

Back to the top