synapse-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ruwan Linton" <ruwan.lin...@gmail.com>
Subject Re: [PATCH] Upgrades Synapse NHttp to HttpCore 4.0-ALPHA5-SNAPSHOT, improves logging
Date Mon, 25 Jun 2007 08:16:12 GMT
On 6/25/07, Oleg Kalnichevski <olegk@apache.org> wrote:
>
> On Mon, 2007-06-25 at 11:44 +0530, Ruwan Linton wrote:
> > Hi Oleg,
> >
> > I am done with the performance tests. I think now synapse is a little
> > bit faster than earlier.
> >
> > No issues with the new version and I have applied the patch.
> >
> > Thanks,
> > Ruwan.
> >
>
> Great! Many thanks, Ruwan. We will go ahead with the release.
>

You are more than welcome. Congratulations for the coming release.

Ruwan.

Cheers
>
> Oleg
>
> > On 6/21/07, Oleg Kalnichevski <olegk@apache.org> wrote:
> >         On Thu, 2007-06-21 at 08:56 +0530, Ruwan Linton wrote:
> >         > Yes asankha,
> >         >
> >         > I will be able to run some load tests and check this.
> >         >
> >         > Oleg, I will get back to you ASAP,
> >         >
> >         > Thanks,
> >         > Ruwan.
> >         >
> >
> >         Take it easy, guys. The release can wait.
> >
> >         Oleg
> >
> >         > On 6/20/07, Asankha C. Perera <asankha@wso2.com> wrote:
> >         >         Hi Oleg
> >         >
> >         >         Sorry for the delay in response. I will run this
> >         through some
> >         >         load tests and get back to you soon. I will be
> >         traveling next
> >         >         week, and thus if I am unable to perform this on
> >         time, I will
> >         >         check if Ruwan would be able to get back to you by
> >         early next
> >         >         week.
> >         >
> >         >         thanks
> >         >         asankha
> >         >
> >         >         Oleg Kalnichevski wrote:
> >         >         > Hi Asankha
> >         >         >
> >         >         > I am submitting for your consideration a patch
> >         that upgrades Synapse
> >         >         > NHttp transport to HttpCore 4.0-ALPHA5-SNAPSHOT
> >         and adds some
> >         >         > incremental improvements to the I/O debug logging
> >         (such as prettier I/O
> >         >         >
> >         >         > session logs and optional HTTP header logs)
> >         >         >
> >         >         > All tests pass for me, but please do run a few
> >         stress tests to make sure
> >         >         > there are no regressions.
> >         >         >
> >         >         > Provided everything goes well HttpCore 4.0-ALPHA5
> >         release is expected
> >         >         >
> >         >         > within the next two weeks.
> >         >         >
> >         >         > Cheers
> >         >         >
> >         >         > Oleg
> >         >         >
> >         >         >
> >         >         >
> >         ____________________________________________________________
> >         >         >
> >         >         > Index:
> >
> modules/nhttp/src/org/apache/axis2/transport/nhttp/Axis2HttpRequest.java
> >         >         >
> >
> ===================================================================
> >         >         > ---
> >
> modules/nhttp/src/org/apache/axis2/transport/nhttp/Axis2HttpRequest.java        (revision
> 548631)
> >         >         >
> >         >         > +++
> >
> modules/nhttp/src/org/apache/axis2/transport/nhttp/Axis2HttpRequest.java        (working
> copy)
> >         >         > @@ -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
> >         >         > Index:
> >
> modules/nhttp/src/org/apache/axis2/transport/nhttp/LoggingNHttpClientHandler.java
> >         >         >
> >         >         >
> >
> ===================================================================
> >         >         > ---
> >
> modules/nhttp/src/org/apache/axis2/transport/nhttp/LoggingNHttpClientHandler.java
> (revision 548631)
> >         >         > +++
> >
> modules/nhttp/src/org/apache/axis2/transport/nhttp/LoggingNHttpClientHandler.java
> (working copy)
> >         >         >
> >         >         > @@ -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) {
> >         >         >
> >         >         > Index:
> >
> modules/nhttp/src/org/apache/axis2/transport/nhttp/SSLServerIOEventDispatch.java
> >         >         >
> >
> ===================================================================
> >         >         > ---
> >
> modules/nhttp/src/org/apache/axis2/transport/nhttp/SSLServerIOEventDispatch.java        (revision
> 548631)
> >         >         >
> >         >         > +++
> >
> modules/nhttp/src/org/apache/axis2/transport/nhttp/SSLServerIOEventDispatch.java        (working
> copy)
> >         >         > @@ -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();
> >         >         >
> >         >         > Index:
> >
> modules/nhttp/src/org/apache/axis2/transport/nhttp/PlainServerIOEventDispatch.java
> >         >         >
> >
> ===================================================================
> >         >         > ---
> >
> modules/nhttp/src/org/apache/axis2/transport/nhttp/PlainServerIOEventDispatch.java      (revision
> 548631)
> >         >         >
> >         >         > +++
> >
> modules/nhttp/src/org/apache/axis2/transport/nhttp/PlainServerIOEventDispatch.java      (working
> copy)
> >         >         > @@ -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);
> >         >         > Index:
> >
> modules/nhttp/src/org/apache/axis2/transport/nhttp/SSLClientIOEventDispatch.java
> >         >         >
> >         >         >
> >
> ===================================================================
> >         >         > ---
> >
> modules/nhttp/src/org/apache/axis2/transport/nhttp/SSLClientIOEventDispatch.java        (revision
> 548631)
> >         >         > +++
> >
> modules/nhttp/src/org/apache/axis2/transport/nhttp/SSLClientIOEventDispatch.java        (working
> copy)
> >         >         >
> >         >         > @@ -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 ();
> >         >         > Index:
> >
> modules/nhttp/src/org/apache/axis2/transport/nhttp/LoggingNHttpServerConnection.java
> >         >         >
> >         >         >
> >
> ===================================================================
> >         >         > ---
> >
> modules/nhttp/src/org/apache/axis2/transport/nhttp/LoggingNHttpServerConnection.java    (revision
> 0)
> >         >         > +++
> >
> modules/nhttp/src/org/apache/axis2/transport/nhttp/LoggingNHttpServerConnection.java    (revision
> 0)
> >         >         >
> >         >         > @@ -0,0 +1,76 @@
> >         >         > +/*
> >         >         > + * $HeadURL$
> >         >         > + * $Revision$
> >         >         > + * $Date$
> >         >         > + *
> >         >         > + *
> >
> ====================================================================
> >         >         > + * Licensed to the Apache Software Foundation
> >         (ASF) under one
> >         >         >
> >         >         > + * or more contributor license agreements.  See
> >         the NOTICE file
> >         >         > + * distributed with this work for additional
> >         information
> >         >         > + * regarding copyright ownership.  The ASF
> >         licenses this file
> >         >         > + * to you under the Apache License, Version
> >         >         > 2.0 (the
> >         >         > + * "License"); you may not use this file except
> >         in compliance
> >         >         > + * with the License.  You may obtain a copy of
> >         the License at
> >         >         > + *
> >         >         > + *
> >         >         > http://www.apache.org/licenses/LICENSE-2.0
> >         >         > + *
> >         >         > + * Unless required by applicable law or agreed to
> >         in writing,
> >         >         > + * software distributed under the License is
> >         distributed on an
> >         >         > + * "AS IS" BASIS, WITHOUT WARRANTIES OR
> >         CONDITIONS OF ANY
> >         >         > + * KIND, either express or implied.  See the
> >         License for the
> >         >         > + * specific language governing permissions and
> >         limitations
> >         >         > + * under the License.
> >         >         > + *
> >
> ====================================================================
> >         >         > + *
> >         >         > + * This software consists of voluntary
> >         contributions made by many
> >         >         > + * individuals on behalf of the Apache Software
> >         Foundation.  For more
> >         >         >
> >         >         > + * information on the Apache Software Foundation,
> >         please see
> >         >         > + * <http://www.apache.org/>.
> >         >         > + *
> >         >         >
> >         >         > + */
> >         >         > +
> >         >         > +package org.apache.axis2.transport.nhttp;
> >         >         > +
> >         >         > +import java.io.IOException;
> >         >         > +
> >         >         > +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.HttpRequestFactory;
> >         >         > +import org.apache.http.HttpResponse;
> >         >         > +import
> >         org.apache.http.impl.nio.DefaultNHttpServerConnection;
> >         >         > +import org.apache.http.nio.reactor.IOSession
> >         >         > ;
> >         >         > +import
> >         org.apache.http.nio.util.ByteBufferAllocator;
> >         >         > +import org.apache.http.params.HttpParams;
> >         >         > +
> >         >         > +public class LoggingNHttpServerConnection extends
> >         DefaultNHttpServerConnection {
> >         >         > +
> >         >         > +    private final Log log;
> >         >         >
> >         >         > +    private final Log headerlog;
> >         >         > +
> >         >         > +    public LoggingNHttpServerConnection(
> >         >         > +            final IOSession session,
> >         >         > +            final HttpRequestFactory
> >         requestFactory,
> >         >         > +            final ByteBufferAllocator allocator,
> >         >         >
> >         >         > +            final HttpParams params) {
> >         >         > +        super(session, requestFactory, allocator,
> >         params);
> >         >         > +        this.log =
> >         LogFactory.getLog(DefaultNHttpServerConnection.class);
> >         >         > +        this.headerlog = LogFactory.getLog
> >         >         > ("org.apache.axis2.transport.nhttp.headers ");
> >         >         > +    }
> >         >         > +
> >         >         > +    public void submitResponse(final HttpResponse
> >         response) throws IOException, HttpException {
> >         >         > +        if (this.log.isDebugEnabled ()) {
> >         >         > +
> >         >         > this.log.debug("HTTP connection " + this + ": "  +
> >         response.getStatusLine().toString());
> >         >         > +        }
> >         >         > +         super.submitResponse(response);
> >         >         > +        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());
> >         >         > +            }
> >         >         > +        }
> >         >         > +    }
> >         >         > +
> >         >         > +}
> >         >         > \ No newline at end of file
> >         >         >
> >         >         > Property changes on:
> >
> modules/nhttp/src/org/apache/axis2/transport/nhttp/LoggingNHttpServerConnection.java
> >         >         >
> >         >         >
> >
> ___________________________________________________________________
> >         >         > Name: svn:mime-type
> >         >         >    + text/plain
> >         >         > Name: svn:keywords
> >         >         >    + Date Author Id Revision HeadURL
> >         >         > Name: svn:eol-style
> >         >         >    + native
> >         >         >
> >         >         >
> >         >         > Index:
> >
> modules/nhttp/src/org/apache/axis2/transport/nhttp/ClientHandler.java
> >         >         >
> >
> ===================================================================
> >         >         > ---
> >
> modules/nhttp/src/org/apache/axis2/transport/nhttp/ClientHandler.java
> (revision 548631)
> >         >         >
> >         >         > +++
> >
> modules/nhttp/src/org/apache/axis2/transport/nhttp/ClientHandler.java
> (working copy)
> >         >         > @@ -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);
> >         >         > Index:
> >
> modules/nhttp/src/org/apache/axis2/transport/nhttp/PlainClientIOEventDispatch.java
> >         >         >
> >
> ===================================================================
> >         >         > ---
> >
> modules/nhttp/src/org/apache/axis2/transport/nhttp/PlainClientIOEventDispatch.java      (revision
> 548631)
> >         >         >
> >         >         > +++
> >
> modules/nhttp/src/org/apache/axis2/transport/nhttp/PlainClientIOEventDispatch.java      (working
> copy)
> >         >         > @@ -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);
> >         >         >
> >         >         > Index:
> >
> modules/nhttp/src/org/apache/axis2/transport/nhttp/LoggingIOSession.java
> >         >         >
> >
> ===================================================================
> >         >         >
> >         >         > ---
> >
> modules/nhttp/src/org/apache/axis2/transport/nhttp/LoggingIOSession.java        (revision
> 548631)
> >         >         > +++
> >
> modules/nhttp/src/org/apache/axis2/transport/nhttp/LoggingIOSession.java        (working
> copy)
> >         >         > @@ -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);
> >         >         >      }
> >         >         > @@ -103,6 +123,13 @@
> >         >         >          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() {
> >         >         >          return this.session.getSocketTimeout();
> >         >         >      }
> >         >         > Index:
> >
> modules/nhttp/src/org/apache/axis2/transport/nhttp/LoggingNHttpServiceHandler.java
> >         >         >
> >         >         >
> >
> ===================================================================
> >         >         > ---
> >
> modules/nhttp/src/org/apache/axis2/transport/nhttp/LoggingNHttpServiceHandler.java      (revision
> 548631)
> >         >         > +++
> >
> modules/nhttp/src/org/apache/axis2/transport/nhttp/LoggingNHttpServiceHandler.java      (working
> copy)
> >         >         >
> >         >         > @@ -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) {
> >         >         > Index:
> >
> modules/nhttp/src/org/apache/axis2/transport/nhttp/LoggingNHttpClientConnection.java
> >         >         >
> >
> ===================================================================
> >         >         >
> >         >         > ---
> >
> modules/nhttp/src/org/apache/axis2/transport/nhttp/LoggingNHttpClientConnection.java    (revision
> 0)
> >         >         > +++
> >
> modules/nhttp/src/org/apache/axis2/transport/nhttp/LoggingNHttpClientConnection.java    (revision
> 0)
> >         >         > @@ -0,0 +1,76 @@
> >         >         >
> >         >         > +/*
> >         >         > + * $HeadURL$
> >         >         > + * $Revision$
> >         >         > + * $Date$
> >         >         > + *
> >         >         > + *
> >
> ====================================================================
> >         >         > + * Licensed to the Apache Software Foundation
> >         (ASF) under one
> >         >         > + * or more contributor license agreements.  See
> >         the NOTICE file
> >         >         >
> >         >         > + * distributed with this work for additional
> >         information
> >         >         > + * regarding copyright ownership.  The ASF
> >         licenses this file
> >         >         > + * to you under the Apache License, Version 2.0
> >         (the
> >         >         > + * "License"); you may not use this file except
> >         in compliance
> >         >         >
> >         >         > + * with the License.  You may obtain a copy of
> >         the License at
> >         >         > + *
> >         >         > + *   http://www.apache.org/licenses/LICENSE-2.0
> >         >         >
> >         >         > + *
> >         >         > + * Unless required by applicable law or agreed to
> >         in writing,
> >         >         > + * software distributed under the License is
> >         distributed on an
> >         >         > + * "AS IS" BASIS, WITHOUT WARRANTIES OR
> >         CONDITIONS OF ANY
> >         >         > + * KIND, either express or implied.  See the
> >         License for the
> >         >         > + * specific language governing permissions and
> >         limitations
> >         >         > + * under the License.
> >         >         > + *
> >
> ====================================================================
> >         >         > + *
> >         >         > + * This software consists of voluntary
> >         contributions made by many
> >         >         > + * individuals on behalf of the Apache Software
> >         Foundation.  For more
> >         >         >
> >         >         > + * information on the Apache Software Foundation,
> >         please see
> >         >         > + * <http://www.apache.org/>.
> >         >         > + *
> >         >         >
> >         >         > + */
> >         >         > +
> >         >         > +package org.apache.axis2.transport.nhttp;
> >         >         > +
> >         >         > +import java.io.IOException;
> >         >         > +
> >         >         > +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.HttpResponseFactory;
> >         >         > +import
> >         org.apache.http.impl.nio.DefaultNHttpClientConnection;
> >         >         > +import org.apache.http.nio.reactor.IOSession
> >         >         > ;
> >         >         > +import
> >         org.apache.http.nio.util.ByteBufferAllocator;
> >         >         > +import org.apache.http.params.HttpParams;
> >         >         > +
> >         >         > +public class LoggingNHttpClientConnection extends
> >         DefaultNHttpClientConnection {
> >         >         > +
> >         >         > +    private final Log log;
> >         >         >
> >         >         > +    private final Log headerlog;
> >         >         > +
> >         >         > +    public LoggingNHttpClientConnection(
> >         >         > +            final IOSession session,
> >         >         > +            final HttpResponseFactory
> >         responseFactory,
> >         >         > +            final ByteBufferAllocator allocator,
> >         >         >
> >         >         > +            final HttpParams params) {
> >         >         > +        super(session, responseFactory,
> >         allocator, params);
> >         >         > +        this.log =
> >         LogFactory.getLog(DefaultNHttpClientConnection.class);
> >         >         > +        this.headerlog = LogFactory.getLog
> >         >         > ("org.apache.axis2.transport.nhttp.headers ");
> >         >         > +    }
> >         >         > +
> >         >         > +    public void submitRequest(final HttpRequest
> >         request) throws IOException, HttpException {
> >         >         > +        if (this.log.isDebugEnabled ()) {
> >         >         > +
> >         >         > this.log.debug("HTTP connection " + this + ": "  +
> >         request.getRequestLine().toString());
> >         >         > +        }
> >         >         > +         super.submitRequest(request);
> >         >         > +        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());
> >         >         > +            }
> >         >         > +        }
> >         >         > +    }
> >         >         > +
> >         >         > +}
> >         >         > \ No newline at end of file
> >         >         >
> >         >         > Property changes on:
> >
> modules/nhttp/src/org/apache/axis2/transport/nhttp/LoggingNHttpClientConnection.java
> >         >         >
> >         >         >
> >
> ___________________________________________________________________
> >         >         > Name: svn:mime-type
> >         >         >    + text/plain
> >         >         > Name: svn:keywords
> >         >         >    + Date Author Id Revision HeadURL
> >         >         > Name: svn:eol-style
> >         >         >    + native
> >         >         >
> >         >         >
> >         >         > Index: pom.xml
> >         >         >
> >
> ===================================================================
> >         >         > --- pom.xml (revision 548631)
> >         >         > +++ pom.xml (working copy)
> >         >         > @@ -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>1.0-RC2-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:
> >         >         > synapse-dev-unsubscribe@ws.apache.org
> >         >         > For additional commands, e-mail:
> >         synapse-dev-help@ws.apache.org
> >         >
> >
> --------------------------------------------------------------------- To
> unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org For additional
> commands, e-mail: synapse-dev-help@ws.apache.org
> >         >
> >         >
> >         >
> >         > --
> >         > Ruwan Linton
> >         > http://www.wso2.org - "Oxygenating the Web Services
> >         Platform"
> >
> >
> >
> ---------------------------------------------------------------------
> >         To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
> >         For additional commands, e-mail:
> >         synapse-dev-help@ws.apache.org
> >
> >
> >
> >
> > --
> > Ruwan Linton
> > http://www.wso2.org - "Oxygenating the Web Services Platform"
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: synapse-dev-help@ws.apache.org
>
>


-- 
Ruwan Linton
http://www.wso2.org - "Oxygenating the Web Services Platform"

Mime
View raw message