cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1366835 - in /cxf/sandbox/dkulp_async_clients/http-hc: ./ src/main/java/org/apache/cxf/transport/http/asyncclient/
Date Sun, 29 Jul 2012 12:41:14 GMT
Author: olegk
Date: Sun Jul 29 12:41:13 2012
New Revision: 1366835

URL: http://svn.apache.org/viewvc?rev=1366835&view=rev
Log:
Added wire and i/o event logging

Added:
    cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/LoggingIOSession.java
  (with props)
    cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/LoggingNHttpClientConnection.java
  (with props)
    cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/LoggingNHttpClientConnectionFactory.java
  (with props)
    cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/Wire.java
  (with props)
Modified:
    cxf/sandbox/dkulp_async_clients/http-hc/pom.xml
    cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPTransportFactory.java

Modified: cxf/sandbox/dkulp_async_clients/http-hc/pom.xml
URL: http://svn.apache.org/viewvc/cxf/sandbox/dkulp_async_clients/http-hc/pom.xml?rev=1366835&r1=1366834&r2=1366835&view=diff
==============================================================================
--- cxf/sandbox/dkulp_async_clients/http-hc/pom.xml (original)
+++ cxf/sandbox/dkulp_async_clients/http-hc/pom.xml Sun Jul 29 12:41:13 2012
@@ -67,7 +67,10 @@
             <artifactId>cxf-rt-transports-http</artifactId>
             <version>${project.version}</version>
         </dependency>
-
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
         <dependency>
             <groupId>org.apache.httpcomponents</groupId>
             <artifactId>httpclient</artifactId>

Modified: cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPTransportFactory.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPTransportFactory.java?rev=1366835&r1=1366834&r2=1366835&view=diff
==============================================================================
--- cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPTransportFactory.java
(original)
+++ cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPTransportFactory.java
Sun Jul 29 12:41:13 2012
@@ -115,7 +115,8 @@ public class AsyncHTTPTransportFactory e
         // Create client-side HTTP protocol handler
         HttpAsyncRequestExecutor protocolHandler = new HttpAsyncRequestExecutor();
         // Create client-side I/O event dispatch
-        final IOEventDispatch ioEventDispatch = new DefaultHttpClientIODispatch(protocolHandler,
params);
+        final IOEventDispatch ioEventDispatch = new DefaultHttpClientIODispatch(protocolHandler,

+                new LoggingNHttpClientConnectionFactory(params));
         // Create client-side I/O reactor
         IOReactorConfig config = new IOReactorConfig();
         config.setTcpNoDelay(true);

