You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by de...@apache.org on 2007/11/12 20:04:15 UTC

svn commit: r594256 - in /webservices/axis2/trunk/java/modules: kernel/src/org/apache/axis2/transport/http/ kernel/src/org/apache/axis2/transport/http/server/ kernel/src/org/apache/axis2/transport/nhttp/ kernel/src/org/apache/axis2/transport/nhttp/util...

Author: deepal
Date: Mon Nov 12 11:04:11 2007
New Revision: 594256

URL: http://svn.apache.org/viewvc?rev=594256&view=rev
Log:
applying the patch in AXIS2-3253

Modified:
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/server/AxisHttpConnectionImpl.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/server/AxisHttpRequestImpl.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/server/AxisHttpResponseImpl.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/server/AxisHttpService.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/server/HttpServiceProcessor.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/nhttp/ClientHandler.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/nhttp/ClientWorker.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/nhttp/ConnectionPool.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/nhttp/HttpCoreNIOSender.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/nhttp/HttpCoreRequestResponseTransport.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/nhttp/LoggingIOSession.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/nhttp/NHttpConfiguration.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/nhttp/ServerHandler.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/nhttp/ServerWorker.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/nhttp/Util.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/nhttp/util/PipeImpl.java
    webservices/axis2/trunk/java/modules/parent/pom.xml

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java?rev=594256&r1=594255&r2=594256&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java Mon Nov 12 11:04:11 2007
@@ -29,7 +29,6 @@
 import org.apache.axis2.Constants;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.context.OperationContext;
 import org.apache.axis2.deployment.DeploymentConstants;
 import org.apache.axis2.description.AxisService;
 import org.apache.axis2.engine.Handler.InvocationResponse;

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/server/AxisHttpConnectionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/server/AxisHttpConnectionImpl.java?rev=594256&r1=594255&r2=594256&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/server/AxisHttpConnectionImpl.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/server/AxisHttpConnectionImpl.java Mon Nov 12 11:04:11 2007
@@ -25,21 +25,18 @@
 import java.net.InetAddress;
 import java.net.Socket;
 import java.net.SocketException;
-import java.util.Iterator;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.http.ConnectionClosedException;
-import org.apache.http.Header;
+import org.apache.http.HeaderIterator;
 import org.apache.http.HttpConnectionMetrics;
 import org.apache.http.HttpEntity;
 import org.apache.http.HttpEntityEnclosingRequest;
 import org.apache.http.HttpException;
 import org.apache.http.HttpRequest;
-import org.apache.http.HttpRequestFactory;
 import org.apache.http.HttpResponse;
 import org.apache.http.HttpVersion;
-import org.apache.http.RequestLine;
+import org.apache.http.ProtocolVersion;
 import org.apache.http.entity.ContentLengthStrategy;
 import org.apache.http.impl.DefaultHttpRequestFactory;
 import org.apache.http.impl.entity.StrictContentLengthStrategy;
@@ -47,20 +44,18 @@
 import org.apache.http.impl.io.ChunkedOutputStream;
 import org.apache.http.impl.io.ContentLengthInputStream;
 import org.apache.http.impl.io.ContentLengthOutputStream;
-import org.apache.http.impl.io.HttpDataInputStream;
+import org.apache.http.impl.io.HttpRequestParser;
+import org.apache.http.impl.io.HttpResponseWriter;
+import org.apache.http.impl.io.IdentityInputStream;
 import org.apache.http.impl.io.IdentityOutputStream;
-import org.apache.http.impl.io.SocketHttpDataReceiver;
-import org.apache.http.impl.io.SocketHttpDataTransmitter;
-import org.apache.http.io.HttpDataReceiver;
-import org.apache.http.io.HttpDataTransmitter;
-import org.apache.http.message.BasicHeader;
-import org.apache.http.message.BasicRequestLine;
-import org.apache.http.message.BasicStatusLine;
-import org.apache.http.message.BufferedHeader;
+import org.apache.http.impl.io.SocketInputBuffer;
+import org.apache.http.impl.io.SocketOutputBuffer;
+import org.apache.http.io.HttpMessageParser;
+import org.apache.http.io.HttpMessageWriter;
+import org.apache.http.io.SessionInputBuffer;
+import org.apache.http.io.SessionOutputBuffer;
 import org.apache.http.params.HttpConnectionParams;
 import org.apache.http.params.HttpParams;
