tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject [1/2] tomee git commit: TOMEE-1711 unwrap http request before initializing the HttpRequest servlet for cxf-rs
Date Fri, 12 Feb 2016 17:48:21 GMT
Repository: tomee
Updated Branches:
  refs/heads/master fcf9c7d37 -> 4655c053b


TOMEE-1711 unwrap http request before initializing the HttpRequest servlet for cxf-rs


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/bf1b5d0d
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/bf1b5d0d
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/bf1b5d0d

Branch: refs/heads/master
Commit: bf1b5d0d95ff712035b2883bd17f442d0e7764ae
Parents: fcf9c7d
Author: Romain manni-Bucau <rmannibucau@gmail.com>
Authored: Fri Feb 12 15:32:40 2016 +0100
Committer: Romain manni-Bucau <rmannibucau@gmail.com>
Committed: Fri Feb 12 15:32:40 2016 +0100

----------------------------------------------------------------------
 .../openejb/server/cxf/rs/CxfRsHttpListener.java | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/bf1b5d0d/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/CxfRsHttpListener.java
----------------------------------------------------------------------
diff --git a/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/CxfRsHttpListener.java
b/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/CxfRsHttpListener.java
index f279f09..2dfd582 100644
--- a/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/CxfRsHttpListener.java
+++ b/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/CxfRsHttpListener.java
@@ -114,7 +114,9 @@ import javax.management.openmbean.TabularData;
 import javax.naming.Context;
 import javax.servlet.ServletException;
 import javax.servlet.ServletOutputStream;
+import javax.servlet.ServletRequest;
 import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequestWrapper;
 import javax.servlet.http.HttpServletResponse;
 import javax.ws.rs.ConstrainedTo;
 import javax.ws.rs.RuntimeType;
@@ -187,10 +189,19 @@ public class CxfRsHttpListener implements RsHttpListener {
     @Override
     public void onMessage(final HttpRequest httpRequest, final HttpResponse httpResponse)
throws Exception {
         // fix the address (to manage multiple connectors)
-        if (HttpRequestImpl.class.isInstance(httpRequest)) {
-            final HttpRequestImpl requestImpl = HttpRequestImpl.class.cast(httpRequest);
-            requestImpl.initPathFromContext((!context.startsWith("/") ? "/" : "") + context);
-            requestImpl.initServletPath(servlet);
+        {
+            ServletRequest unwrapped = httpRequest;
+            while (ServletRequestAdapter.class.isInstance(unwrapped)) {
+                unwrapped = ServletRequestAdapter.class.cast(unwrapped).getRequest();
+            }
+            while (HttpServletRequestWrapper.class.isInstance(unwrapped)) {
+                unwrapped = HttpServletRequestWrapper.class.cast(unwrapped).getRequest();
+            }
+            if (HttpRequestImpl.class.isInstance(unwrapped)) {
+                final HttpRequestImpl requestImpl = HttpRequestImpl.class.cast(unwrapped);
+                requestImpl.initPathFromContext((!context.startsWith("/") ? "/" : "") + context);
+                requestImpl.initServletPath(servlet);
+            }
         }
 
         boolean matchedStatic = false;


Mime
View raw message