Added: cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/LoggingIOSession.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/LoggingIOSession.java?rev=1366835&view=auto
==============================================================================
--- cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/LoggingIOSession.java
(added)
+++ cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/LoggingIOSession.java
Sun Jul 29 12:41:13 2012
@@ -0,0 +1,227 @@
+/**
+ * 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.
+ */
+
+package org.apache.cxf.transport.http.asyncclient;
+
+import java.io.IOException;
+import java.net.SocketAddress;
+import java.nio.ByteBuffer;
+import java.nio.channels.ByteChannel;
+import java.nio.channels.SelectionKey;
+
+import org.apache.http.nio.reactor.IOSession;
+import org.apache.http.nio.reactor.SessionBufferStatus;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Decorator class intended to transparently extend an {@link IOSession}
+ * with basic event logging capabilities using Commons Logging.
+ *
+ */
+public class LoggingIOSession implements IOSession {
+
+    private static final Logger LOG = LoggerFactory.getLogger(IOSession.class);
+
+    private final String id;
+    private final IOSession session;
+    private final ByteChannel channel;
+    private final Wire wirelog;
+    
+    public LoggingIOSession(final IOSession session, final String id) {
+        super();
+        if (session == null) {
+            throw new IllegalArgumentException("I/O session may not be null");
+        }
+        this.session = session;
+        this.channel = new LoggingByteChannel();
+        this.id = id;
+        this.wirelog = new Wire(this.id);
+    }
+
+    public ByteChannel channel() {
+        return this.channel;
+    }
+
+    public SocketAddress getLocalAddress() {
+        return this.session.getLocalAddress();
+    }
+
+    public SocketAddress getRemoteAddress() {
+        return this.session.getRemoteAddress();
+    }
+
+    public int getEventMask() {
+        return this.session.getEventMask();
+    }
+
+    private static String formatOps(int ops) {
+        StringBuilder buffer = new StringBuilder(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) {
+        this.session.setEventMask(ops);
+        if (LOG.isDebugEnabled()) {
+            LOG.debug(this.id + " " + this.session + ": Event mask set " + formatOps(ops));
+        }
+    }
+
+    public void setEvent(int op) {
+        this.session.setEvent(op);
+        if (LOG.isDebugEnabled()) {
+            LOG.debug(this.id + " " + this.session + ": Event set " + formatOps(op));
+        }
+    }
+
+    public void clearEvent(int op) {
+        this.session.clearEvent(op);
+        if (LOG.isDebugEnabled()) {
+            LOG.debug(this.id + " " + this.session + ": Event cleared " + formatOps(op));
+        }
+    }
+
+    public void close() {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug(this.id + " " + this.session + ": Close");
+        }
+        this.session.close();
+    }
+
+    public int getStatus() {
+        return this.session.getStatus();
+    }
+
+    public boolean isClosed() {
+        return this.session.isClosed();
+    }
+
+    public void shutdown() {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug(this.id + " " + this.session + ": Shutdown");
+        }
+        this.session.shutdown();
+    }
+
+    public int getSocketTimeout() {
+        return this.session.getSocketTimeout();
+    }
+
+    public void setSocketTimeout(int timeout) {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug(this.id + " " + this.session + ": Set timeout " + timeout);
+        }
+        this.session.setSocketTimeout(timeout);
+    }
+
+    public void setBufferStatus(final SessionBufferStatus status) {
+        this.session.setBufferStatus(status);
+    }
+
+    public boolean hasBufferedInput() {
+        return this.session.hasBufferedInput();
+    }
+
+    public boolean hasBufferedOutput() {
+        return this.session.hasBufferedOutput();
+    }
+
+    public Object getAttribute(final String name) {
+        return this.session.getAttribute(name);
+    }
+
+    public void setAttribute(final String name, final Object obj) {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug(this.id + " " + this.session + ": Set attribute " + name);
+        }
+        this.session.setAttribute(name, obj);
+    }
+
+    public Object removeAttribute(final String name) {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug(this.id + " " + this.session + ": Remove attribute " + name);
+        }
+        return this.session.removeAttribute(name);
+    }
+
+    @Override
+    public String toString() {
+        return this.id + " " + this.session.toString();
+    }
+
+    class LoggingByteChannel implements ByteChannel {
+
+        public int read(final ByteBuffer dst) throws IOException {
+            int bytesRead = session.channel().read(dst);
+            if (LOG.isDebugEnabled()) {
+                LOG.debug(id + " " + session + ": " + bytesRead + " bytes read");
+            }
+            if (bytesRead > 0 && wirelog.isEnabled()) {
+                ByteBuffer b = dst.duplicate();
+                int p = b.position();
+                b.limit(p);
+                b.position(p - bytesRead);
+                wirelog.input(b);
+            }
+            return bytesRead;
+        }
+
+        public int write(final ByteBuffer src) throws IOException {
+            int byteWritten = session.channel().write(src);
+            if (LOG.isDebugEnabled()) {
+                LOG.debug(id + " " + session + ": " + byteWritten + " bytes written");
+            }
+            if (byteWritten > 0 && wirelog.isEnabled()) {
+                ByteBuffer b = src.duplicate();
+                int p = b.position();
+                b.limit(p);
+                b.position(p - byteWritten);
+                wirelog.output(b);
+            }
+            return byteWritten;
+        }
+
+        public void close() throws IOException {
+            if (LOG.isDebugEnabled()) {
+                LOG.debug(id + " " + session + ": Channel close");
+            }
+            session.channel().close();
+        }
+
+        public boolean isOpen() {
+            return session.channel().isOpen();
+        }
+
+    }
+
+}
\ No newline at end of file

