axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r232796 - in /webservices/axis/trunk/java/modules: core/src/org/apache/axis2/transport/http/ core/src/org/apache/axis2/transport/http/server/ integration/test-resources/soap/ integration/test/org/apache/axis2/swa/
Date Mon, 15 Aug 2005 11:33:00 GMT
Author: dims
Date: Mon Aug 15 04:32:54 2005
New Revision: 232796

URL: http://svn.apache.org/viewcvs?rev=232796&view=rev
Log:
HTTP 1.1 keep alive support.


Modified:
    webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPWorker.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleHttpServerConnection.java
    webservices/axis/trunk/java/modules/integration/test-resources/soap/soapmessage.txt
    webservices/axis/trunk/java/modules/integration/test/org/apache/axis2/swa/swainput.bin

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPWorker.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPWorker.java?rev=232796&r1=232795&r2=232796&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPWorker.java
(original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPWorker.java
Mon Aug 15 04:32:54 2005
@@ -117,6 +117,7 @@
                 if (!processed) {
                     response.setStatusLine(request.getRequestLine().getHttpVersion(), 200,
"OK");
                     response.setBodyString(HTTPTransportReceiver.getServicesHTML(configurationContext));
+                    setResponseHeaders(conn, request, response);
                     conn.writeResponse(response);
                     return true;
                 }
@@ -132,7 +133,8 @@
                         configurationContext);
             }
             response.setStatusLine(request.getRequestLine().getHttpVersion(), 200, "OK");
-            response.setBody(new ByteArrayInputStream(baos.toByteArray()));
+            response.setBody(new ByteArrayInputStream(baos.toByteArray()));
+            setResponseHeaders(conn, request, response);
             conn.writeResponse(response);
         } catch (Throwable e) {
             try {
@@ -143,6 +145,7 @@
                     response.setStatusLine(request.getRequestLine().getHttpVersion(), 500,
"Internal server error");
                     engine.sendFault(faultContext);
                     response.setBody(new ByteArrayInputStream(baos.toByteArray()));
+                    setResponseHeaders(conn, request, response);
                     conn.writeResponse(response);
                 } else {
                     log.error(e, e);
@@ -153,6 +156,33 @@
             log.error(e.getMessage(), e);
         }
         return true;
+    }
+
+    private void setResponseHeaders(final SimpleHttpServerConnection conn, SimpleRequest
request, SimpleResponse response) {
+        if (!response.containsHeader("Connection")) {
+            // See if the the client explicitly handles connection persistence
+            Header connheader = request.getFirstHeader("Connection");
+            if (connheader != null) {
+                if (connheader.getValue().equalsIgnoreCase("keep-alive")) {
+                    Header header = new Header("Connection", "keep-alive"); 
+                    response.addHeader(header);
+                    conn.setKeepAlive(true);
+                }
+                if (connheader.getValue().equalsIgnoreCase("close")) {
+                    Header header = new Header("Connection", "close"); 
+                    response.addHeader(header);
+                    conn.setKeepAlive(false);
+                }
+            } else {
+                // Use protocol default connection policy
+                if (response.getHttpVersion().greaterEquals(HttpVersion.HTTP_1_1)) {
+                    conn.setKeepAlive(true);
+                } else {
+                    conn.setKeepAlive(false);
+                }
+            }
+        }
+        System.out.println("HTTPWorker.isKeepAlive : " + conn.isKeepAlive());
     }
 
     private Map getHeaders(SimpleRequest request) {

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleHttpServerConnection.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleHttpServerConnection.java?rev=232796&r1=232795&r2=232796&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleHttpServerConnection.java
(original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleHttpServerConnection.java
Mon Aug 15 04:32:54 2005
@@ -64,6 +64,7 @@
             throw new IllegalArgumentException("Socket may not be null");
         }
         this.socket = socket;
+        this.socket.setTcpNoDelay(true);
         this.in = socket.getInputStream();
         this.out = socket.getOutputStream();
     }

Modified: webservices/axis/trunk/java/modules/integration/test-resources/soap/soapmessage.txt
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/integration/test-resources/soap/soapmessage.txt?rev=232796&r1=232795&r2=232796&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/integration/test-resources/soap/soapmessage.txt (original)
+++ webservices/axis/trunk/java/modules/integration/test-resources/soap/soapmessage.txt Mon
Aug 15 04:32:54 2005
@@ -1,6 +1,7 @@
 POST /axis/services/EchoService HTTP/1.1
 Host: 127.0.0.1
 Content-Type: application/soap+xml; charset="utf-8"
+Connection: close
 
 <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing">
     <soapenv:Header>

Modified: webservices/axis/trunk/java/modules/integration/test/org/apache/axis2/swa/swainput.bin
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/integration/test/org/apache/axis2/swa/swainput.bin?rev=232796&r1=232795&r2=232796&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/integration/test/org/apache/axis2/swa/swainput.bin
(original)
+++ webservices/axis/trunk/java/modules/integration/test/org/apache/axis2/swa/swainput.bin
Mon Aug 15 04:32:54 2005
@@ -5,6 +5,7 @@
 Host: 127.0.0.1:8081
 Cache-Control: no-cache
 Pragma: no-cache
+Connection: close
 SOAPAction: ""
 
 



Mime
View raw message