cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r980573 - in /cxf/trunk/rt: transports/http/src/main/java/org/apache/cxf/transport/http/ transports/http/src/main/java/org/apache/cxf/transport/servlet/ ws/addr/src/main/java/org/apache/cxf/ws/addressing/
Date Thu, 29 Jul 2010 21:07:49 GMT
Author: dkulp
Date: Thu Jul 29 21:07:48 2010
New Revision: 980573

URL: http://svn.apache.org/viewvc?rev=980573&view=rev
Log:
[CXF-2911] This can affect the http-jetty transport as well.   Move it
into the method that is designed to cache the request.

Modified:
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HttpServletRequestSnapshot.java
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java
    cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java

Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java?rev=980573&r1=980572&r2=980573&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
(original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
Thu Jul 29 21:07:48 2010
@@ -277,7 +277,7 @@ public abstract class AbstractHTTPDestin
         setupMessage(inMessage, null, context, req, resp);
     }
     
-    protected void setupMessage(Message inMessage,
+    protected void setupMessage(final Message inMessage,
                                 final ServletConfig config,
                                 final ServletContext context, 
                                 final HttpServletRequest req, 
@@ -286,7 +286,17 @@ public abstract class AbstractHTTPDestin
                           req, 
                           resp);
         
-        DelegatingInputStream in = new DelegatingInputStream(req.getInputStream());
+        DelegatingInputStream in = new DelegatingInputStream(req.getInputStream()) {
+            public void cacheInput() {
+                if (!cached) {
+                    //we need to cache the values of the HttpServletRequest
+                    //so they can be queried later for things like paths and schemes 
+                    //and such like that 
+                    inMessage.put(HTTP_REQUEST, new HttpServletRequestSnapshot(req));
+                }
+                super.cacheInput();
+            }
+        };
         inMessage.setContent(DelegatingInputStream.class, in);
         inMessage.setContent(InputStream.class, in);
         inMessage.put(HTTP_REQUEST, req);

Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HttpServletRequestSnapshot.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HttpServletRequestSnapshot.java?rev=980573&r1=980572&r2=980573&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HttpServletRequestSnapshot.java
(original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HttpServletRequestSnapshot.java
Thu Jul 29 21:07:48 2010
@@ -37,7 +37,6 @@ public class HttpServletRequestSnapshot 
     private Cookie[] cookies;
     private String localAddr;
     private Locale local;
-    @SuppressWarnings("unchecked")
     private Enumeration locals;
     private String localName;
     private int localPort = -1;
@@ -63,7 +62,6 @@ public class HttpServletRequestSnapshot 
         new java.util.concurrent.ConcurrentHashMap<String, Enumeration<String>>();
     private String requestedSessionId;
 
-    @SuppressWarnings("unchecked")
     public HttpServletRequestSnapshot(HttpServletRequest request) {
         super(request);
         authType = request.getAuthType();
@@ -98,7 +96,9 @@ public class HttpServletRequestSnapshot 
         serverName = request.getServerName();
         serverPort = request.getServerPort();
         servletPath = request.getServletPath();
-        session = request.getSession();
+        if (request.isRequestedSessionIdValid()) {
+            session = request.getSession();
+        }
         principal = request.getUserPrincipal();
     }
 

Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java?rev=980573&r1=980572&r2=980573&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java
(original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java
Thu Jul 29 21:07:48 2010
@@ -34,7 +34,6 @@ import org.apache.cxf.message.MessageImp
 import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.transport.http.AbstractHTTPDestination;
 import org.apache.cxf.transport.http.HTTPSession;
-import org.apache.cxf.transport.http.HttpServletRequestSnapshot;
 
 
 public class ServletDestination extends AbstractHTTPDestination {
@@ -88,10 +87,7 @@ public class ServletDestination extends 
                      context,
                      req,
                      resp);
-        //the HttpServletRequest will be recycled in another thread when the operation 
-        //is oneway and WSA enabled. This SNAPSHOT request will be used in tihs case.
-        
-        inMessage.put("HTTP.REQUEST.SNAPSHOT", new HttpServletRequestSnapshot(req));
+
         ExchangeImpl exchange = new ExchangeImpl();
         exchange.setInMessage(inMessage);
         exchange.setSession(new HTTPSession(req));

Modified: cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java?rev=980573&r1=980572&r2=980573&view=diff
==============================================================================
--- cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java (original)
+++ cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java Thu
Jul 29 21:07:48 2010
@@ -458,14 +458,7 @@ public final class ContextUtils {
                         // has been sent (i.e. to a oneway, or a partial response
                         // to a decoupled twoway)
                         
-                        //In tomcat container, the httpServletRequest will be recycled/cleared
in the 
-                        //servlet thread. The values in request can not be retrieved in the
new created
-                        //thread after that . Replace it with httpServletRequest snaphost.
-                        if (inMessage.get("HTTP.REQUEST") != null
-                            && inMessage.get("HTTP.REQUEST.SNAPSHOT") != null) {
-                            inMessage.put("HTTP.REQUEST", inMessage.get("HTTP.REQUEST.SNAPSHOT"));
-
-                        }                   
+        
                         // pause dispatch on current thread ...
                         inMessage.getInterceptorChain().pause();
 



Mime
View raw message