-import org.apache.http.util.CharArrayBuffer;
-import org.apache.http.util.HeaderUtils;
 
 public class AxisHttpConnectionImpl implements AxisHttpConnection {
 
@@ -68,13 +63,11 @@
         LogFactory.getLog("org.apache.axis2.transport.http.server.wire");
 
     private final Socket socket;
-    private final HttpDataTransmitter datatransmitter;
-    private final HttpDataReceiver datareceiver;
-    private final CharArrayBuffer charbuffer; 
-    private final HttpRequestFactory requestfactory;
+    private final SessionOutputBuffer outbuffer;
+    private final SessionInputBuffer inbuffer;
+    private final HttpMessageParser requestParser;
+    private final HttpMessageWriter responseWriter;
     private final ContentLengthStrategy contentLenStrategy;
-    private final int maxHeaderCount;
-    private final int maxLineLen;
 
     private OutputStream out = null;
     private InputStream in = null;
@@ -98,17 +91,17 @@
         
         int buffersize = HttpConnectionParams.getSocketBufferSize(params);
         this.socket = socket;
-        this.datatransmitter = new SocketHttpDataTransmitter(socket, buffersize, params); 
-        this.datareceiver = new SocketHttpDataReceiver(socket, buffersize, params); 
-        this.charbuffer = new CharArrayBuffer(256);
-        this.requestfactory = new DefaultHttpRequestFactory();
+        this.outbuffer = new SocketOutputBuffer(socket, buffersize, params); 
+        this.inbuffer = new SocketInputBuffer(socket, buffersize, params); 
         this.contentLenStrategy = new StrictContentLengthStrategy();
-        this.maxHeaderCount = params.getIntParameter(HttpConnectionParams.MAX_HEADER_COUNT, -1);
-        this.maxLineLen = params.getIntParameter(HttpConnectionParams.MAX_LINE_LENGTH, -1);
+        this.requestParser = new HttpRequestParser(
+                this.inbuffer, null, new DefaultHttpRequestFactory(), params);
+        this.responseWriter = new HttpResponseWriter(
+                this.outbuffer, null, params);
     }
 
     public void close() throws IOException {
-        this.datatransmitter.flush();
+        this.outbuffer.flush();
         try {
             this.socket.shutdownOutput();
         } catch (IOException ignore) {
@@ -126,7 +119,7 @@
 
     public boolean isStale() {
         try {
-            this.datareceiver.isDataAvailable(1);
+            this.inbuffer.isDataAvailable(1);
             return false;
         } catch (IOException ex) {
             return true;
@@ -141,23 +134,11 @@
     }
 
     public HttpRequest receiveRequest() throws HttpException, IOException {
-        this.charbuffer.clear();
-        int i = this.datareceiver.readLine(this.charbuffer);
-        if (i == -1) {
-            throw new ConnectionClosedException("Client closed connection"); 
-        }
-        RequestLine requestline = BasicRequestLine.parse(this.charbuffer, 0, this.charbuffer.length());
-        HttpRequest request = this.requestfactory.newHttpRequest(requestline);
-        Header[] headers = HeaderUtils.parseHeaders(
-                this.datareceiver, 
-                this.maxHeaderCount,
-                this.maxLineLen);
-        request.setHeaders(headers);
-        
+        HttpRequest request = (HttpRequest) this.requestParser.parse();
         if (HEADERLOG.isDebugEnabled()) {
             HEADERLOG.debug(">> " + request.getRequestLine().toString());
-            for (i = 0; i < headers.length; i++) {
-                HEADERLOG.debug(">> " + headers[i].toString());
+            for (HeaderIterator it = request.headerIterator(); it.hasNext(); ) {
+                HEADERLOG.debug(">> " + it.nextHeader().toString());
             }
         }
         
@@ -166,11 +147,11 @@
         if (request instanceof HttpEntityEnclosingRequest) {
             long len = this.contentLenStrategy.determineLength(request);
             if (len == ContentLengthStrategy.CHUNKED) {
-                this.in = new ChunkedInputStream(this.datareceiver);
+                this.in = new ChunkedInputStream(this.inbuffer);
             } else if (len == ContentLengthStrategy.IDENTITY) {
-                this.in = new HttpDataInputStream(this.datareceiver);                            
+                this.in = new IdentityInputStream(this.inbuffer);                            
             } else {
-                this.in = new ContentLengthInputStream(datareceiver, len);
+                this.in = new ContentLengthInputStream(inbuffer, len);
             }
         }
         return request;
@@ -184,43 +165,28 @@
 
         if (HEADERLOG.isDebugEnabled()) {
             HEADERLOG.debug("<< " + response.getStatusLine().toString());
-            Header[] headers = response.getAllHeaders();
-            for (int i = 0; i < headers.length; i++) {
-                HEADERLOG.debug("<< " + headers[i].toString());
+            for (HeaderIterator it = response.headerIterator(); it.hasNext(); ) {
+                HEADERLOG.debug("<< " + it.nextHeader().toString());
             }
         }
         
-        this.charbuffer.clear();
-        BasicStatusLine.format(this.charbuffer, response.getStatusLine());
-        this.datatransmitter.writeLine(this.charbuffer);
-        for (Iterator it = response.headerIterator(); it.hasNext(); ) {
-            Header header = (Header) it.next();
-            if (header instanceof BufferedHeader) {
-                this.datatransmitter.writeLine(((BufferedHeader)header).getBuffer());
-            } else {
-                this.charbuffer.clear();
-                BasicHeader.format(this.charbuffer, header);
-                this.datatransmitter.writeLine(this.charbuffer);
-            }
-        }
-        this.charbuffer.clear();
-        this.datatransmitter.writeLine(this.charbuffer);
+        this.responseWriter.write(response);
 
         // Prepare output stream
         this.out = null;
-        HttpVersion ver = response.getStatusLine().getHttpVersion();
+        ProtocolVersion ver = response.getStatusLine().getProtocolVersion();
         HttpEntity entity = response.getEntity();
         if (entity != null) {
             long len = entity.getContentLength();
             if (entity.isChunked() && ver.greaterEquals(HttpVersion.HTTP_1_1)) {
-                this.out = new ChunkedOutputStream(this.datatransmitter);
+                this.out = new ChunkedOutputStream(this.outbuffer);
             } else if (len >= 0) {
-                this.out = new ContentLengthOutputStream(this.datatransmitter, len);
+                this.out = new ContentLengthOutputStream(this.outbuffer, len);
             } else {
-                this.out = new IdentityOutputStream(this.datatransmitter); 
+                this.out = new IdentityOutputStream(this.outbuffer); 
             }
         } else {
-            this.datatransmitter.flush();
+            this.outbuffer.flush();
         }
     }
     
@@ -236,7 +202,7 @@
         if (this.out != null) {
             this.out.flush();
         } else {
-            this.datatransmitter.flush();
+            this.outbuffer.flush();
         }
     }
 

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/server/AxisHttpRequestImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/server/AxisHttpRequestImpl.java?rev=594256&r1=594255&r2=594256&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/server/AxisHttpRequestImpl.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/server/AxisHttpRequestImpl.java Mon Nov 12 11:04:11 2007
@@ -21,16 +21,16 @@
 
 import java.io.IOException;
 import java.io.InputStream;
-import java.util.Iterator;
 
 import org.apache.http.Header;
+import org.apache.http.HeaderIterator;
 import org.apache.http.HttpException;
 import org.apache.http.HttpRequest;
-import org.apache.http.HttpVersion;
+import org.apache.http.ProtocolVersion;
 import org.apache.http.params.HttpParams;
+import org.apache.http.protocol.ExecutionContext;
 import org.apache.http.protocol.HTTP;
 import org.apache.http.protocol.HttpContext;
-import org.apache.http.protocol.HttpExecutionContext;
 import org.apache.http.protocol.HttpProcessor;
 
 public class AxisHttpRequestImpl implements AxisHttpRequest {
@@ -65,8 +65,8 @@
     }
     
     public void prepare() throws IOException, HttpException {
-        this.context.setAttribute(HttpExecutionContext.HTTP_CONNECTION, this.conn);
-        this.context.setAttribute(HttpExecutionContext.HTTP_REQUEST, this.request);
+        this.context.setAttribute(ExecutionContext.HTTP_CONNECTION, this.conn);
+        this.context.setAttribute(ExecutionContext.HTTP_REQUEST, this.request);
         
         this.httpproc.process(this.request, this.context);
     }
@@ -79,8 +79,8 @@
         return this.request.getRequestLine().getUri();
     }
 
-    public HttpVersion getHttpVersion() {
-        return this.request.getRequestLine().getHttpVersion();
+    public ProtocolVersion getProtocolVersion() {
+        return this.request.getRequestLine().getProtocolVersion();
     }
 
     public String getContentType() {
@@ -124,8 +124,12 @@
         return this.request.getLastHeader(name);
     }
 
-    public Iterator headerIterator() {
+    public HeaderIterator headerIterator() {
         return this.request.headerIterator();
+    }
+
+    public HeaderIterator headerIterator(final String name) {
+        return this.request.headerIterator(name);
     }
 
     public void removeHeader(final Header header) {

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/server/AxisHttpResponseImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/server/AxisHttpResponseImpl.java?rev=594256&r1=594255&r2=594256&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/server/AxisHttpResponseImpl.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/server/AxisHttpResponseImpl.java Mon Nov 12 11:04:11 2007
@@ -21,17 +21,17 @@
 
 import java.io.IOException;
 import java.io.OutputStream;
-import java.util.Iterator;
 
 import org.apache.axis2.transport.OutTransportInfo;
 import org.apache.http.Header;
+import org.apache.http.HeaderIterator;
 import org.apache.http.HttpException;
 import org.apache.http.HttpResponse;
-import org.apache.http.HttpVersion;
+import org.apache.http.ProtocolVersion;
 import org.apache.http.entity.BasicHttpEntity;
 import org.apache.http.params.HttpParams;
+import org.apache.http.protocol.ExecutionContext;
 import org.apache.http.protocol.HttpContext;
-import org.apache.http.protocol.HttpExecutionContext;
 import org.apache.http.protocol.HttpProcessor;
 
 public class AxisHttpResponseImpl implements AxisHttpResponse, OutTransportInfo {
@@ -86,8 +86,8 @@
         }
         this.commited = true;
         
-        this.context.setAttribute(HttpExecutionContext.HTTP_CONNECTION, this.conn);
-        this.context.setAttribute(HttpExecutionContext.HTTP_RESPONSE, this.response);
+        this.context.setAttribute(ExecutionContext.HTTP_CONNECTION, this.conn);
+        this.context.setAttribute(ExecutionContext.HTTP_RESPONSE, this.response);
         
         BasicHttpEntity entity = new BasicHttpEntity();
         entity.setChunked(true);
@@ -108,7 +108,7 @@
 
     public void sendError(int sc, final String msg) {
         assertNotCommitted();
-        HttpVersion ver = this.response.getHttpVersion();
+        ProtocolVersion ver = this.response.getProtocolVersion();
         this.response.setStatusLine(ver, sc, msg);
     }
 
@@ -127,8 +127,8 @@
         this.contentType = contentType;
     }
 
-    public HttpVersion getHttpVersion() {
-        return this.response.getHttpVersion();
+    public ProtocolVersion getProtocolVersion() {
+        return this.response.getProtocolVersion();
     }
 
     public void addHeader(final Header header) {
@@ -161,8 +161,12 @@
         return this.response.getLastHeader(name);
     }
 
-    public Iterator headerIterator() {
+    public HeaderIterator headerIterator() {
         return this.response.headerIterator();
+    }
+
+    public HeaderIterator headerIterator(String name) {
+        return this.response.headerIterator(name);
     }
 
     public void removeHeader(final Header header) {

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/server/AxisHttpService.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/server/AxisHttpService.java?rev=594256&r1=594255&r2=594256&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/server/AxisHttpService.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/server/AxisHttpService.java Mon Nov 12 11:04:11 2007
@@ -18,7 +18,18 @@
  */
 package org.apache.axis2.transport.http.server;
 
-import edu.emory.mathcs.backport.java.util.concurrent.CountDownLatch;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.SocketException;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.soap.SOAP11Constants;
+import org.apache.axiom.soap.SOAP12Constants;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
 import org.apache.axis2.addressing.AddressingHelper;
@@ -29,27 +40,29 @@
 import org.apache.axis2.description.TransportOutDescription;
 import org.apache.axis2.engine.AxisEngine;
 import org.apache.axis2.transport.RequestResponseTransport;
-import org.apache.axis2.transport.RequestResponseTransport.RequestResponseTransportStatus;
 import org.apache.axis2.transport.http.HTTPConstants;
 import org.apache.axis2.util.MessageContextBuilder;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.http.*;
+import org.apache.http.ConnectionReuseStrategy;
+import org.apache.http.Header;
+import org.apache.http.HttpEntityEnclosingRequest;
+import org.apache.http.HttpException;
+import org.apache.http.HttpRequest;
+import org.apache.http.HttpResponse;
+import org.apache.http.HttpResponseFactory;
+import org.apache.http.HttpStatus;
+import org.apache.http.HttpVersion;
+import org.apache.http.MethodNotSupportedException;
+import org.apache.http.ProtocolException;
+import org.apache.http.ProtocolVersion;
+import org.apache.http.UnsupportedHttpVersionException;
 import org.apache.http.params.HttpParams;
 import org.apache.http.params.HttpParamsLinker;
 import org.apache.http.protocol.HttpContext;
 import org.apache.http.protocol.HttpProcessor;
-import org.apache.axiom.soap.SOAP12Constants;
-import org.apache.axiom.soap.SOAP11Constants;
 
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.namespace.QName;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.SocketException;
-import java.util.HashMap;
-import java.util.Iterator;
+import edu.emory.mathcs.backport.java.util.concurrent.CountDownLatch;
 
 /**
  * This class is an extension of the defaulf HTTP service responsible for
@@ -128,7 +141,7 @@
         try {
             HttpRequest request = conn.receiveRequest();
             HttpParamsLinker.link(request, this.params);
-            HttpVersion ver = request.getRequestLine().getHttpVersion();
+            ProtocolVersion ver = request.getRequestLine().getProtocolVersion();
             if (!ver.lessEquals(HttpVersion.HTTP_1_1)) {
                 // Downgrade protocol version if greater than HTTP/1.1 
                 ver = HttpVersion.HTTP_1_1;

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/server/HttpServiceProcessor.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/server/HttpServiceProcessor.java?rev=594256&r1=594255&r2=594256&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/server/HttpServiceProcessor.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/server/HttpServiceProcessor.java Mon Nov 12 11:04:11 2007
@@ -19,20 +19,20 @@
 
 package org.apache.axis2.transport.http.server;
 
+import java.io.IOException;
+import java.net.SocketException;
+import java.net.SocketTimeoutException;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.http.ConnectionClosedException;
 import org.apache.http.HttpException;
+import org.apache.http.protocol.BasicHttpContext;
 import org.apache.http.protocol.HttpContext;
-import org.apache.http.protocol.HttpExecutionContext;
 
 import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicBoolean;
 import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicLong;
 
-import java.io.IOException;
-import java.net.SocketException;
-import java.net.SocketTimeoutException;
-
 /**
  * I/O processor intended to process requests and fill in responses.
  * 
@@ -79,7 +79,7 @@
 
     public void run() {
         LOG.debug("New connection thread");
-        HttpContext context = new HttpExecutionContext(null);
+        HttpContext context = new BasicHttpContext(null);
         try {
             while (! Thread.interrupted() && ! isDestroyed() && this.conn.isOpen()) {
                 this.httpservice.handleRequest(this.conn, context);

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/nhttp/ClientHandler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/nhttp/ClientHandler.java?rev=594256&r1=594255&r2=594256&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/nhttp/ClientHandler.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/nhttp/ClientHandler.java Mon Nov 12 11:04:11 2007
@@ -55,8 +55,8 @@
 import org.apache.http.params.HttpParams;
 import org.apache.http.params.HttpParamsLinker;
 import org.apache.http.protocol.BasicHttpProcessor;
+import org.apache.http.protocol.ExecutionContext;
 import org.apache.http.protocol.HttpContext;
-import org.apache.http.protocol.HttpExecutionContext;
 import org.apache.http.protocol.HttpProcessor;
 import org.apache.http.protocol.RequestConnControl;
 import org.apache.http.protocol.RequestContent;
@@ -132,8 +132,8 @@
         try {
             HttpContext context = conn.getContext();
 
-            context.setAttribute(HttpExecutionContext.HTTP_CONNECTION, conn);
-            context.setAttribute(HttpExecutionContext.HTTP_TARGET_HOST, axis2Req.getHttpHost());
+            context.setAttribute(ExecutionContext.HTTP_CONNECTION, conn);
+            context.setAttribute(ExecutionContext.HTTP_TARGET_HOST, axis2Req.getHttpHost());
 
             context.setAttribute(OUTGOING_MESSAGE_CONTEXT, axis2Req.getMsgContext());
             context.setAttribute(REQUEST_SOURCE_CHANNEL, axis2Req.getSourceChannel());
@@ -143,7 +143,7 @@
             this.httpProcessor.process(request, context);
 
             conn.submitRequest(request);
-            context.setAttribute(HttpExecutionContext.HTTP_REQUEST, request);
+            context.setAttribute(ExecutionContext.HTTP_REQUEST, request);
 
         } catch (IOException e) {
             handleException("I/O Error : " + e.getMessage(), e, conn);
@@ -162,8 +162,8 @@
             HttpContext context = conn.getContext();
             Axis2HttpRequest axis2Req = (Axis2HttpRequest) attachment;
 
-            context.setAttribute(HttpExecutionContext.HTTP_CONNECTION, conn);
-            context.setAttribute(HttpExecutionContext.HTTP_TARGET_HOST, axis2Req.getHttpHost());
+            context.setAttribute(ExecutionContext.HTTP_CONNECTION, conn);
+            context.setAttribute(ExecutionContext.HTTP_TARGET_HOST, axis2Req.getHttpHost());
 
             // allocate temporary buffers to process this request
             context.setAttribute(REQUEST_BUFFER, ByteBuffer.allocate(cfg.getBufferZise()));
@@ -177,7 +177,7 @@
             this.httpProcessor.process(request, context);
 
             conn.submitRequest(request);
-            context.setAttribute(HttpExecutionContext.HTTP_REQUEST, request);
+            context.setAttribute(ExecutionContext.HTTP_REQUEST, request);
 
         } catch (IOException e) {
             handleException("I/O Error : " + e.getMessage(), e, conn);
@@ -368,11 +368,11 @@
             context.setAttribute(RESPONSE_SINK_CHANNEL, responsePipe.sink());
 
             BasicHttpEntity entity = new BasicHttpEntity();
-            if (response.getStatusLine().getHttpVersion().greaterEquals(HttpVersion.HTTP_1_1)) {
+            if (response.getStatusLine().getProtocolVersion().greaterEquals(HttpVersion.HTTP_1_1)) {
                 entity.setChunked(true);
             }
             response.setEntity(entity);
-            context.setAttribute(HttpContext.HTTP_RESPONSE, response);
+            context.setAttribute(ExecutionContext.HTTP_RESPONSE, response);
 
             workerPool.execute(
                 new ClientWorker(cfgCtx, Channels.newInputStream(responsePipe.source()), response,

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/nhttp/ClientWorker.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/nhttp/ClientWorker.java?rev=594256&r1=594255&r2=594256&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/nhttp/ClientWorker.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/nhttp/ClientWorker.java Mon Nov 12 11:04:11 2007
@@ -48,14 +48,10 @@
 
     private static final Log log = LogFactory.getLog(ClientWorker.class);
 
-    /** the Axis2 configuration context */
-    private ConfigurationContext cfgCtx = null;
     /** the response message context that would be created */
     private MessageContext responseMsgCtx = null;
     /** the InputStream out of which the response body should be read */
     private InputStream in = null;
-    /** the original request message context */
-    private MessageContext outMsgCtx = null;
     /** the HttpResponse received */
     private HttpResponse response = null;
 
@@ -69,9 +65,7 @@
     public ClientWorker(ConfigurationContext cfgCtx, InputStream in,
         HttpResponse response, MessageContext outMsgCtx) {
 
-        this.cfgCtx = cfgCtx;
         this.in = in;
-        this.outMsgCtx = outMsgCtx;
         this.response = response;
 
         try {
@@ -165,13 +159,10 @@
             return;
         } catch (XMLStreamException e) {
             log.error("Error creating response SOAP envelope", e);
-        } catch (IOException e) {
-            log.error("Error closing input stream from which message was read", e);
         }
 
-        AxisEngine engine = new AxisEngine(cfgCtx);
         try {
-            engine.receive(responseMsgCtx);
+            AxisEngine.receive(responseMsgCtx);
         } catch (AxisFault af) {
             log.error("Fault processing response message through Axis2", af);
         }
@@ -183,9 +174,4 @@
         } catch (IOException ignore) {}
     }
 
-    // -------------- utility methods -------------
-    private void handleException(String msg, Exception e) throws AxisFault {
-        log.error(msg, e);
-        throw new AxisFault(msg, e);
-    }
 }

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/nhttp/ConnectionPool.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/nhttp/ConnectionPool.java?rev=594256&r1=594255&r2=594256&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/nhttp/ConnectionPool.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/nhttp/ConnectionPool.java Mon Nov 12 11:04:11 2007
@@ -19,7 +19,7 @@
 package org.apache.axis2.transport.nhttp;
 
 import org.apache.http.nio.NHttpClientConnection;
-import org.apache.http.protocol.HttpExecutionContext;
+import org.apache.http.protocol.ExecutionContext;
 import org.apache.http.HttpHost;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -78,7 +78,7 @@
     public static void release(NHttpClientConnection conn) {
 
         HttpHost host = (HttpHost) conn.getContext().getAttribute(
-            HttpExecutionContext.HTTP_TARGET_HOST);
+            ExecutionContext.HTTP_TARGET_HOST);
         String key = host.getHostName() + ":" + Integer.toString(host.getPort());
 
         List connections = (List) connMap.get(key);

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/nhttp/HttpCoreNIOSender.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/nhttp/HttpCoreNIOSender.java?rev=594256&r1=594255&r2=594256&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/nhttp/HttpCoreNIOSender.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/nhttp/HttpCoreNIOSender.java Mon Nov 12 11:04:11 2007
@@ -44,7 +44,6 @@
 import org.apache.axis2.transport.TransportSender;
 import org.apache.axis2.transport.TransportUtils;
 import org.apache.axis2.util.MessageContextBuilder;
-import org.apache.axis2.util.Utils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.http.HttpHost;
@@ -238,8 +237,8 @@
         if (headers != null && !headers.isEmpty()) {
             headers.remove(HTTP.CONN_DIRECTIVE);
             headers.remove(HTTP.TRANSFER_ENCODING);
-            headers.remove(HTTP.DATE_DIRECTIVE);
-            headers.remove(HTTP.SERVER_DIRECTIVE);
+            headers.remove(HTTP.DATE_HEADER);
+            headers.remove(HTTP.SERVER_HEADER);
             headers.remove(HTTP.CONTENT_TYPE);
             headers.remove(HTTP.CONTENT_LEN);
             headers.remove(HTTP.USER_AGENT);
@@ -314,7 +313,7 @@
 
         // if this is a dummy message to handle http 202 case with non-blocking IO
         // set the status code to 202 and the message body to an empty byte array (see below)
-        if (Utils.isExplicitlyTrue(msgContext, NhttpConstants.SC_ACCEPTED) &&
+        if (msgContext.isPropertyTrue(NhttpConstants.SC_ACCEPTED) &&
                 msgContext.getProperty(
                     //org.apache.sandesha2.Sandesha2Constants.MessageContextProperties.SEQUENCE_ID
                     "WSRMSequenceId") == null) {
@@ -337,7 +336,7 @@
 
         OutputStream out = worker.getOutputStream();
         try {
-            if (Utils.isExplicitlyTrue(msgContext, NhttpConstants.SC_ACCEPTED) &&
+            if (msgContext.isPropertyTrue(NhttpConstants.SC_ACCEPTED) &&
                 msgContext.getProperty(
                     //Sandesha2Constants.MessageContextProperties.SEQUENCE_ID
                     "WSRMSequenceId") == null) {

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/nhttp/HttpCoreRequestResponseTransport.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/nhttp/HttpCoreRequestResponseTransport.java?rev=594256&r1=594255&r2=594256&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/nhttp/HttpCoreRequestResponseTransport.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/nhttp/HttpCoreRequestResponseTransport.java Mon Nov 12 11:04:11 2007
@@ -25,7 +25,6 @@
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
 import org.apache.axis2.transport.RequestResponseTransport;
-import org.apache.axis2.transport.RequestResponseTransport.RequestResponseTransportStatus;
 
 /**
  * This interface is a point of control for Axis2 (and Sandesha2 in particular) to control

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/nhttp/LoggingIOSession.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/nhttp/LoggingIOSession.java?rev=594256&r1=594255&r2=594256&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/nhttp/LoggingIOSession.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/nhttp/LoggingIOSession.java Mon Nov 12 11:04:11 2007
@@ -53,6 +53,10 @@
         this.log = LogFactory.getLog(session.getClass());
     }
 
+    public int getStatus() {
+        return this.session.getStatus();
+    }
+
     public ByteChannel channel() {
         return this.channel;
     }
@@ -205,4 +209,4 @@
         
     }    
     
-}
\ No newline at end of file
+}

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/nhttp/NHttpConfiguration.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/nhttp/NHttpConfiguration.java?rev=594256&r1=594255&r2=594256&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/nhttp/NHttpConfiguration.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/nhttp/NHttpConfiguration.java Mon Nov 12 11:04:11 2007
@@ -19,13 +19,10 @@
 
 package org.apache.axis2.transport.nhttp;
 
-import org.apache.commons.logging.LogFactory;
-import org.apache.commons.logging.Log;
-import org.apache.http.params.HttpConnectionParams;
-
 import java.util.Properties;
-import java.io.IOException;
-import java.net.URL;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 /**
  * Store and manage properties that tune the nhttp transport

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/nhttp/ServerHandler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/nhttp/ServerHandler.java?rev=594256&r1=594255&r2=594256&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/nhttp/ServerHandler.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/nhttp/ServerHandler.java Mon Nov 12 11:04:11 2007
@@ -103,7 +103,7 @@
 
         HttpContext context = conn.getContext();
         HttpRequest request = conn.getHttpRequest();
-        context.setAttribute(HttpContext.HTTP_REQUEST, request);
+        context.setAttribute(ExecutionContext.HTTP_REQUEST, request);
 
         // allocate temporary buffers to process this request
         context.setAttribute(REQUEST_BUFFER, ByteBuffer.allocate(cfg.getBufferZise()));
@@ -116,7 +116,7 @@
             context.setAttribute(RESPONSE_SOURCE_CHANNEL, responsePipe.source());
 
             // create the default response to this request
-            HttpVersion httpVersion = request.getRequestLine().getHttpVersion();
+            ProtocolVersion httpVersion = request.getRequestLine().getProtocolVersion();
             HttpResponse response = responseFactory.newHttpResponse(
                 httpVersion, HttpStatus.SC_OK, context);
             response.setParams(this.params);
@@ -232,7 +232,8 @@
      * @param conn the connection being processed
      */
     public void timeout(final NHttpServerConnection conn) {
-        HttpRequest req = (HttpRequest) conn.getContext().getAttribute(HttpContext.HTTP_REQUEST);
+        HttpRequest req = (HttpRequest) conn.getContext().getAttribute(
+                ExecutionContext.HTTP_REQUEST);
         if (req != null) {
             log.debug("Connection Timeout for request to : " + req.getRequestLine().getUri() +
                 " Probably the keepalive connection was closed");
@@ -258,7 +259,7 @@
     public void exception(final NHttpServerConnection conn, final HttpException e) {
         HttpContext context = conn.getContext();
         HttpRequest request = conn.getHttpRequest();
-        HttpVersion ver = request.getRequestLine().getHttpVersion();
+        ProtocolVersion ver = request.getRequestLine().getProtocolVersion();
         HttpResponse response = responseFactory.newHttpResponse(
             ver, HttpStatus.SC_BAD_REQUEST, context);
         byte[] msg = EncodingUtils.getAsciiBytes("Malformed HTTP request: " + e.getMessage());

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/nhttp/ServerWorker.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/nhttp/ServerWorker.java?rev=594256&r1=594255&r2=594256&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/nhttp/ServerWorker.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/nhttp/ServerWorker.java Mon Nov 12 11:04:11 2007
@@ -18,34 +18,38 @@
  */
 package org.apache.axis2.transport.nhttp;
 
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.InetAddress;
+import java.net.NetworkInterface;
+import java.net.SocketException;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import org.apache.axiom.om.util.UUIDGenerator;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
-import org.apache.axis2.engine.AxisEngine;
-import org.apache.axis2.description.AxisService;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.context.OperationContext;
-import org.apache.axis2.transport.http.HTTPTransportUtils;
-import org.apache.axis2.transport.http.HTTPTransportReceiver;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.engine.AxisEngine;
 import org.apache.axis2.transport.RequestResponseTransport;
-import org.apache.axiom.om.util.UUIDGenerator;
+import org.apache.axis2.transport.http.HTTPTransportReceiver;
+import org.apache.axis2.transport.http.HTTPTransportUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.http.*;
+import org.apache.http.Header;
+import org.apache.http.HttpInetConnection;
+import org.apache.http.HttpRequest;
+import org.apache.http.HttpResponse;
+import org.apache.http.HttpStatus;
 import org.apache.http.nio.NHttpServerConnection;
 import org.apache.http.protocol.HTTP;
 import org.apache.ws.commons.schema.XmlSchema;
 
-import javax.xml.namespace.QName;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.util.*;
-import java.net.NetworkInterface;
-import java.net.SocketException;
-import java.net.InetAddress;
-
 /**
  * Processes an incoming request through Axis2. An instance of this class would be created to
  * process each unique request
@@ -318,9 +322,6 @@
 
                     } catch (AxisFault axisFault) {
                         handleException("Error writing ?xsd output to client", axisFault);
-                        return;
-                    } catch (IOException e) {
-                        handleException("Error writing ?xsd output to client", e);
                         return;
                     }
                 }

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/nhttp/Util.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/nhttp/Util.java?rev=594256&r1=594255&r2=594256&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/nhttp/Util.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/nhttp/Util.java Mon Nov 12 11:04:11 2007
@@ -21,7 +21,6 @@
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.addressing.AddressingConstants;
 import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.context.OperationContext;
 import org.apache.axis2.Constants;
 import org.apache.axis2.transport.http.HTTPTransportUtils;
 import org.apache.axis2.transport.http.HTTPConstants;

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/nhttp/util/PipeImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/nhttp/util/PipeImpl.java?rev=594256&r1=594255&r2=594256&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/nhttp/util/PipeImpl.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/nhttp/util/PipeImpl.java Mon Nov 12 11:04:11 2007
@@ -26,8 +26,6 @@
 import java.nio.channels.Channels;
 import java.nio.channels.ReadableByteChannel;
 import java.nio.channels.WritableByteChannel;
-import java.nio.channels.spi.SelectorProvider;
-import java.nio.ByteBuffer;
 import java.io.PipedInputStream;
 import java.io.PipedOutputStream;
 import java.io.IOException;

Modified: webservices/axis2/trunk/java/modules/parent/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/parent/pom.xml?rev=594256&r1=594255&r2=594256&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/parent/pom.xml (original)
+++ webservices/axis2/trunk/java/modules/parent/pom.xml Mon Nov 12 11:04:11 2007
@@ -107,7 +107,7 @@
         <geronimo.spec.annotation.version>1.1</geronimo.spec.annotation.version>
         <groovy.all.version>1.0-jsr-06</groovy.all.version>
         <intellij.version>5.0</intellij.version>
-        <httpcore.version>4.0-alpha5</httpcore.version>
+        <httpcore.version>4.0-alpha6</httpcore.version>
         <jalopy.version>1.5rc3</jalopy.version>
         <jaxb.api.version>2.0</jaxb.api.version>
         <jaxbri.version>2.0.5</jaxbri.version>



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org