diff options
author | Raymond Augé | 2019-09-18 18:15:49 +0000 |
---|---|---|
committer | Raymond Augé | 2019-09-18 18:53:04 +0000 |
commit | 6e871fc3e80f02de3ccb1dd8f69692cd77c58491 (patch) | |
tree | b7748ccf9b85d503d4684436db8fe21dcd3d66eb | |
parent | 6ddb27a1d0ee3648a3938f07925f9de960995d3a (diff) | |
download | rt.equinox.bundles-6e871fc3e80f02de3ccb1dd8f69692cd77c58491.tar.gz rt.equinox.bundles-6e871fc3e80f02de3ccb1dd8f69692cd77c58491.tar.xz rt.equinox.bundles-6e871fc3e80f02de3ccb1dd8f69692cd77c58491.zip |
Bug 500783 - [http] Content input stream unavailable for form based requests in NeonI20190923-1800I20190923-0615I20190922-1800I20190921-1800I20190920-1800I20190919-1800I20190919-0850I20190918-1800
actual fix
Signed-off-by: Raymond Augé <raymond.auge@liferay.com>
Change-Id: I04c8ae4a46788513f1b6402964f522f051a3820f
4 files changed, 22 insertions, 22 deletions
diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Bug500783_Test.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Bug500783_Test.java index be73438f5..871f1a631 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Bug500783_Test.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Bug500783_Test.java @@ -52,8 +52,6 @@ public class Bug500783_Test extends BaseTest { protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { int contentLength = req.getContentLength(); - System.out.println(req.getParameterMap().entrySet().toString()); - InputStream in = req.getInputStream(); // Read the input stream int bytesRead = 0; @@ -100,7 +98,7 @@ public class Bug500783_Test extends BaseTest { map.put("x-www-form-urlencoded", Arrays.<Object>asList("fielda=foo&fieldb=bar")); Map<String, List<String>> response = requestAdvisor.upload("MyServlet", map); - assertEquals("21|fieldb=[bar]|fielda=[foo]|0", response.get("responseBody").get(0)); + assertEquals("21|21", response.get("responseBody").get(0)); assertEquals(HttpServletResponse.SC_OK + "", response.get("responseCode").get(0)); } diff --git a/bundles/org.eclipse.equinox.http.servlet/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.http.servlet/META-INF/MANIFEST.MF index 3f1e1e616..cd1129c4c 100644 --- a/bundles/org.eclipse.equinox.http.servlet/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.http.servlet/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: %bundleName Bundle-Vendor: %providerName Bundle-SymbolicName: org.eclipse.equinox.http.servlet -Bundle-Version: 1.6.200.qualifier +Bundle-Version: 1.6.300.qualifier Bundle-Activator: org.eclipse.equinox.http.servlet.internal.Activator Bundle-Localization: plugin Bundle-RequiredExecutionEnvironment: JavaSE-1.7 diff --git a/bundles/org.eclipse.equinox.http.servlet/pom.xml b/bundles/org.eclipse.equinox.http.servlet/pom.xml index 7a4021d3a..5c6b2f307 100644 --- a/bundles/org.eclipse.equinox.http.servlet/pom.xml +++ b/bundles/org.eclipse.equinox.http.servlet/pom.xml @@ -20,6 +20,6 @@ </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.http.servlet</artifactId> - <version>1.6.200-SNAPSHOT</version> + <version>1.6.300-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/context/DispatchTargets.java b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/context/DispatchTargets.java index d0dace994..14a1beb53 100644 --- a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/context/DispatchTargets.java +++ b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/context/DispatchTargets.java @@ -60,22 +60,7 @@ public class DispatchTargets { } public void addRequestParameters(HttpServletRequest request) { - if (queryString == null) { - parameterMap = request.getParameterMap(); - queryString = request.getQueryString(); - - return; - } - - Map<String, String[]> parameterMapCopy = queryStringToParameterMap(queryString); - - for (Map.Entry<String, String[]> entry : request.getParameterMap().entrySet()) { - String[] values = parameterMapCopy.get(entry.getKey()); - values = Params.append(values, entry.getValue()); - parameterMapCopy.put(entry.getKey(), values); - } - - parameterMap = Collections.unmodifiableMap(parameterMapCopy); + currentRequest = request; } public void doDispatch( @@ -154,6 +139,19 @@ public class DispatchTargets { } public Map<String, String[]> getParameterMap() { + if ((parameterMap == null) && (currentRequest != null)) { + Map<String, String[]> parameterMapCopy = queryStringToParameterMap(queryString); + + for (Map.Entry<String, String[]> entry : currentRequest.getParameterMap().entrySet()) { + String[] values = parameterMapCopy.get(entry.getKey()); + if (!Arrays.equals(values, entry.getValue())) { + values = Params.append(values, entry.getValue()); + parameterMapCopy.put(entry.getKey(), values); + } + } + + parameterMap = Collections.unmodifiableMap(parameterMapCopy); + } return parameterMap; } @@ -162,6 +160,9 @@ public class DispatchTargets { } public String getQueryString() { + if ((queryString == null) && (currentRequest != null)) { + queryString = currentRequest.getQueryString(); + } return queryString; } @@ -207,7 +208,7 @@ public class DispatchTargets { private static Map<String, String[]> queryStringToParameterMap(String queryString) { if ((queryString == null) || (queryString.length() == 0)) { - return new HashMap<String, String[]>(); + return new LinkedHashMap<String, String[]>(); } try { @@ -264,6 +265,7 @@ public class DispatchTargets { private final ContextController contextController; private DispatcherType dispatcherType; private final EndpointRegistration<?> endpointRegistration; + private volatile HttpServletRequest currentRequest; private final List<FilterRegistration> matchingFilterRegistrations; private final String pathInfo; private Map<String, String[]> parameterMap; |