Propchange: cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/LoggingIOSession.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/LoggingIOSession.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/LoggingIOSession.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/LoggingNHttpClientConnection.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/LoggingNHttpClientConnection.java?rev=1366835&view=auto
==============================================================================
--- cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/LoggingNHttpClientConnection.java
(added)
+++ cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/LoggingNHttpClientConnection.java
Sun Jul 29 12:41:13 2012
@@ -0,0 +1,128 @@
+/**
+ * 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.
+ */
+
+package org.apache.cxf.transport.http.asyncclient;
+
+import java.io.IOException;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.apache.http.Header;
+import org.apache.http.HttpException;
+import org.apache.http.HttpRequest;
+import org.apache.http.HttpResponse;
+import org.apache.http.HttpResponseFactory;
+import org.apache.http.impl.nio.DefaultNHttpClientConnection;
+import org.apache.http.nio.NHttpClientEventHandler;
+import org.apache.http.nio.reactor.IOSession;
+import org.apache.http.nio.util.ByteBufferAllocator;
+import org.apache.http.params.HttpParams;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class LoggingNHttpClientConnection extends DefaultNHttpClientConnection {
+
+    private static final AtomicLong COUNT = new AtomicLong();
+
+    private static final Logger LOG = LoggerFactory.getLogger(DefaultNHttpClientConnection.class);
+    private static final Logger IOLOG = LoggerFactory.getLogger(IOSession.class);
+    private static final Logger HEADERLOG  = LoggerFactory.getLogger("org.apache.http.headers");
+    private static final Logger WIRELOG = LoggerFactory.getLogger("org.apache.http.wire");
+
+    private final String id;
+
+    public LoggingNHttpClientConnection(
+            final IOSession session,
+            final HttpResponseFactory responseFactory,
+            final ByteBufferAllocator allocator,
+            final HttpParams params) {
+        super(session, responseFactory, allocator, params);
+        this.id = "http-outgoing-" + COUNT.incrementAndGet();
+        if (IOLOG.isDebugEnabled() || WIRELOG.isDebugEnabled()) {
+            this.session = new LoggingIOSession(session, this.id);
+        }
+    }
+
+    @Override
+    public void close() throws IOException {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug(this.id + ": Close connection");
+        }
+        super.close();
+    }
+
+    @Override
+    public void shutdown() throws IOException {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug(this.id + ": Shutdown connection");
+        }
+        super.shutdown();
+    }
+
+    @Override
+    public void submitRequest(final HttpRequest request) throws IOException, HttpException
{
+        if (LOG.isDebugEnabled()) {
+            LOG.debug(this.id + ": "  + request.getRequestLine().toString());
+        }
+        super.submitRequest(request);
+    }
+
+    @Override
+    public void consumeInput(final NHttpClientEventHandler handler) {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug(this.id + ": Consume input");
+        }
+        super.consumeInput(handler);
+    }
+
+    @Override
+    public void produceOutput(final NHttpClientEventHandler handler) {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug(this.id + ": Produce output");
+        }
+        super.produceOutput(handler);
+    }
+
+    @Override
+    protected void onResponseReceived(final HttpResponse response) {
+        if (response != null && HEADERLOG.isDebugEnabled()) {
+            HEADERLOG.debug(this.id + " << " + response.getStatusLine().toString());
+            Header[] headers = response.getAllHeaders();
+            for (int i = 0; i < headers.length; i++) {
+                HEADERLOG.debug(this.id + " << " + headers[i].toString());
+            }
+        }
+    }
+
+    @Override
+    protected void onRequestSubmitted(final HttpRequest request) {
+        if (request != null && HEADERLOG.isDebugEnabled()) {
+            HEADERLOG.debug(id + " >> " + request.getRequestLine().toString());
+            Header[] headers = request.getAllHeaders();
+            for (int i = 0; i < headers.length; i++) {
+                HEADERLOG.debug(this.id + " >> " + headers[i].toString());
+            }
+        }
+    }
+
+    @Override
+    public String toString() {
+        return this.id;
+    }
+
+}

