Author: ruwan
Date: Sun Jun 24 22:59:27 2007
New Revision: 550369

URL: http://svn.apache.org/viewvc?view=rev&rev=550369
Log:
Applying Oleg's patch inorder to take the http-core-alpha5

Modified:
    
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/Axis2HttpRequest.java
    
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/ClientHandler.java
    
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/LoggingIOSession.java
    
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/LoggingNHttpClientHandler.java
    
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/LoggingNHttpServiceHandler.java
    
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/PlainClientIOEventDispatch.java
    
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/PlainServerIOEventDispatch.java
    
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/SSLClientIOEventDispatch.java
    
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/SSLServerIOEventDispatch.java
    webservices/synapse/trunk/java/pom.xml

Modified: 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/Axis2HttpRequest.java
URL: 
http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/Axis2HttpRequest.java?view=diff&rev=550369&r1=550368&r2=550369
==============================================================================
--- 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/Axis2HttpRequest.java
 (original)
+++ 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/Axis2HttpRequest.java
 Sun Jun 24 22:59:27 2007
@@ -26,17 +26,15 @@
 import org.apache.axis2.transport.MessageFormatter;
 import org.apache.axis2.transport.TransportUtils;
 import org.apache.http.*;
+import org.apache.http.message.BasicHttpEntityEnclosingRequest;
 import org.apache.http.protocol.HTTP;
 import org.apache.http.entity.BasicHttpEntity;
-import org.apache.http.message.HttpPost;
 import org.apache.axiom.om.OMOutputFormat;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import javax.xml.stream.XMLStreamException;
 import java.io.IOException;
 import java.io.OutputStream;
-import java.nio.channels.Pipe;
 import java.nio.channels.Channels;
 import java.nio.channels.ReadableByteChannel;
 import java.util.Map;
@@ -98,7 +96,9 @@
      * @return the HttpRequest to be sent out
      */
     public HttpRequest getRequest() throws IOException {
-        HttpPost httpRequest = new HttpPost(epr.getAddress());
+        HttpEntityEnclosingRequest httpRequest = new 
BasicHttpEntityEnclosingRequest(
+                "POST", 
+                epr.getAddress());
         httpRequest.setEntity(new BasicHttpEntity());
 
         // set any transport headers

Modified: 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/ClientHandler.java
URL: 
http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/ClientHandler.java?view=diff&rev=550369&r1=550368&r2=550369
==============================================================================
--- 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/ClientHandler.java
 (original)
+++ 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/ClientHandler.java
 Sun Jun 24 22:59:27 2007
@@ -23,6 +23,7 @@
 import org.apache.http.nio.ContentDecoder;
 import org.apache.http.nio.ContentEncoder;
 import org.apache.http.params.HttpParams;
+import org.apache.http.params.HttpParamsLinker;
 import org.apache.http.*;
 import org.apache.http.entity.BasicHttpEntity;
 import org.apache.http.impl.DefaultConnectionReuseStrategy;
@@ -30,7 +31,6 @@
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.transport.nhttp.util.PipeImpl;
-import org.apache.axis2.transport.nhttp.util.NativeWorkerPool;
 import org.apache.axis2.transport.nhttp.util.WorkerPool;
 import org.apache.axis2.transport.nhttp.util.WorkerPoolFactory;
 import org.apache.axis2.description.WSDL2Constants;
@@ -124,7 +124,7 @@
             context.setAttribute(REQUEST_SOURCE_CHANNEL, 
axis2Req.getSourceChannel());
 
             HttpRequest request = axis2Req.getRequest();
-            request.getParams().setDefaults(this.params);
+            HttpParamsLinker.link(request, this.params);
             this.httpProcessor.process(request, context);
 
             conn.submitRequest(request);
@@ -158,7 +158,7 @@
             context.setAttribute(REQUEST_SOURCE_CHANNEL, 
axis2Req.getSourceChannel());
 
             HttpRequest request = axis2Req.getRequest();
-            request.getParams().setDefaults(this.params);
+            HttpParamsLinker.link(request, this.params);
             this.httpProcessor.process(request, context);
 
             conn.submitRequest(request);
@@ -243,7 +243,6 @@
      */
     public void outputReady(final NHttpClientConnection conn, final 
ContentEncoder encoder) {
         HttpContext context = conn.getContext();
-        HttpResponse response = conn.getHttpResponse();
 
         ReadableByteChannel source = (ReadableByteChannel) 
context.getAttribute(REQUEST_SOURCE_CHANNEL);
         ByteBuffer outbuf = (ByteBuffer) context.getAttribute(RESPONSE_BUFFER);

Modified: 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/LoggingIOSession.java
URL: 
http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/LoggingIOSession.java?view=diff&rev=550369&r1=550368&r2=550369
==============================================================================
--- 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/LoggingIOSession.java
 (original)
+++ 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/LoggingIOSession.java
 Sun Jun 24 22:59:27 2007
@@ -22,6 +22,7 @@
 import java.net.SocketAddress;
 import java.nio.ByteBuffer;
 import java.nio.channels.ByteChannel;
+import java.nio.channels.SelectionKey;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -68,10 +69,29 @@
         return this.session.getEventMask();
     }
 
+    private static String formatOps(int ops) {
+        StringBuffer buffer = new StringBuffer(6);
+        buffer.append('[');
+        if ((ops & SelectionKey.OP_READ) > 0) {
+            buffer.append('r');
+        }
+        if ((ops & SelectionKey.OP_WRITE) > 0) {
+            buffer.append('w');
+        }
+        if ((ops & SelectionKey.OP_ACCEPT) > 0) {
+            buffer.append('a');
+        }
+        if ((ops & SelectionKey.OP_CONNECT) > 0) {
+            buffer.append('c');
+        }
+        buffer.append(']');
+        return buffer.toString();
+    }
+    
     public void setEventMask(int ops) {
         if (this.log.isDebugEnabled()) {
             this.log.debug("I/O session " + this.id + " " + this.session + ": 
Set event mask " 
-                    + ops);
+                    + formatOps(ops));
         }
         this.session.setEventMask(ops);
     }
