cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r538249 - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/message/ common/common/src/main/java/org/apache/cxf/helpers/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ rt/transports/http/src/main/java/org/apache/cxf/t...
Date Tue, 15 May 2007 16:37:23 GMT
Author: dkulp
Date: Tue May 15 09:37:19 2007
New Revision: 538249

URL: http://svn.apache.org/viewvc?view=rev&rev=538249
Log:
[CXF-653] Patch from Jeff applied (witch a couple modifications)


Modified:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/Message.java
    incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/HttpHeaderHelper.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ContextPropertiesMapping.java
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/Message.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/Message.java?view=diff&rev=538249&r1=538248&r2=538249
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/Message.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/Message.java Tue May 15 09:37:19
2007
@@ -54,6 +54,7 @@
     String BASE_PATH = Message.class.getName() + ".BASE_PATH";
     String ENCODING = Message.class.getName() + ".ENCODING";
     String FIXED_PARAMETER_ORDER = Message.class.getName() + "FIXED_PARAMETER_ORDER";
+    String MAINTAIN_SESSION = Message.class.getName() + ".MAINTAIN_SESSION";
 
     String WSDL_DESCRIPTION = "javax.xml.ws.wsdl.description";
     String WSDL_SERVICE = "javax.xml.ws.wsdl.service";

Modified: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/HttpHeaderHelper.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/HttpHeaderHelper.java?view=diff&rev=538249&r1=538248&r2=538249
==============================================================================
--- incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/HttpHeaderHelper.java
(original)
+++ incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/HttpHeaderHelper.java
Tue May 15 09:37:19 2007
@@ -28,6 +28,7 @@
     public static final String CONTENT_TYPE = "Content-Type";
     public static final String CONTENT_ID = "Content-ID";
     public static final String CONTENT_TRANSFER_ENCODING = "Content-Transfer-Encoding";
+    public static final String COOKIE = "Cookie";
     
     private static Map<String, String> internalHeaders = new HashMap<String, String>();
     

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ContextPropertiesMapping.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ContextPropertiesMapping.java?view=diff&rev=538249&r1=538248&r2=538249
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ContextPropertiesMapping.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ContextPropertiesMapping.java
Tue May 15 09:37:19 2007
@@ -52,6 +52,8 @@
     static {
         cxf2jaxwsMap.put(Message.ENDPOINT_ADDRESS, 
                           BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
+        cxf2jaxwsMap.put(Message.MAINTAIN_SESSION,
+                         BindingProvider.SESSION_MAINTAIN_PROPERTY);
         
         cxf2jaxwsMap.put(Message.HTTP_REQUEST_METHOD,
                           MessageContext.HTTP_REQUEST_METHOD);
@@ -68,6 +70,8 @@
         
         jaxws2cxfMap.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, 
                          Message.ENDPOINT_ADDRESS);
+        jaxws2cxfMap.put(BindingProvider.SESSION_MAINTAIN_PROPERTY, 
+                         Message.MAINTAIN_SESSION);
                 
         jaxws2cxfMap.put(MessageContext.HTTP_REQUEST_METHOD,
                          Message.HTTP_REQUEST_METHOD);

Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java?view=diff&rev=538249&r1=538248&r2=538249
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
(original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
Tue May 15 09:37:19 2007
@@ -243,6 +243,10 @@
      * should be handled as such.
      */
     private boolean configFinalized;
+    
+    private String sessionId;
+    
+    private boolean maintainSession;
 
     /**
      * Constructor
@@ -432,6 +436,7 @@
      * @param message The message to be sent.
      */
     public void prepare(Message message) throws IOException {
+        
         Map<String, List<String>> headers = getSetProtocolHeaders(message);
         
         // This call can possibly change the conduit endpoint address and 
@@ -496,6 +501,18 @@
             }
         }
         
+        //Do we need to maintain a session?
+        if (Boolean.TRUE.equals((Boolean) message.get(Message.MAINTAIN_SESSION))) {
+            maintainSession = true;
+        } else {
+            maintainSession = false;
+        }
+        
+        //If we have a sessionId and we are maintaining sessions, then use it
+        if (maintainSession && sessionId != null) {
+            connection.setRequestProperty(HttpHeaderHelper.COOKIE, "JSESSIONID=" + sessionId);
+        }
+
         // The trust decision is relagated to after the "flushing" of the
         // request headers.
         
@@ -1749,6 +1766,19 @@
             inMessage.put(Message.RESPONSE_CODE, responseCode);
             inMessage.put(Message.CONTENT_TYPE, 
                     connection.getHeaderField(HttpHeaderHelper.CONTENT_TYPE));
+            
+            if (maintainSession) {
+                String cookieStr = connection.getHeaderField("Set-Cookie");
+                if (cookieStr != null) {
+                    String cookies[] = cookieStr.split(";");
+                    for (int i = 0; i < cookies.length; i++) {
+                        String nameValue[] = cookies[i].split("=");
+                        if (nameValue[0].equals("JSESSIONID") || nameValue[0].equals("jsessionid"))
{
+                            sessionId = nameValue[1];
+                        }
+                    }
+                }
+            }
 
             in = connection.getErrorStream();
             if (null == in) {



Mime
View raw message