Propchange: cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/LoggingNHttpClientConnection.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/LoggingNHttpClientConnection.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/LoggingNHttpClientConnection.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/LoggingNHttpClientConnectionFactory.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/LoggingNHttpClientConnectionFactory.java?rev=1366835&view=auto
==============================================================================
--- cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/LoggingNHttpClientConnectionFactory.java
(added)
+++ cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/LoggingNHttpClientConnectionFactory.java
Sun Jul 29 12:41:13 2012
@@ -0,0 +1,55 @@
+/**
+ * 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.
+ */
+
+package org.apache.cxf.transport.http.asyncclient;
+
+import org.apache.http.HttpResponseFactory;
+import org.apache.http.annotation.Immutable;
+import org.apache.http.impl.DefaultHttpResponseFactory;
+import org.apache.http.impl.nio.DefaultNHttpClientConnection;
+import org.apache.http.impl.nio.DefaultNHttpClientConnectionFactory;
+import org.apache.http.nio.reactor.IOSession;
+import org.apache.http.nio.util.ByteBufferAllocator;
+import org.apache.http.nio.util.HeapByteBufferAllocator;
+import org.apache.http.params.HttpParams;
+
+@Immutable
+public class LoggingNHttpClientConnectionFactory extends DefaultNHttpClientConnectionFactory
{
+
+    public LoggingNHttpClientConnectionFactory(
+            final HttpResponseFactory responseFactory,
+            final ByteBufferAllocator allocator,
+            final HttpParams params) {
+        super(responseFactory, allocator, params);
+    }
+
+    public LoggingNHttpClientConnectionFactory(final HttpParams params) {
+        this(new DefaultHttpResponseFactory(), new HeapByteBufferAllocator(), params);
+    }
+
+    @Override
+    protected DefaultNHttpClientConnection createConnection(
+            final IOSession session,
+            final HttpResponseFactory responseFactory, 
+            final ByteBufferAllocator allocator, 
+            final HttpParams params) {
+        return new LoggingNHttpClientConnection(session, responseFactory, allocator, params);
+    }
+
+}

Propchange: cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/LoggingNHttpClientConnectionFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/LoggingNHttpClientConnectionFactory.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/LoggingNHttpClientConnectionFactory.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/Wire.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/Wire.java?rev=1366835&view=auto
==============================================================================
--- cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/Wire.java
(added)
+++ cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/Wire.java
Sun Jul 29 12:41:13 2012
@@ -0,0 +1,115 @@
+/**
+ * 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.
+ */
+
+package org.apache.cxf.transport.http.asyncclient;
+
+import java.nio.ByteBuffer;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+class Wire {
+
+    private static final Logger WIRELOG = LoggerFactory.getLogger("org.apache.http.wire");
+
+    private final String id;
+
+    public Wire(final String id) {
+        super();
+        this.id = id;
+    }
+
+    private void wire(final String header, final byte[] b, int pos, int off) {
+        StringBuilder buffer = new StringBuilder();
+        for (int i = 0; i < off; i++) {
+            int ch = b[pos + i];
+            if (ch == 13) {
+                buffer.append("[\\r]");
+            } else if (ch == 10) {
+                buffer.append("[\\n]\"");
+                buffer.insert(0, "\"");
+                buffer.insert(0, header);
+                WIRELOG.debug(this.id + " " + buffer.toString());
+                buffer.setLength(0);
+            } else if ((ch < 32) || (ch > 127)) {
+                buffer.append("[0x");
+                buffer.append(Integer.toHexString(ch));
+                buffer.append("]");
+            } else {
+                buffer.append((char) ch);
+            }
+        }
+        if (buffer.length() > 0) {
+            buffer.append('\"');
+            buffer.insert(0, '\"');
+            buffer.insert(0, header);
+            WIRELOG.debug(this.id + " " + buffer.toString());
+        }
+    }
+
+
+    public boolean isEnabled() {
+        return WIRELOG.isDebugEnabled();
+    }
+
+    public void output(final byte[] b, int pos, int off) {
+        wire("<< ", b, pos, off);
+    }
+
+    public void input(final byte[] b, int pos, int off) {
+        wire(">> ", b, pos, off);
+    }
+
+    public void output(byte[] b) {
+        output(b, 0, b.length);
+    }
+
+    public void input(byte[] b) {
+        input(b, 0, b.length);
+    }
+
+    public void output(int b) {
+        output(new byte[] {(byte) b});
+    }
+
+    public void input(int b) {
+        input(new byte[] {(byte) b});
+    }
+
+    public void output(final ByteBuffer b) {
+        if (b.hasArray()) {
+            output(b.array(), b.arrayOffset() + b.position(), b.remaining());
+        } else {
+            byte[] tmp = new byte[b.remaining()];
+            b.get(tmp);
+            output(tmp);
+        }
+    }
+
+    public void input(final ByteBuffer b) {
+        if (b.hasArray()) {
+            input(b.array(), b.arrayOffset() + b.position(), b.remaining());
+        } else {
+            byte[] tmp = new byte[b.remaining()];
+            b.get(tmp);
+            input(tmp);
+        }
+    }
+
+}

Propchange: cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/Wire.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/Wire.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/Wire.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message