@@ -79,7 +99,7 @@
     public void setEvent(int op) {
         if (this.log.isDebugEnabled()) {
             this.log.debug("I/O session " + this.id + " " + this.session + ": 
Set event " 
-                    + op);
+                    + formatOps(op));
         }
         this.session.setEvent(op);
     }
@@ -87,7 +107,7 @@
     public void clearEvent(int op) {
         if (this.log.isDebugEnabled()) {
             this.log.debug("I/O session " + this.id + " " + this.session + ": 
Clear event " 
-                    + op);
+                    + formatOps(op));
         }
         this.session.clearEvent(op);
     }
@@ -101,6 +121,13 @@
 
     public boolean isClosed() {
         return this.session.isClosed();
+    }
+
+    public void shutdown() {
+        if (this.log.isDebugEnabled()) {
+            this.log.debug("I/O session " + this.id + " " + this.session + ": 
Shutdown");
+        }
+        this.session.shutdown();
     }
 
     public int getSocketTimeout() {

Modified: 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/LoggingNHttpClientHandler.java
URL: 
http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/LoggingNHttpClientHandler.java?view=diff&rev=550369&r1=550368&r2=550369
==============================================================================
--- 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/LoggingNHttpClientHandler.java
 (original)
+++ 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/LoggingNHttpClientHandler.java
 Sun Jun 24 22:59:27 2007
@@ -22,6 +22,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.http.Header;
 import org.apache.http.HttpException;
 import org.apache.http.HttpResponse;
 import org.apache.http.nio.ContentDecoder;
@@ -36,6 +37,7 @@
 public class LoggingNHttpClientHandler implements NHttpClientHandler {
 
     private final Log log;
+    private final Log headerlog;
     private final NHttpClientHandler handler;
     
     public LoggingNHttpClientHandler(final NHttpClientHandler handler) {
@@ -45,6 +47,7 @@
         }
         this.handler = handler;
         this.log = LogFactory.getLog(handler.getClass());
+        this.headerlog = 
LogFactory.getLog("org.apache.axis2.transport.nhttp.headers");
     }
     
     public void connected(final NHttpClientConnection conn, final Object 
attachment) {
@@ -89,11 +92,18 @@
     }
 
     public void responseReceived(final NHttpClientConnection conn) {
+        HttpResponse response = conn.getHttpResponse();
         if (this.log.isDebugEnabled()) {
-            HttpResponse response = conn.getHttpResponse();
             this.log.debug("HTTP connection " + conn + ": " + 
response.getStatusLine());
         }
         this.handler.responseReceived(conn);
+        if (this.headerlog.isDebugEnabled()) {
+            this.headerlog.debug("<< " + response.getStatusLine().toString());
+            Header[] headers = response.getAllHeaders();
+            for (int i = 0; i < headers.length; i++) {
+                this.headerlog.debug("<< " + headers[i].toString());
+            }
+        }
     }
 
     public void inputReady(final NHttpClientConnection conn, final 
ContentDecoder decoder) {

Modified: 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/LoggingNHttpServiceHandler.java
URL: 
http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/LoggingNHttpServiceHandler.java?view=diff&rev=550369&r1=550368&r2=550369
==============================================================================
--- 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/LoggingNHttpServiceHandler.java
 (original)
+++ 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/LoggingNHttpServiceHandler.java
 Sun Jun 24 22:59:27 2007
@@ -22,6 +22,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.http.Header;
 import org.apache.http.HttpException;
 import org.apache.http.HttpRequest;
 import org.apache.http.nio.ContentDecoder;
@@ -36,6 +37,7 @@
 public class LoggingNHttpServiceHandler implements NHttpServiceHandler {
 
     private final Log log;
+    private final Log headerlog;
     private final NHttpServiceHandler handler;
     
     public LoggingNHttpServiceHandler(final NHttpServiceHandler handler) {
@@ -45,6 +47,7 @@
         }
         this.handler = handler;
         this.log = LogFactory.getLog(handler.getClass());
+        this.headerlog = 
LogFactory.getLog("org.apache.axis2.transport.nhttp.headers");
     }
     
     public void connected(final NHttpServerConnection conn) {
@@ -62,31 +65,28 @@
     }
 
     public void exception(final NHttpServerConnection conn, final IOException 
ex) {
-        if (ex.getMessage().indexOf("Connection reset") != -1 ||
-            ex.getMessage().indexOf("forcibly closed")  != -1) {
-            this.log.warn("HTTP connection " + conn + ": " + ex.getMessage());
-        } else {
-            this.log.error("HTTP connection " + conn + ": " + ex.getMessage(), 
ex);
-        }
+        this.log.error("HTTP connection " + conn + ": " + ex.getMessage(), ex);
         this.handler.exception(conn, ex);
     }
 
     public void exception(final NHttpServerConnection conn, final 
HttpException ex) {
-        if (ex.getMessage().contains("Connection reset") ||
-            ex.getMessage().contains("forcibly closed")) {
-            this.log.warn("HTTP connection " + conn + ": " + ex.getMessage());
-        } else {
-            this.log.error("HTTP connection " + conn + ": " + ex.getMessage(), 
ex);
-        }
+        this.log.error("HTTP connection " + conn + ": " + ex.getMessage(), ex);
         this.handler.exception(conn, ex);
     }
 
     public void requestReceived(final NHttpServerConnection conn) {
+        HttpRequest request = conn.getHttpRequest();
         if (this.log.isDebugEnabled()) {
-            HttpRequest request = conn.getHttpRequest();
             this.log.debug("HTTP connection " + conn + ": " + 
request.getRequestLine());
         }
         this.handler.requestReceived(conn);
+        if (this.headerlog.isDebugEnabled()) {
+            this.headerlog.debug(">> " + request.getRequestLine().toString());
+            Header[] headers = request.getAllHeaders();
+            for (int i = 0; i < headers.length; i++) {
+                this.headerlog.debug(">> " + headers[i].toString());
+            }
+        }
     }
 
     public void outputReady(final NHttpServerConnection conn, final 
ContentEncoder encoder) {

Modified: 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/PlainClientIOEventDispatch.java
URL: 
http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/PlainClientIOEventDispatch.java?view=diff&rev=550369&r1=550368&r2=550369
==============================================================================
--- 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/PlainClientIOEventDispatch.java
 (original)
+++ 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/PlainClientIOEventDispatch.java
 Sun Jun 24 22:59:27 2007
@@ -23,6 +23,7 @@
 import org.apache.http.nio.NHttpClientHandler;
 import org.apache.http.nio.reactor.IOEventDispatch;
 import org.apache.http.nio.reactor.IOSession;
+import org.apache.http.nio.util.HeapByteBufferAllocator;
 import org.apache.http.params.HttpParams;
 
 public class PlainClientIOEventDispatch implements IOEventDispatch {
@@ -47,9 +48,10 @@
     
     public void connected(final IOSession session) {
         // Decorate I/O session with logging capabilities
-        DefaultNHttpClientConnection conn = new DefaultNHttpClientConnection(
+        LoggingNHttpClientConnection conn = new LoggingNHttpClientConnection(
                 new LoggingIOSession(session), 
                 new DefaultHttpResponseFactory(),
+                new HeapByteBufferAllocator(),
                 this.params); 
         session.setAttribute(NHTTP_CONN, conn);
         

Modified: 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/PlainServerIOEventDispatch.java
URL: 
http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/PlainServerIOEventDispatch.java?view=diff&rev=550369&r1=550368&r2=550369
==============================================================================
--- 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/PlainServerIOEventDispatch.java
 (original)
+++ 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/PlainServerIOEventDispatch.java
 Sun Jun 24 22:59:27 2007
@@ -23,6 +23,7 @@
 import org.apache.http.nio.NHttpServiceHandler;
 import org.apache.http.nio.reactor.IOEventDispatch;
 import org.apache.http.nio.reactor.IOSession;
+import org.apache.http.nio.util.HeapByteBufferAllocator;
 import org.apache.http.params.HttpParams;
 
 public class PlainServerIOEventDispatch implements IOEventDispatch {
@@ -47,9 +48,10 @@
     
     public void connected(final IOSession session) {
         // Decorate I/O session with logging capabilities
-        DefaultNHttpServerConnection conn = new DefaultNHttpServerConnection(
+        LoggingNHttpServerConnection conn = new LoggingNHttpServerConnection(
                 new LoggingIOSession(session), 
                 new DefaultHttpRequestFactory(),
+                new HeapByteBufferAllocator(),
                 this.params); 
         session.setAttribute(NHTTP_CONN, conn);
         this.handler.connected(conn);

Modified: 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/SSLClientIOEventDispatch.java
URL: 
http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/SSLClientIOEventDispatch.java?view=diff&rev=550369&r1=550368&r2=550369
==============================================================================
--- 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/SSLClientIOEventDispatch.java
 (original)
+++ 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/SSLClientIOEventDispatch.java
 Sun Jun 24 22:59:27 2007
@@ -31,6 +31,7 @@
 import org.apache.http.nio.NHttpClientHandler;
 import org.apache.http.nio.reactor.IOEventDispatch;
 import org.apache.http.nio.reactor.IOSession;
+import org.apache.http.nio.util.HeapByteBufferAllocator;
 import org.apache.http.params.HttpParams;
 
 public class SSLClientIOEventDispatch implements IOEventDispatch {
@@ -81,6 +82,7 @@
         DefaultNHttpClientConnection conn = new DefaultNHttpClientConnection(
                 new LoggingIOSession(sslSession), 
                 new DefaultHttpResponseFactory(),
+                new HeapByteBufferAllocator(),
                 this.params); 
         
         session.setAttribute(NHTTP_CONN, conn);
@@ -90,7 +92,7 @@
         this.handler.connected(conn, attachment);
 
         try {
-            sslSession.initialize(SSLMode.CLIENT, this.params);
+            sslSession.bind(SSLMode.CLIENT, this.params);
         } catch (SSLException ex) {
             this.handler.exception(conn, ex);
             sslSession.shutdown();

Modified: 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/SSLServerIOEventDispatch.java
URL: 
http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/SSLServerIOEventDispatch.java?view=diff&rev=550369&r1=550368&r2=550369
==============================================================================
--- 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/SSLServerIOEventDispatch.java
 (original)
+++ 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/SSLServerIOEventDispatch.java
 Sun Jun 24 22:59:27 2007
@@ -31,6 +31,7 @@
 import org.apache.http.nio.NHttpServiceHandler;
 import org.apache.http.nio.reactor.IOEventDispatch;
 import org.apache.http.nio.reactor.IOSession;
+import org.apache.http.nio.util.HeapByteBufferAllocator;
 import org.apache.http.params.HttpParams;
 
 public class SSLServerIOEventDispatch implements IOEventDispatch {
@@ -81,6 +82,7 @@
         DefaultNHttpServerConnection conn = new DefaultNHttpServerConnection(
                 new LoggingIOSession(sslSession), 
                 new DefaultHttpRequestFactory(),
+                new HeapByteBufferAllocator(),
                 this.params); 
         
         session.setAttribute(NHTTP_CONN, conn);
@@ -89,7 +91,7 @@
         this.handler.connected(conn);
 
         try {
-            sslSession.initialize(SSLMode.SERVER, this.params);
+            sslSession.bind(SSLMode.SERVER, this.params);
         } catch (SSLException ex) {
             this.handler.exception(conn, ex);
             sslSession.shutdown();

Modified: webservices/synapse/trunk/java/pom.xml
URL: 
http://svn.apache.org/viewvc/webservices/synapse/trunk/java/pom.xml?view=diff&rev=550369&r1=550368&r2=550369
==============================================================================
--- webservices/synapse/trunk/java/pom.xml (original)
+++ webservices/synapse/trunk/java/pom.xml Sun Jun 24 22:59:27 2007
@@ -306,7 +306,7 @@
 
             <dependency>
                 <groupId>org.apache.httpcomponents</groupId>
-                <artifactId>jakarta-httpcore</artifactId>
+                <artifactId>httpcore</artifactId>
                 <version>${jakarta.httpcore.nio.version}</version>
             </dependency>
 
@@ -585,17 +585,17 @@
         <!-- dependencies for nhttp transport -->
         <dependency>
             <groupId>org.apache.httpcomponents</groupId>
-            <artifactId>jakarta-httpcore</artifactId>
+            <artifactId>httpcore</artifactId>
             <version>${jakarta.httpcore.nio.version}</version>
         </dependency>
         <dependency>
             <groupId>org.apache.httpcomponents</groupId>
-            <artifactId>jakarta-httpcore-nio</artifactId>
+            <artifactId>httpcore-nio</artifactId>
             <version>${jakarta.httpcore.nio.version}</version>
         </dependency>
         <dependency>
             <groupId>org.apache.httpcomponents</groupId>
-            <artifactId>jakarta-httpcore-niossl</artifactId>
+            <artifactId>httpcore-niossl</artifactId>
             <version>${jakarta.httpcore.nio.version}</version>
         </dependency>
 
@@ -728,7 +728,7 @@
     <properties>
         <!-- Synapse and related components -->
         <synapse.version>SNAPSHOT</synapse.version>
-        <jakarta.httpcore.nio.version>4.0-alpha4</jakarta.httpcore.nio.version>
+        
<jakarta.httpcore.nio.version>4.0-alpha5-SNAPSHOT</jakarta.httpcore.nio.version>
 
         <!-- Axis2 1.2 and its dependencies -->
         <axis2.version>1.2</axis2.version>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to