aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaymond Auge2018-03-30 16:26:47 -0400
committerRaymond Auge2018-05-01 15:36:40 -0400
commit7721bc64b507a9d8ac34e12645d2d774f3bd7004 (patch)
tree14087cadf53b29ea6811ddfd4f827097b613e13d
parent51204d802c2606f218f3f3129aeae5932a0307d3 (diff)
downloadrt.equinox.bundles-7721bc64b507a9d8ac34e12645d2d774f3bd7004.zip
rt.equinox.bundles-7721bc64b507a9d8ac34e12645d2d774f3bd7004.tar.gz
rt.equinox.bundles-7721bc64b507a9d8ac34e12645d2d774f3bd7004.tar.xz
Bug 534238 - [http servlet] http.servlet loses include path in complex dispatching scenarios
Signed-off-by: Raymond Auge <raymond.auge@liferay.com>
-rw-r--r--bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/servlet/HttpServletRequestWrapperImpl.java87
1 files changed, 37 insertions, 50 deletions
diff --git a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/servlet/HttpServletRequestWrapperImpl.java b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/servlet/HttpServletRequestWrapperImpl.java
index cfb0016..5cc61c7 100644
--- a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/servlet/HttpServletRequestWrapperImpl.java
+++ b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/servlet/HttpServletRequestWrapperImpl.java
@@ -54,6 +54,8 @@ public class HttpServletRequestWrapperImpl extends HttpServletRequestWrapper {
dispatcherAttributes.add(RequestDispatcher.INCLUDE_SERVLET_PATH);
}
+ private static final Object NULL_PLACEHOLDER = new Object();
+
public static HttpServletRequestWrapperImpl findHttpRuntimeRequest(
HttpServletRequest request) {
@@ -207,49 +209,40 @@ public class HttpServletRequestWrapperImpl extends HttpServletRequestWrapper {
}
}
else if (dispatcherType == DispatcherType.INCLUDE) {
- if (attributeName.equals(RequestDispatcher.INCLUDE_CONTEXT_PATH)) {
- if (hasServletName) {
+ if (hasServletName && attributeName.startsWith("javax.servlet.include")) { //$NON-NLS-1$
+ return null;
+ }
+
+ if (dispatcherAttributes.contains(attributeName)) {
+ Object specialOveride = specialOverides.get(attributeName);
+
+ if (NULL_PLACEHOLDER.equals(specialOveride)) {
return null;
}
- if (specialOverides.containsKey(RequestDispatcher.INCLUDE_CONTEXT_PATH)) {
- return specialOverides.get(RequestDispatcher.INCLUDE_CONTEXT_PATH);
+ else if (specialOveride != null) {
+ return specialOveride;
}
+
+ Object attributeValue = super.getAttribute(attributeName);
+
+ if (attributeValue != null) {
+ return attributeValue;
+ }
+ }
+
+ if (attributeName.equals(RequestDispatcher.INCLUDE_CONTEXT_PATH)) {
return current.getContextController().getFullContextPath();
}
else if (attributeName.equals(RequestDispatcher.INCLUDE_PATH_INFO)) {
- if (hasServletName) {
- return null;
- }
- if (specialOverides.containsKey(RequestDispatcher.INCLUDE_PATH_INFO)) {
- return specialOverides.get(RequestDispatcher.INCLUDE_PATH_INFO);
- }
return current.getPathInfo();
}
else if (attributeName.equals(RequestDispatcher.INCLUDE_QUERY_STRING)) {
- if (hasServletName) {
- return null;
- }
- if (specialOverides.containsKey(RequestDispatcher.INCLUDE_QUERY_STRING)) {
- return specialOverides.get(RequestDispatcher.INCLUDE_QUERY_STRING);
- }
return current.getQueryString();
}
else if (attributeName.equals(RequestDispatcher.INCLUDE_REQUEST_URI)) {
- if (hasServletName) {
- return null;
- }
- if (specialOverides.containsKey(RequestDispatcher.INCLUDE_REQUEST_URI)) {
- return specialOverides.get(RequestDispatcher.INCLUDE_REQUEST_URI);
- }
return current.getRequestURI();
}
else if (attributeName.equals(RequestDispatcher.INCLUDE_SERVLET_PATH)) {
- if (hasServletName) {
- return null;
- }
- if (specialOverides.containsKey(RequestDispatcher.INCLUDE_SERVLET_PATH)) {
- return specialOverides.get(RequestDispatcher.INCLUDE_SERVLET_PATH);
- }
return current.getServletPath();
}
@@ -262,36 +255,32 @@ public class HttpServletRequestWrapperImpl extends HttpServletRequestWrapper {
return null;
}
+ if (dispatcherAttributes.contains(attributeName)) {
+ Object specialOveride = specialOverides.get(attributeName);
+
+ if (NULL_PLACEHOLDER.equals(specialOveride)) {
+ return null;
+ }
+ else if (specialOveride != null) {
+ return specialOveride;
+ }
+ }
+
DispatchTargets original = dispatchTargets.getLast();
if (attributeName.equals(RequestDispatcher.FORWARD_CONTEXT_PATH)) {
- if (specialOverides.containsKey(RequestDispatcher.FORWARD_CONTEXT_PATH)) {
- return specialOverides.get(RequestDispatcher.FORWARD_CONTEXT_PATH);
- }
return original.getContextController().getFullContextPath();
}
else if (attributeName.equals(RequestDispatcher.FORWARD_PATH_INFO)) {
- if (specialOverides.containsKey(RequestDispatcher.FORWARD_PATH_INFO)) {
- return specialOverides.get(RequestDispatcher.FORWARD_PATH_INFO);
- }
return original.getPathInfo();
}
else if (attributeName.equals(RequestDispatcher.FORWARD_QUERY_STRING)) {
- if (specialOverides.containsKey(RequestDispatcher.FORWARD_QUERY_STRING)) {
- return specialOverides.get(RequestDispatcher.FORWARD_QUERY_STRING);
- }
return original.getQueryString();
}
else if (attributeName.equals(RequestDispatcher.FORWARD_REQUEST_URI)) {
- if (specialOverides.containsKey(RequestDispatcher.FORWARD_REQUEST_URI)) {
- return specialOverides.get(RequestDispatcher.FORWARD_REQUEST_URI);
- }
return original.getRequestURI();
}
else if (attributeName.equals(RequestDispatcher.FORWARD_SERVLET_PATH)) {
- if (specialOverides.containsKey(RequestDispatcher.FORWARD_SERVLET_PATH)) {
- return specialOverides.get(RequestDispatcher.FORWARD_SERVLET_PATH);
- }
return original.getServletPath();
}
@@ -374,9 +363,8 @@ public class HttpServletRequestWrapperImpl extends HttpServletRequestWrapper {
current.getSpecialOverides().remove(name);
}
- else {
- request.removeAttribute(name);
- }
+
+ request.removeAttribute(name);
DispatchTargets currentDispatchTarget = dispatchTargets.peek();
@@ -406,15 +394,14 @@ public class HttpServletRequestWrapperImpl extends HttpServletRequestWrapper {
DispatchTargets current = dispatchTargets.peek();
if (value == null) {
- current.getSpecialOverides().remove(name);
+ current.getSpecialOverides().put(name, NULL_PLACEHOLDER);
}
else {
current.getSpecialOverides().put(name, value);
}
}
- else {
- request.setAttribute(name, value);
- }
+
+ request.setAttribute(name, value);
DispatchTargets currentDispatchTarget = dispatchTargets.peek();