You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@synapse.apache.org by hi...@apache.org on 2013/07/24 21:04:19 UTC
svn commit: r1506662 [2/2] - in /synapse/trunk/java: ./
modules/integration/src/test/java/org/apache/synapse/samples/framework/clients/
modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/rest/
modules/integration/src/test/reso...
Modified: synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/PassThroughHttpSSLListener.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/PassThroughHttpSSLListener.java?rev=1506662&r1=1506661&r2=1506662&view=diff
==============================================================================
--- synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/PassThroughHttpSSLListener.java (original)
+++ synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/PassThroughHttpSSLListener.java Wed Jul 24 19:04:18 2013
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.synapse.transport.passthru;
import org.apache.axiom.om.OMElement;
@@ -24,17 +25,16 @@ import org.apache.axis2.description.Para
import org.apache.axis2.description.TransportInDescription;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.http.impl.nio.SSLServerIOEventDispatch;
-import org.apache.http.impl.nio.reactor.SSLIOSessionHandler;
-import org.apache.http.nio.NHttpServiceHandler;
+import org.apache.http.nio.NHttpServerEventHandler;
import org.apache.http.nio.reactor.IOEventDispatch;
+import org.apache.http.nio.reactor.IOSession;
+import org.apache.http.nio.reactor.ssl.SSLSetupHandler;
import org.apache.http.params.HttpParams;
import javax.net.ssl.*;
import javax.xml.namespace.QName;
import java.io.FileInputStream;
import java.io.IOException;
-import java.net.SocketAddress;
import java.security.GeneralSecurityException;
import java.security.KeyStore;
@@ -42,10 +42,10 @@ public class PassThroughHttpSSLListener
private Log log = LogFactory.getLog(PassThroughHttpSSLListener.class);
- protected IOEventDispatch getEventDispatch(
- NHttpServiceHandler handler, SSLContext sslContext,
- SSLIOSessionHandler sslIOSessionHandler, HttpParams params) {
- return new SSLServerIOEventDispatch(handler, sslContext, sslIOSessionHandler, params);
+ @Override
+ protected IOEventDispatch getEventDispatch(NHttpServerEventHandler handler, SSLContext sslContext,
+ SSLSetupHandler sslSetupHandler, HttpParams params) {
+ return new SSLSourceIOEventDispatch(handler, sslContext, sslSetupHandler, params);
}
/**
@@ -140,23 +140,14 @@ public class PassThroughHttpSSLListener
}
}
- /**
- * Create the SSLIOSessionHandler to initialize the SSL session / engine, and request for
- * client authentication at the following levels, through an Axis2 transport configuration
- * parameter as follows:
- * SSLVerifyClient - none, optional, require
- *
- * @param transportIn the Axis2 transport configuration
- * @return the SSLIOSessionHandler to be used
- * @throws AxisFault if a configuration error occurs
- */
- protected SSLIOSessionHandler getSSLIOSessionHandler(TransportInDescription transportIn) throws AxisFault {
+ protected SSLSetupHandler getSSLSetupHandler(TransportInDescription transportIn)
+ throws AxisFault {
final Parameter clientAuth = transportIn.getParameter("SSLVerifyClient");
- return new SSLIOSessionHandler() {
+ return new SSLSetupHandler() {
- public void initalize(SSLEngine sslengine, HttpParams params) {
+ public void initalize(SSLEngine sslengine) {
if (clientAuth != null) {
if ("optional".equals(clientAuth.getValue())) {
sslengine.setWantClientAuth(true);
@@ -166,8 +157,9 @@ public class PassThroughHttpSSLListener
}
}
- public void verify(SocketAddress removeAddress, SSLSession session)
- throws SSLException {}
+ public void verify(IOSession ioSession, SSLSession sslSession) throws SSLException {
+
+ }
};
}
}
Modified: synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/PassThroughHttpSSLSender.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/PassThroughHttpSSLSender.java?rev=1506662&r1=1506661&r2=1506662&view=diff
==============================================================================
--- synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/PassThroughHttpSSLSender.java (original)
+++ synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/PassThroughHttpSSLSender.java Wed Jul 24 19:04:18 2013
@@ -26,10 +26,10 @@ import org.apache.axis2.description.Tran
import org.apache.axis2.transport.base.ParamUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.http.impl.nio.reactor.SSLSetupHandler;
-import org.apache.http.nio.NHttpClientHandler;
+import org.apache.http.nio.NHttpClientEventHandler;
import org.apache.http.nio.reactor.IOEventDispatch;
import org.apache.http.nio.reactor.IOSession;
+import org.apache.http.nio.reactor.ssl.SSLSetupHandler;
import org.apache.http.params.HttpParams;
import javax.net.ssl.*;
@@ -46,21 +46,17 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
-
public class PassThroughHttpSSLSender extends PassThroughHttpSender {
+
private Log log = LogFactory.getLog(PassThroughHttpSSLSender.class);
- protected IOEventDispatch getEventDispatch(NHttpClientHandler handler,
+ protected IOEventDispatch getEventDispatch(NHttpClientEventHandler handler,
SSLContext sslContext,
SSLSetupHandler sslIOSessionHandler,
HttpParams params,
- TransportOutDescription transportOut)
- throws AxisFault {
+ TransportOutDescription transportOut) throws AxisFault {
- SSLTargetIOEventDispatch dispatch = new SSLTargetIOEventDispatch(handler, sslContext,
- sslIOSessionHandler, params);
- dispatch.setContextMap(getCustomSSLContexts(transportOut));
- return dispatch;
+ return new SSLTargetIOEventDispatch(handler, sslContext, sslIOSessionHandler, params);
}
/**
@@ -288,7 +284,7 @@ public class PassThroughHttpSSLSender ex
return new SSLSetupHandler() {
- public void initalize(SSLEngine sslengine, HttpParams params) {
+ public void initalize(SSLEngine sslengine) {
}
public void verify(IOSession ioSession, SSLSession session) throws SSLException {
Modified: synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/PassThroughHttpSender.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/PassThroughHttpSender.java?rev=1506662&r1=1506661&r2=1506662&view=diff
==============================================================================
--- synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/PassThroughHttpSender.java (original)
+++ synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/PassThroughHttpSender.java Wed Jul 24 19:04:18 2013
@@ -43,12 +43,12 @@ import org.apache.commons.logging.LogFac
import org.apache.http.HttpException;
import org.apache.http.HttpStatus;
import org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor;
-import org.apache.http.impl.nio.reactor.SSLSetupHandler;
-import org.apache.http.nio.NHttpClientHandler;
+import org.apache.http.nio.NHttpClientEventHandler;
import org.apache.http.nio.NHttpServerConnection;
import org.apache.http.nio.reactor.IOEventDispatch;
import org.apache.http.nio.reactor.IOReactorException;
import org.apache.http.nio.reactor.IOReactorExceptionHandler;
+import org.apache.http.nio.reactor.ssl.SSLSetupHandler;
import org.apache.http.params.HttpParams;
import org.apache.synapse.transport.nhttp.NhttpConstants;
import org.apache.synapse.transport.nhttp.util.MessageFormatterDecoratorFactory;
@@ -114,7 +114,10 @@ public class PassThroughHttpSender exten
public void init(ConfigurationContext configurationContext,
TransportOutDescription transportOutDescription) throws AxisFault {
- log.info("Initializing Pass-through HTTP/S Sender...");
+
+ if (log.isDebugEnabled()) {
+ log.debug("Initializing Pass-through HTTP/S Sender...");
+ }
// is this an SSL Sender?
SSLContext sslContext = getSSLContext(transportOutDescription);
@@ -175,9 +178,8 @@ public class PassThroughHttpSender exten
String prefix = namePrefix + "-Sender I/O dispatcher";
ioReactor = new DefaultConnectingIOReactor(
- targetConfiguration.getIOThreadsPerReactor(),
- new NativeThreadFactory(new ThreadGroup(prefix + " Thread Group"), prefix),
- targetConfiguration.getHttpParameters());
+ targetConfiguration.getReactorConfig(),
+ new NativeThreadFactory(new ThreadGroup(prefix + " Thread Group"), prefix));
ioReactor.setExceptionHandler(new IOReactorExceptionHandler() {
@@ -231,7 +233,7 @@ public class PassThroughHttpSender exten
state = BaseConstants.STARTED;
- log.info("Pass-through " + namePrefix + " Sender started...");
+ log.info("Pass-through " + namePrefix + " sender started...");
}
public void cleanup(org.apache.axis2.context.MessageContext messageContext) throws AxisFault {
@@ -247,7 +249,7 @@ public class PassThroughHttpSender exten
}
- public InvocationResponse invoke(org.apache.axis2.context.MessageContext msgContext) throws AxisFault {
+ public InvocationResponse invoke(MessageContext msgContext) throws AxisFault {
// remove unwanted HTTP headers (if any from the current message)
PassThroughTransportUtils.removeUnwantedHeaders(msgContext,
targetConfiguration.isPreserveServerHeader(),
@@ -266,7 +268,8 @@ public class PassThroughHttpSender exten
Pipe pipe = new Pipe(targetConfiguration.getBufferFactory().getBuffer(),
"Test", targetConfiguration);
msgContext.setProperty(PassThroughConstants.PASS_THROUGH_PIPE, pipe);
- msgContext.setProperty(PassThroughConstants.MESSAGE_BUILDER_INVOKED, Boolean.TRUE);
+ msgContext.setProperty(PassThroughConstants.MESSAGE_BUILDER_INVOKED,
+ Boolean.TRUE);
}
try {
URL url = new URL(epr.getAddress());
@@ -367,7 +370,7 @@ public class PassThroughHttpSender exten
try {
msgContext.wait();
} catch (InterruptedException e) {
- e.printStackTrace();
+ log.warn("Interrupted while waiting for message serialization to complete", e);
}
}
}
@@ -378,39 +381,46 @@ public class PassThroughHttpSender exten
OutputStream out = (OutputStream) msgContext.getProperty("GET_ME_OUT");
if (out != null) {
- String disableChunking = (String) msgContext.getProperty(PassThroughConstants.DISABLE_CHUNKING);
- String forceHttp10 = (String) msgContext.getProperty(PassThroughConstants.FORCE_HTTP_1_0);
+ String disableChunking = (String) msgContext.getProperty(
+ PassThroughConstants.DISABLE_CHUNKING);
+ String forceHttp10 = (String) msgContext.getProperty(
+ PassThroughConstants.FORCE_HTTP_1_0);
Pipe pipe = (Pipe) msgContext.getProperty(PassThroughConstants.PASS_THROUGH_PIPE);
if("true".equals(disableChunking) || "true".equals(forceHttp10) ){
ByteArrayOutputStream _out = new ByteArrayOutputStream();
- MessageFormatter formatter = MessageProcessorSelector.getMessageFormatter(msgContext);
+ MessageFormatter formatter = MessageProcessorSelector.getMessageFormatter(
+ msgContext);
OMOutputFormat format = PassThroughTransportUtils.getOMOutputFormat(msgContext);
formatter.writeTo(msgContext, format, _out, false);
try {
long messageSize = setStreamAsTempData(formatter,msgContext,format);
- msgContext.setProperty(PassThroughConstants.PASS_THROUGH_MESSAGE_LENGTH,messageSize);
+ msgContext.setProperty(
+ PassThroughConstants.PASS_THROUGH_MESSAGE_LENGTH, messageSize);
formatter.writeTo(msgContext, format, out, false);
} catch (IOException e) {
handleException("IO error while building message", e);
}
pipe.setSerializationComplete(true);
- }else {
+ } else {
if ((disableChunking == null || !"true".equals(disableChunking)) ||
(forceHttp10 == null || !"true".equals(forceHttp10))) {
- MessageFormatter formatter = MessageProcessorSelector.getMessageFormatter(msgContext);
- OMOutputFormat format = PassThroughTransportUtils.getOMOutputFormat(msgContext);
+ MessageFormatter formatter = MessageProcessorSelector.getMessageFormatter(
+ msgContext);
+ OMOutputFormat format = PassThroughTransportUtils.getOMOutputFormat(
+ msgContext);
formatter.writeTo(msgContext, format, out, false);
}
- if ((msgContext.getProperty(PassThroughConstants.REST_GET_DELETE_INVOKE) != null &&
- (Boolean) msgContext.getProperty(PassThroughConstants.REST_GET_DELETE_INVOKE))) {
+ if ((msgContext.getProperty(
+ PassThroughConstants.REST_GET_DELETE_INVOKE) != null &&
+ (Boolean) msgContext.getProperty(
+ PassThroughConstants.REST_GET_DELETE_INVOKE))) {
pipe.setSerializationCompleteWithoutData(true);
- }else{
+ } else {
pipe.setSerializationComplete(true);
}
-
}
}
}
@@ -428,10 +438,11 @@ public class PassThroughHttpSender exten
* @return an IOEventDispatch instance
* @throws AxisFault on error
*/
- protected IOEventDispatch getEventDispatch(NHttpClientHandler handler,
+ protected IOEventDispatch getEventDispatch(NHttpClientEventHandler handler,
SSLContext sslContext,
SSLSetupHandler sslIOSessionHandler,
- HttpParams params, TransportOutDescription trpOut) throws AxisFault {
+ HttpParams params,
+ TransportOutDescription trpOut) throws AxisFault {
return new TargetIOEventDispatch(handler, params);
}
@@ -467,7 +478,8 @@ public class PassThroughHttpSender exten
NHttpServerConnection conn = (NHttpServerConnection) msgContext.getProperty(
PassThroughConstants.PASS_THROUGH_SOURCE_CONNECTION);
if (conn == null) {
- ServerWorker serverWorker = (ServerWorker) msgContext.getProperty(Constants.OUT_TRANSPORT_INFO);
+ ServerWorker serverWorker = (ServerWorker) msgContext.getProperty(
+ Constants.OUT_TRANSPORT_INFO);
if (serverWorker != null) {
MessageContext requestContext = serverWorker.getRequestContext();
conn = (NHttpServerConnection) requestContext.getProperty(
@@ -520,7 +532,8 @@ public class PassThroughHttpSender exten
if (msgContext.isPropertyTrue(NhttpConstants.SC_ACCEPTED)) {
out.write(new byte[0]);
} else {
- MessageFormatter formatter = MessageProcessorSelector.getMessageFormatter(msgContext);
+ MessageFormatter formatter = MessageProcessorSelector.getMessageFormatter(
+ msgContext);
OMOutputFormat format = PassThroughTransportUtils.getOMOutputFormat(msgContext);
formatter.writeTo(msgContext, format, out, false);
}
@@ -532,11 +545,11 @@ public class PassThroughHttpSender exten
// nothing much to do as we have started the response already
if (errorCode != null) {
if (log.isDebugEnabled()) {
- log.warn("A Source connection is closed because of an " +
+ log.warn("A source connection is closed because of an " +
"error in target: " + conn);
}
} else {
- log.debug("A Source Connection is closed, because source handler " +
+ log.debug("A source connection is closed, because source handler " +
"is already in the process of writing a response while " +
"another response is submitted: " + conn);
}
@@ -570,7 +583,7 @@ public class PassThroughHttpSender exten
state = BaseConstants.STOPPED;
log.info("Sender shutdown in : " + (System.currentTimeMillis() - start) / 1000 + "s");
} catch (IOException e) {
- handleException("Error shutting down the IOReactor for maintenence", e);
+ handleException("Error shutting down the IOReactor for maintenance", e);
}
}
@@ -608,9 +621,9 @@ public class PassThroughHttpSender exten
return false;
}
- private void handleException(String s, Exception e) throws AxisFault {
- log.error(s, e);
- throw new AxisFault(s, e);
+ private void handleException(String msg, Exception e) throws AxisFault {
+ log.error(msg, e);
+ throw new AxisFault(msg, e);
}
private void handleException(String msg) throws AxisFault {
Modified: synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/SSLSourceIOEventDispatch.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/SSLSourceIOEventDispatch.java?rev=1506662&r1=1506661&r2=1506662&view=diff
==============================================================================
--- synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/SSLSourceIOEventDispatch.java (original)
+++ synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/SSLSourceIOEventDispatch.java Wed Jul 24 19:04:18 2013
@@ -18,35 +18,45 @@
*/
package org.apache.synapse.transport.passthru;
-import org.apache.http.impl.nio.reactor.SSLSetupHandler;
-import org.apache.http.impl.nio.ssl.SSLServerIOEventDispatch;
-import org.apache.http.nio.NHttpServerIOTarget;
-import org.apache.http.nio.NHttpServiceHandler;
+import org.apache.http.HttpRequestFactory;
+import org.apache.http.impl.nio.DefaultHttpServerIODispatch;
+import org.apache.http.impl.nio.DefaultNHttpServerConnection;
+import org.apache.http.impl.nio.SSLNHttpServerConnectionFactory;
+import org.apache.http.nio.NHttpServerEventHandler;
import org.apache.http.nio.reactor.IOSession;
+import org.apache.http.nio.reactor.ssl.SSLSetupHandler;
+import org.apache.http.nio.util.ByteBufferAllocator;
import org.apache.http.params.HttpParams;
import org.apache.synapse.transport.passthru.logging.LoggingUtils;
import javax.net.ssl.SSLContext;
-public class SSLSourceIOEventDispatch extends SSLServerIOEventDispatch {
+public class SSLSourceIOEventDispatch extends DefaultHttpServerIODispatch {
- private HttpParams params = null;
-
- public SSLSourceIOEventDispatch(NHttpServiceHandler handler,
+ public SSLSourceIOEventDispatch(NHttpServerEventHandler handler,
SSLContext sslcontext,
SSLSetupHandler sslHandler,
HttpParams params) {
- super(handler, sslcontext, sslHandler, params);
- this.params = params;
+ super(handler, new SSLSourceConnectionFactory(sslcontext, sslHandler, params));
}
- @Override
- protected NHttpServerIOTarget createConnection(IOSession session) {
- session = LoggingUtils.decorate(session, "sslserver");
- return LoggingUtils.createServerConnection(
- session,
- createHttpRequestFactory(),
- createByteBufferAllocator(),
- this.params);
+ private static class SSLSourceConnectionFactory extends SSLNHttpServerConnectionFactory {
+
+ public SSLSourceConnectionFactory(SSLContext sslcontext, SSLSetupHandler sslHandler, HttpParams params) {
+ super(sslcontext, sslHandler, params);
+ }
+
+ @Override
+ protected DefaultNHttpServerConnection createConnection(IOSession session,
+ HttpRequestFactory requestFactory,
+ ByteBufferAllocator allocator,
+ HttpParams params) {
+ session = LoggingUtils.decorate(session, "sslserver");
+ return LoggingUtils.createServerConnection(
+ session,
+ requestFactory,
+ allocator,
+ params);
+ }
}
}
Modified: synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/SSLTargetIOEventDispatch.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/SSLTargetIOEventDispatch.java?rev=1506662&r1=1506661&r2=1506662&view=diff
==============================================================================
--- synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/SSLTargetIOEventDispatch.java (original)
+++ synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/SSLTargetIOEventDispatch.java Wed Jul 24 19:04:18 2013
@@ -16,40 +16,60 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.synapse.transport.passthru;
-import org.apache.http.impl.nio.reactor.SSLIOSession;
-import org.apache.http.impl.nio.reactor.SSLSetupHandler;
-import org.apache.http.nio.NHttpClientHandler;
-import org.apache.http.nio.NHttpClientIOTarget;
+import org.apache.http.HttpResponseFactory;
+import org.apache.http.impl.nio.DefaultHttpClientIODispatch;
+import org.apache.http.impl.nio.DefaultNHttpClientConnection;
+import org.apache.http.impl.nio.SSLNHttpClientConnectionFactory;
+import org.apache.http.nio.NHttpClientEventHandler;
import org.apache.http.nio.reactor.IOSession;
+import org.apache.http.nio.reactor.ssl.SSLSetupHandler;
+import org.apache.http.nio.util.ByteBufferAllocator;
import org.apache.http.params.HttpParams;
import org.apache.synapse.transport.passthru.logging.LoggingUtils;
import javax.net.ssl.SSLContext;
-import java.net.InetSocketAddress;
import java.util.Map;
-public class SSLTargetIOEventDispatch extends org.apache.http.impl.nio.ssl.SSLClientIOEventDispatch {
+public class SSLTargetIOEventDispatch extends DefaultHttpClientIODispatch {
private Map<String, SSLContext> contextMap;
- private HttpParams params = null;
-
- public SSLTargetIOEventDispatch(NHttpClientHandler handler,
+ public SSLTargetIOEventDispatch(NHttpClientEventHandler handler,
SSLContext sslcontext,
SSLSetupHandler sslHandler,
HttpParams params) {
- super(handler, sslcontext, sslHandler, params);
- this.params = params;
+ super(handler, new SSLTargetConnectionFactory(sslcontext, sslHandler, params));
}
public void setContextMap(Map<String,SSLContext> contextMap) {
this.contextMap = contextMap;
}
- @Override
- protected SSLIOSession createSSLIOSession(IOSession session,
+ private static class SSLTargetConnectionFactory extends SSLNHttpClientConnectionFactory {
+
+ public SSLTargetConnectionFactory(SSLContext sslcontext,
+ SSLSetupHandler sslHandler, HttpParams params) {
+ super(sslcontext, sslHandler, params);
+ }
+
+ @Override
+ protected DefaultNHttpClientConnection createConnection(IOSession session,
+ HttpResponseFactory responseFactory,
+ ByteBufferAllocator allocator,
+ HttpParams params) {
+ session = LoggingUtils.decorate(session, "sslclient");
+ return LoggingUtils.createClientConnection(
+ session,
+ responseFactory,
+ allocator,
+ params);
+ }
+ }
+
+ /*protected SSLIOSession createSSLIOSession(IOSession session,
SSLContext sslcontext,
SSLSetupHandler sslHandler) {
@@ -66,15 +86,5 @@ public class SSLTargetIOEventDispatch ex
}
return super.createSSLIOSession(session, customContext, sslHandler);
- }
-
- @Override
- protected NHttpClientIOTarget createConnection(IOSession session) {
- session = LoggingUtils.decorate(session, "sslclient");
- return LoggingUtils.createClientConnection(
- session,
- createHttpResponseFactory(),
- createByteBufferAllocator(),
- params);
- }
+ }*/
}
Modified: synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/ServerWorker.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/ServerWorker.java?rev=1506662&r1=1506661&r2=1506662&view=diff
==============================================================================
--- synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/ServerWorker.java (original)
+++ synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/ServerWorker.java Wed Jul 24 19:04:18 2013
@@ -56,8 +56,8 @@ import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.HttpVersion;
import org.apache.http.entity.BasicHttpEntity;
-import org.apache.http.impl.nio.reactor.SSLIOSession;
import org.apache.http.nio.NHttpServerConnection;
+import org.apache.http.nio.reactor.ssl.SSLIOSession;
import org.apache.http.protocol.HTTP;
import org.apache.synapse.transport.nhttp.HttpCoreRequestResponseTransport;
import org.apache.synapse.transport.nhttp.NHttpConfiguration;
@@ -456,9 +456,10 @@ public class ServerWorker implements Run
msgContext.setTransportIn(cfgCtx.getAxisConfiguration()
.getTransportIn(Constants.TRANSPORT_HTTPS));
msgContext.setIncomingTransportName(Constants.TRANSPORT_HTTPS);
- SSLIOSession session = (SSLIOSession) (conn.getContext()).getAttribute("SSL_SESSION");
+ SSLIOSession session = (SSLIOSession) conn.getContext().getAttribute(
+ SSLIOSession.SESSION_KEY);
msgContext.setProperty("ssl.client.auth.cert.X509",
- session.getAttribute("ssl.client.auth.cert.X509"));
+ session.getAttribute("ssl.client.auth.cert.X509"));
} else {
msgContext.setTransportOut(cfgCtx.getAxisConfiguration()
.getTransportOut(Constants.TRANSPORT_HTTP));
Modified: synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/SourceContext.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/SourceContext.java?rev=1506662&r1=1506661&r2=1506662&view=diff
==============================================================================
--- synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/SourceContext.java (original)
+++ synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/SourceContext.java Wed Jul 24 19:04:18 2013
@@ -23,8 +23,6 @@ import org.apache.http.nio.NHttpConnecti
import org.apache.synapse.transport.passthru.config.SourceConfiguration;
import java.nio.ByteBuffer;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
/**
* This class represents the information about a TCP Connection at a given point in time.
@@ -49,8 +47,6 @@ public class SourceContext {
private Pipe writer;
- private Lock lock = new ReentrantLock();
-
public SourceContext(SourceConfiguration sourceConfiguration) {
this.sourceConfiguration = sourceConfiguration;
}
@@ -94,10 +90,6 @@ public class SourceContext {
this.writer = null;
}
- public Lock getLock() {
- return lock;
- }
-
public boolean isShutDown() {
return shutDown;
}
Modified: synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/SourceHandler.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/SourceHandler.java?rev=1506662&r1=1506661&r2=1506662&view=diff
==============================================================================
--- synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/SourceHandler.java (original)
+++ synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/SourceHandler.java Wed Jul 24 19:04:18 2013
@@ -43,7 +43,7 @@ import java.io.OutputStream;
* receives events for a particular connection. These events give information
* about the message and its various states.
*/
-public class SourceHandler implements NHttpServiceHandler {
+public class SourceHandler implements NHttpServerEventHandler {
private static final Log log = LogFactory.getLog(SourceHandler.class);
@@ -262,7 +262,37 @@ public class SourceHandler implements NH
}
}
- public void exception(NHttpServerConnection conn, IOException e) {
+ public void endOfInput(NHttpServerConnection conn) throws IOException {
+ closed(conn);
+ }
+
+ public void exception(NHttpServerConnection conn, Exception e) {
+ if (e instanceof HttpException) {
+ exception(conn, (HttpException) e);
+ } else if (e instanceof IOException) {
+ exception(conn, (IOException) e);
+ } else {
+ metrics.incrementFaultsReceiving();
+
+ ProtocolState state = SourceContext.getState(conn);
+ if (state == ProtocolState.REQUEST_BODY ||
+ state == ProtocolState.REQUEST_HEAD) {
+ informReaderError(conn);
+ } else if (state == ProtocolState.RESPONSE_BODY ||
+ state == ProtocolState.RESPONSE_HEAD) {
+ informWriterError(conn);
+ } else if (state == ProtocolState.REQUEST_DONE) {
+ informWriterError(conn);
+ } else if (state == ProtocolState.RESPONSE_DONE) {
+ informWriterError(conn);
+ }
+
+ SourceContext.updateState(conn, ProtocolState.CLOSED);
+ sourceConfiguration.getSourceConnections().shutDownConnection(conn);
+ }
+ }
+
+ public void exception(NHttpServerConnection conn, IOException e) {
logIOException(e);
metrics.incrementFaultsReceiving();
@@ -312,7 +342,7 @@ public class SourceHandler implements NH
}
}
- public void exception(NHttpServerConnection conn, HttpException e) {
+ public void exception(NHttpServerConnection conn, HttpException e) {
try {
if (conn.isResponseSubmitted()) {
sourceConfiguration.getSourceConnections().shutDownConnection(conn);
Modified: synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/SourceIOEventDispatch.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/SourceIOEventDispatch.java?rev=1506662&r1=1506661&r2=1506662&view=diff
==============================================================================
--- synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/SourceIOEventDispatch.java (original)
+++ synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/SourceIOEventDispatch.java Wed Jul 24 19:04:18 2013
@@ -19,29 +19,44 @@
package org.apache.synapse.transport.passthru;
-import org.apache.http.impl.nio.DefaultServerIOEventDispatch;
-import org.apache.http.nio.NHttpServiceHandler;
-import org.apache.http.nio.NHttpServerIOTarget;
+import org.apache.http.HttpRequestFactory;
+import org.apache.http.impl.nio.DefaultHttpServerIODispatch;
+
+import org.apache.http.impl.nio.DefaultNHttpServerConnection;
+import org.apache.http.impl.nio.DefaultNHttpServerConnectionFactory;
+import org.apache.http.nio.NHttpServerEventHandler;
import org.apache.http.nio.reactor.IOSession;
+import org.apache.http.nio.util.ByteBufferAllocator;
import org.apache.http.params.HttpParams;
import org.apache.synapse.transport.passthru.logging.LoggingUtils;
/**
* This is a factory for creating the logging sessions or non-logging sessions.
*/
-public class SourceIOEventDispatch extends DefaultServerIOEventDispatch {
+public class SourceIOEventDispatch extends DefaultHttpServerIODispatch {
- public SourceIOEventDispatch(final NHttpServiceHandler handler, final HttpParams params) {
- super(LoggingUtils.decorate(handler), params);
+ public SourceIOEventDispatch(final NHttpServerEventHandler handler, final HttpParams params) {
+ super(LoggingUtils.decorate(handler), new SourceConnectionFactory(params));
}
- @Override
- protected NHttpServerIOTarget createConnection(IOSession session) {
- session = LoggingUtils.decorate(session, "server");
- return LoggingUtils.createServerConnection(
- session,
- createHttpRequestFactory(),
- this.allocator,
- this.params);
+ private static class SourceConnectionFactory extends DefaultNHttpServerConnectionFactory {
+
+ public SourceConnectionFactory(HttpParams params) {
+ super(params);
+ }
+
+ @Override
+ protected DefaultNHttpServerConnection createConnection(IOSession session,
+ HttpRequestFactory requestFactory,
+ ByteBufferAllocator allocator,
+ HttpParams params) {
+ session = LoggingUtils.decorate(session, "server");
+ return LoggingUtils.createServerConnection(
+ session,
+ requestFactory,
+ allocator,
+ params);
+ }
}
+
}
Modified: synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/TargetHandler.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/TargetHandler.java?rev=1506662&r1=1506661&r2=1506662&view=diff
==============================================================================
--- synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/TargetHandler.java (original)
+++ synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/TargetHandler.java Wed Jul 24 19:04:18 2013
@@ -32,11 +32,7 @@ import org.apache.http.HttpException;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.impl.nio.DefaultNHttpClientConnection;
-import org.apache.http.nio.ContentDecoder;
-import org.apache.http.nio.ContentEncoder;
-import org.apache.http.nio.NHttpClientConnection;
-import org.apache.http.nio.NHttpClientHandler;
-import org.apache.http.nio.NHttpServerConnection;
+import org.apache.http.nio.*;
import org.apache.synapse.transport.nhttp.NhttpConstants;
import org.apache.synapse.transport.passthru.config.TargetConfiguration;
import org.apache.synapse.transport.passthru.connections.HostConnections;
@@ -45,7 +41,7 @@ import org.apache.synapse.transport.pass
/**
* This class is handling events from the transport -- > client.
*/
-public class TargetHandler implements NHttpClientHandler {
+public class TargetHandler implements NHttpClientEventHandler {
private static final Log log = LogFactory.getLog(TargetHandler.class);
@@ -453,6 +449,31 @@ public class TargetHandler implements NH
targetConfiguration.getConnections().shutdownConnection(conn);
}
+ public void endOfInput(NHttpClientConnection conn) throws IOException {
+ closed(conn);
+ }
+
+ public void exception(NHttpClientConnection conn, Exception e) {
+ if (e instanceof HttpException) {
+ exception(conn, (HttpException) e);
+ } else if (e instanceof IOException) {
+ exception(conn, (IOException) e);
+ } else {
+ ProtocolState state = TargetContext.getState(conn);
+ MessageContext requestMsgCtx = TargetContext.get(conn).getRequestMsgCtx();
+ if (requestMsgCtx != null) {
+ targetErrorHandler.handleError(requestMsgCtx,
+ ErrorCodes.SND_IO_ERROR,
+ "Error in Sender",
+ e,
+ state);
+ }
+
+ TargetContext.updateState(conn, ProtocolState.CLOSING);
+ targetConfiguration.getConnections().shutdownConnection(conn);
+ }
+ }
+
private boolean isResponseHaveBodyExpected(
final String method, final HttpResponse response) {
Modified: synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/TargetIOEventDispatch.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/TargetIOEventDispatch.java?rev=1506662&r1=1506661&r2=1506662&view=diff
==============================================================================
--- synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/TargetIOEventDispatch.java (original)
+++ synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/TargetIOEventDispatch.java Wed Jul 24 19:04:18 2013
@@ -19,29 +19,43 @@
package org.apache.synapse.transport.passthru;
-import org.apache.http.impl.nio.DefaultClientIOEventDispatch;
-import org.apache.http.nio.NHttpClientHandler;
-import org.apache.http.nio.NHttpClientIOTarget;
+import org.apache.http.HttpResponseFactory;
+import org.apache.http.impl.nio.DefaultHttpClientIODispatch;
+import org.apache.http.impl.nio.DefaultNHttpClientConnection;
+import org.apache.http.impl.nio.DefaultNHttpClientConnectionFactory;
+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.apache.synapse.transport.passthru.logging.LoggingUtils;
/**
* This is a factory for creating the logging sessions or non-logging sessions.
*/
-public class TargetIOEventDispatch extends DefaultClientIOEventDispatch {
+public class TargetIOEventDispatch extends DefaultHttpClientIODispatch {
- public TargetIOEventDispatch(final NHttpClientHandler handler, final HttpParams params) {
- super(LoggingUtils.decorate(handler), params);
+ public TargetIOEventDispatch(final NHttpClientEventHandler handler, final HttpParams params) {
+ super(LoggingUtils.decorate(handler), new TargetConnectionFactory(params));
}
- @Override
- protected NHttpClientIOTarget createConnection(IOSession session) {
- session = LoggingUtils.decorate(session, "client");
- return LoggingUtils.createClientConnection(
- session,
- createHttpResponseFactory(),
- this.allocator,
- this.params);
+ private static class TargetConnectionFactory extends DefaultNHttpClientConnectionFactory {
+
+ public TargetConnectionFactory(HttpParams params) {
+ super(params);
+ }
+
+ @Override
+ protected DefaultNHttpClientConnection createConnection(IOSession session,
+ HttpResponseFactory responseFactory,
+ ByteBufferAllocator allocator,
+ HttpParams params) {
+ session = LoggingUtils.decorate(session, "client");
+ return LoggingUtils.createClientConnection(
+ session,
+ responseFactory,
+ allocator,
+ params);
+ }
}
+
}
Modified: synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/TargetRequest.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/TargetRequest.java?rev=1506662&r1=1506661&r2=1506662&view=diff
==============================================================================
--- synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/TargetRequest.java (original)
+++ synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/TargetRequest.java Wed Jul 24 19:04:18 2013
@@ -17,7 +17,6 @@
* under the License.
*/
-
package org.apache.synapse.transport.passthru;
import org.apache.axiom.om.OMOutputFormat;
Modified: synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/config/BaseConfiguration.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/config/BaseConfiguration.java?rev=1506662&r1=1506661&r2=1506662&view=diff
==============================================================================
--- synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/config/BaseConfiguration.java (original)
+++ synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/config/BaseConfiguration.java Wed Jul 24 19:04:18 2013
@@ -17,7 +17,6 @@
* under the License.
*/
-
package org.apache.synapse.transport.passthru.config;
import org.apache.axis2.AxisFault;
@@ -25,8 +24,7 @@ import org.apache.axis2.context.Configur
import org.apache.axis2.description.ParameterInclude;
import org.apache.axis2.transport.base.threads.WorkerPool;
import org.apache.axis2.transport.base.threads.WorkerPoolFactory;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.apache.http.impl.nio.reactor.IOReactorConfig;
import org.apache.http.nio.params.NIOReactorPNames;
import org.apache.http.nio.params.NIOReactorParams;
import org.apache.http.nio.util.HeapByteBufferAllocator;
@@ -42,8 +40,6 @@ import org.apache.synapse.transport.pass
*/
public abstract class BaseConfiguration {
- private Log log = LogFactory.getLog(BaseConfiguration.class);
-
/**
* Configurations given by axis2.xml
*/
@@ -64,8 +60,6 @@ public abstract class BaseConfiguration
private int iOThreadsPerReactor;
- private int iOBufferSize;
-
protected PassThroughConfiguration conf = PassThroughConfiguration.getInstance();
public BaseConfiguration(ConfigurationContext configurationContext,
@@ -79,8 +73,6 @@ public abstract class BaseConfiguration
public void build() throws AxisFault {
iOThreadsPerReactor = conf.getIOThreadsPerReactor();
- iOBufferSize = conf.getIOBufferSize();
-
if (workerPool == null) {
workerPool = WorkerPoolFactory.getWorkerPool(
conf.getWorkerPoolCoreSize(),
@@ -92,16 +84,38 @@ public abstract class BaseConfiguration
}
httpParameters = retrieveHttpParameters();
-
- bufferFactory = new BufferFactory(iOBufferSize, new HeapByteBufferAllocator(), 512);
+ bufferFactory = new BufferFactory(conf.getIOBufferSize(), new HeapByteBufferAllocator(), 512);
}
- public int getIOThreadsPerReactor() {
- return iOThreadsPerReactor;
- }
+ public IOReactorConfig getReactorConfig() {
+ IOReactorConfig config = new IOReactorConfig();
+ config.setIoThreadCount(iOThreadsPerReactor);
+ config.setSoTimeout(
+ conf.getIntProperty(HttpConnectionParams.SO_TIMEOUT, 60000));
+ config.setConnectTimeout(
+ conf.getIntProperty(HttpConnectionParams.CONNECTION_TIMEOUT, 0));
+ config.setRcvBufSize(
+ conf.getIntProperty(HttpConnectionParams.SOCKET_BUFFER_SIZE, 8 * 1024));
+ config.setSndBufSize(
+ conf.getIntProperty(HttpConnectionParams.SOCKET_BUFFER_SIZE, 8 * 1024));
+ config.setTcpNoDelay(
+ conf.getBooleanProperty(HttpConnectionParams.TCP_NODELAY, true));
+ config.setInterestOpQueued(
+ conf.getBooleanProperty(NIOReactorParams.INTEREST_OPS_QUEUEING, false));
+
+ if (conf.getIntProperty(HttpConnectionParams.SO_LINGER) != null) {
+ config.setSoLinger(conf.getIntProperty(HttpConnectionParams.SO_LINGER));
+ }
+
+ if (conf.getBooleanProperty(HttpConnectionParams.SO_REUSEADDR) != null) {
+ config.setSoReuseAddress(conf.getBooleanProperty(HttpConnectionParams.SO_REUSEADDR));
+ }
+
+ if (conf.getIntProperty(NIOReactorPNames.SELECT_INTERVAL) != null) {
+ config.setSelectInterval(conf.getIntProperty(NIOReactorPNames.SELECT_INTERVAL));
+ }
- public int getIOBufferSize() {
- return iOBufferSize;
+ return config;
}
public WorkerPool getWorkerPool() {
Modified: synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/config/PassThroughConfiguration.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/config/PassThroughConfiguration.java?rev=1506662&r1=1506661&r2=1506662&view=diff
==============================================================================
--- synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/config/PassThroughConfiguration.java (original)
+++ synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/config/PassThroughConfiguration.java Wed Jul 24 19:04:18 2013
@@ -21,10 +21,8 @@ package org.apache.synapse.transport.pas
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.synapse.commons.util.MiscellaneousUtil;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
import java.util.Properties;
/**
@@ -52,7 +50,7 @@ public class PassThroughConfiguration {
private PassThroughConfiguration() {
try {
- props = loadProperties("passthru-http.properties");
+ props = MiscellaneousUtil.loadProperties("passthru-http.properties");
} catch (Exception ignored) {}
}
@@ -103,50 +101,6 @@ public class PassThroughConfiguration {
}
/**
- * Loads the properties from a given property file path
- *
- * @param filePath Path of the property file
- * @return Properties loaded from given file
- */
- private static Properties loadProperties(String filePath) {
-
- Properties properties = new Properties();
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
-
- if (log.isDebugEnabled()) {
- log.debug("Loading the file '" + filePath + "' from classpath");
- }
-
- InputStream in = cl.getResourceAsStream(filePath);
- if (in == null) {
- if (log.isDebugEnabled()) {
- log.debug("Unable to load file '" + filePath + "'");
- }
-
- filePath = "conf" + File.separatorChar + filePath;
- if (log.isDebugEnabled()) {
- log.debug("Loading the file '" + filePath + "'");
- }
-
- in = cl.getResourceAsStream(filePath);
- if (in == null) {
- if (log.isDebugEnabled()) {
- log.debug("Unable to load file '" + filePath + "'");
- }
- }
- }
- if (in != null) {
- try {
- properties.load(in);
- } catch (IOException e) {
- String msg = "Error loading properties from a file at : " + filePath;
- log.error(msg, e);
- }
- }
- return properties;
- }
-
- /**
* Get an int property that tunes pass-through http transport. Prefer system properties
*
* @param name name of the system/config property
Modified: synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/logging/LoggingNHttpSourceConnection.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/logging/LoggingNHttpSourceConnection.java?rev=1506662&r1=1506661&r2=1506662&view=diff
==============================================================================
--- synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/logging/LoggingNHttpSourceConnection.java (original)
+++ synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/logging/LoggingNHttpSourceConnection.java Wed Jul 24 19:04:18 2013
@@ -20,11 +20,11 @@
package org.apache.synapse.transport.passthru.logging;
import org.apache.http.impl.nio.DefaultNHttpServerConnection;
+import org.apache.http.nio.NHttpServerEventHandler;
import org.apache.http.nio.reactor.IOSession;
import org.apache.http.nio.reactor.SessionOutputBuffer;
import org.apache.http.nio.reactor.SessionInputBuffer;
import org.apache.http.nio.util.ByteBufferAllocator;
-import org.apache.http.nio.NHttpServiceHandler;
import org.apache.http.nio.NHttpMessageWriter;
import org.apache.http.nio.NHttpMessageParser;
import org.apache.http.*;
@@ -40,14 +40,14 @@ public class LoggingNHttpSourceConnectio
public LoggingNHttpSourceConnection(
final Log log,
- final Log headerlog,
+ final Log headerLog,
final IOSession session,
final HttpRequestFactory requestFactory,
final ByteBufferAllocator allocator,
final HttpParams params) {
super(session, requestFactory, allocator, params);
this.log = log;
- this.headerLog = headerlog;
+ this.headerLog = headerLog;
}
@Override
@@ -71,19 +71,19 @@ public class LoggingNHttpSourceConnectio
}
@Override
- public void consumeInput(final NHttpServiceHandler handler) {
+ public void consumeInput(final NHttpServerEventHandler handler) {
this.log.debug("Consume input");
super.consumeInput(handler);
}
@Override
- public void produceOutput(final NHttpServiceHandler handler) {
+ public void produceOutput(final NHttpServerEventHandler handler) {
this.log.debug("Produce output");
super.produceOutput(handler);
}
@Override
- protected NHttpMessageWriter createResponseWriter(
+ protected NHttpMessageWriter<HttpResponse> createResponseWriter(
final SessionOutputBuffer buffer,
final HttpParams params) {
return new LoggingNHttpMessageWriter(
@@ -91,7 +91,7 @@ public class LoggingNHttpSourceConnectio
}
@Override
- protected NHttpMessageParser createRequestParser(
+ protected NHttpMessageParser<HttpRequest> createRequestParser(
final SessionInputBuffer buffer,
final HttpRequestFactory requestFactory,
final HttpParams params) {
@@ -99,11 +99,11 @@ public class LoggingNHttpSourceConnectio
super.createRequestParser(buffer, requestFactory, params));
}
- class LoggingNHttpMessageWriter implements NHttpMessageWriter {
+ class LoggingNHttpMessageWriter implements NHttpMessageWriter<HttpResponse> {
- private final NHttpMessageWriter writer;
+ private final NHttpMessageWriter<HttpResponse> writer;
- public LoggingNHttpMessageWriter(final NHttpMessageWriter writer) {
+ public LoggingNHttpMessageWriter(final NHttpMessageWriter<HttpResponse> writer) {
super();
this.writer = writer;
}
@@ -112,25 +112,24 @@ public class LoggingNHttpSourceConnectio
this.writer.reset();
}
- public void write(final HttpMessage message) throws IOException, HttpException {
- if (message != null && headerLog.isDebugEnabled()) {
- HttpResponse response = (HttpResponse) message;
+ public void write(final HttpResponse response) throws IOException, HttpException {
+ if (response != null && headerLog.isDebugEnabled()) {
headerLog.debug("<< " + response.getStatusLine().toString());
Header[] headers = response.getAllHeaders();
for (Header header : headers) {
headerLog.debug("<< " + header.toString());
}
}
- this.writer.write(message);
+ this.writer.write(response);
}
}
- class LoggingNHttpMessageParser implements NHttpMessageParser {
+ class LoggingNHttpMessageParser implements NHttpMessageParser<HttpRequest> {
- private final NHttpMessageParser parser;
+ private final NHttpMessageParser<HttpRequest> parser;
- public LoggingNHttpMessageParser(final NHttpMessageParser parser) {
+ public LoggingNHttpMessageParser(final NHttpMessageParser<HttpRequest> parser) {
super();
this.parser = parser;
}
@@ -143,17 +142,16 @@ public class LoggingNHttpSourceConnectio
return this.parser.fillBuffer(channel);
}
- public HttpMessage parse() throws IOException, HttpException {
- HttpMessage message = this.parser.parse();
- if (message != null && headerLog.isDebugEnabled()) {
- HttpRequest request = (HttpRequest) message;
+ public HttpRequest parse() throws IOException, HttpException {
+ HttpRequest request = this.parser.parse();
+ if (request != null && headerLog.isDebugEnabled()) {
headerLog.debug(">> " + request.getRequestLine().toString());
Header[] headers = request.getAllHeaders();
for (Header header : headers) {
headerLog.debug(">> " + header.toString());
}
}
- return message;
+ return request;
}
}
}
Modified: synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/logging/LoggingNHttpTargetConnection.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/logging/LoggingNHttpTargetConnection.java?rev=1506662&r1=1506661&r2=1506662&view=diff
==============================================================================
--- synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/logging/LoggingNHttpTargetConnection.java (original)
+++ synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/logging/LoggingNHttpTargetConnection.java Wed Jul 24 19:04:18 2013
@@ -20,11 +20,11 @@
package org.apache.synapse.transport.passthru.logging;
import org.apache.commons.logging.Log;
+import org.apache.http.nio.NHttpClientEventHandler;
import org.apache.http.nio.reactor.IOSession;
import org.apache.http.nio.reactor.SessionOutputBuffer;
import org.apache.http.nio.reactor.SessionInputBuffer;
import org.apache.http.nio.util.ByteBufferAllocator;
-import org.apache.http.nio.NHttpClientHandler;
import org.apache.http.nio.NHttpMessageWriter;
import org.apache.http.nio.NHttpMessageParser;
import org.apache.http.*;
@@ -35,19 +35,20 @@ import java.io.IOException;
import java.nio.channels.ReadableByteChannel;
public class LoggingNHttpTargetConnection extends DefaultNHttpClientConnection {
+
private final Log log;
private final Log headerLog;
public LoggingNHttpTargetConnection(
final Log log,
- final Log headerlog,
+ final Log headerLog,
final IOSession iosession,
final HttpResponseFactory responseFactory,
final ByteBufferAllocator allocator,
final HttpParams params) {
super(iosession, responseFactory, allocator, params);
this.log = log;
- this.headerLog = headerlog;
+ this.headerLog = headerLog;
}
@Override
@@ -71,19 +72,19 @@ public class LoggingNHttpTargetConnectio
}
@Override
- public void consumeInput(final NHttpClientHandler handler) {
+ public void consumeInput(final NHttpClientEventHandler handler) {
this.log.debug("Consume input");
super.consumeInput(handler);
}
@Override
- public void produceOutput(final NHttpClientHandler handler) {
+ public void produceOutput(final NHttpClientEventHandler handler) {
this.log.debug("Produce output");
super.produceOutput(handler);
}
@Override
- protected NHttpMessageWriter createRequestWriter(
+ protected NHttpMessageWriter<HttpRequest> createRequestWriter(
final SessionOutputBuffer buffer,
final HttpParams params) {
return new LoggingNHttpMessageWriter(
@@ -91,7 +92,7 @@ public class LoggingNHttpTargetConnectio
}
@Override
- protected NHttpMessageParser createResponseParser(
+ protected NHttpMessageParser<HttpResponse> createResponseParser(
final SessionInputBuffer buffer,
final HttpResponseFactory responseFactory,
final HttpParams params) {
@@ -99,11 +100,11 @@ public class LoggingNHttpTargetConnectio
super.createResponseParser(buffer, responseFactory, params));
}
- class LoggingNHttpMessageWriter implements NHttpMessageWriter {
+ class LoggingNHttpMessageWriter implements NHttpMessageWriter<HttpRequest> {
- private final NHttpMessageWriter writer;
+ private final NHttpMessageWriter<HttpRequest> writer;
- public LoggingNHttpMessageWriter(final NHttpMessageWriter writer) {
+ public LoggingNHttpMessageWriter(final NHttpMessageWriter<HttpRequest> writer) {
super();
this.writer = writer;
}
@@ -112,25 +113,24 @@ public class LoggingNHttpTargetConnectio
this.writer.reset();
}
- public void write(final HttpMessage message) throws IOException, HttpException {
- if (message != null && headerLog.isDebugEnabled()) {
- HttpRequest request = (HttpRequest) message;
+ public void write(final HttpRequest request) throws IOException, HttpException {
+ if (request != null && headerLog.isDebugEnabled()) {
headerLog.debug(">> " + request.getRequestLine().toString());
Header[] headers = request.getAllHeaders();
for (Header header : headers) {
headerLog.debug(">> " + header.toString());
}
}
- this.writer.write(message);
+ this.writer.write(request);
}
}
- class LoggingNHttpMessageParser implements NHttpMessageParser {
+ class LoggingNHttpMessageParser implements NHttpMessageParser<HttpResponse> {
- private final NHttpMessageParser parser;
+ private final NHttpMessageParser<HttpResponse> parser;
- public LoggingNHttpMessageParser(final NHttpMessageParser parser) {
+ public LoggingNHttpMessageParser(final NHttpMessageParser<HttpResponse> parser) {
super();
this.parser = parser;
}
@@ -143,17 +143,16 @@ public class LoggingNHttpTargetConnectio
return this.parser.fillBuffer(channel);
}
- public HttpMessage parse() throws IOException, HttpException {
- HttpMessage message = this.parser.parse();
- if (message != null && headerLog.isDebugEnabled()) {
- HttpResponse response = (HttpResponse) message;
+ public HttpResponse parse() throws IOException, HttpException {
+ HttpResponse response = this.parser.parse();
+ if (response != null && headerLog.isDebugEnabled()) {
headerLog.debug("<< " + response.getStatusLine().toString());
Header[] headers = response.getAllHeaders();
for (Header header : headers) {
headerLog.debug("<< " + header.toString());
}
}
- return message;
+ return response;
}
}
Modified: synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/logging/LoggingSourceHandler.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/logging/LoggingSourceHandler.java?rev=1506662&r1=1506661&r2=1506662&view=diff
==============================================================================
--- synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/logging/LoggingSourceHandler.java (original)
+++ synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/logging/LoggingSourceHandler.java Wed Jul 24 19:04:18 2013
@@ -20,23 +20,20 @@ package org.apache.synapse.transport.pas
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.http.nio.NHttpServiceHandler;
-import org.apache.http.nio.NHttpServerConnection;
-import org.apache.http.nio.ContentEncoder;
-import org.apache.http.nio.ContentDecoder;
+import org.apache.http.nio.*;
import org.apache.http.ConnectionClosedException;
import org.apache.http.HttpException;
import org.apache.http.HttpRequest;
import java.io.IOException;
-public class LoggingSourceHandler implements NHttpServiceHandler {
+public class LoggingSourceHandler implements NHttpServerEventHandler {
private final Log log;
- private final NHttpServiceHandler handler;
+ private final NHttpServerEventHandler handler;
- public LoggingSourceHandler (final NHttpServiceHandler handler) {
+ public LoggingSourceHandler (final NHttpServerEventHandler handler) {
super();
if (handler == null) {
throw new IllegalArgumentException("HTTP service handler may not be null");
@@ -45,7 +42,7 @@ public class LoggingSourceHandler implem
this.log = LogFactory.getLog(handler.getClass());
}
- public void connected(final NHttpServerConnection conn) {
+ public void connected(final NHttpServerConnection conn) throws IOException, HttpException {
if (this.log.isDebugEnabled()) {
this.log.debug("HTTP connection " + conn + ": Connected");
}
@@ -59,26 +56,35 @@ public class LoggingSourceHandler implem
this.handler.closed(conn);
}
- public void exception(final NHttpServerConnection conn, final IOException ex) {
+ public void endOfInput(NHttpServerConnection conn) throws IOException {
+ if (this.log.isDebugEnabled()) {
+ this.log.debug("HTTP connection " + conn + ": Closed at the remote end");
+ }
+ this.handler.endOfInput(conn);
+ }
+
+ public void exception(NHttpServerConnection conn, Exception ex) {
+ if (ex.getMessage() == null) {
+ ex.printStackTrace();
+ return;
+ }
if (ex instanceof ConnectionClosedException ||
ex.getMessage().contains("Connection reset by peer") ||
ex.getMessage().contains("forcibly closed")) {
if (this.log.isDebugEnabled()) {
this.log.debug("HTTP connection " + conn + ": " + ex.getMessage() +
- " (Probably the keepalive connection was closed)");
+ " (Probably the keep-alive connection was closed)");
}
+ } else if (ex instanceof HttpException) {
+ this.log.error("HTTP Error occurred on connection " + conn + ": " + ex.getMessage(), ex);
+ this.handler.exception(conn, ex);
} else {
- this.log.error("IO Error occured on HTTP connection " + conn + ": " + ex.getMessage(), ex);
+ this.log.error("IO Error occurred on HTTP connection " + conn + ": " + ex.getMessage(), ex);
}
this.handler.exception(conn, ex);
}
- public void exception(final NHttpServerConnection conn, final HttpException ex) {
- this.log.error("HTTP Error occured on connection " + conn + ": " + ex.getMessage(), ex);
- this.handler.exception(conn, ex);
- }
-
- public void requestReceived(final NHttpServerConnection conn) {
+ public void requestReceived(final NHttpServerConnection conn) throws IOException, HttpException {
HttpRequest request = conn.getHttpRequest();
if (this.log.isDebugEnabled()) {
this.log.debug("HTTP InRequest Received on connection " + conn + ": "
@@ -87,7 +93,7 @@ public class LoggingSourceHandler implem
this.handler.requestReceived(conn);
}
- public void outputReady(final NHttpServerConnection conn, final ContentEncoder encoder) {
+ public void outputReady(final NHttpServerConnection conn, final ContentEncoder encoder) throws IOException, HttpException {
if (this.log.isDebugEnabled()) {
this.log.debug("HTTP connection " + conn + ": Output ready");
}
@@ -97,14 +103,14 @@ public class LoggingSourceHandler implem
}
}
- public void responseReady(final NHttpServerConnection conn) {
+ public void responseReady(final NHttpServerConnection conn) throws IOException, HttpException {
if (this.log.isDebugEnabled()) {
this.log.debug("HTTP connection " + conn + ": Response ready");
}
this.handler.responseReady(conn);
}
- public void inputReady(final NHttpServerConnection conn, final ContentDecoder decoder) {
+ public void inputReady(final NHttpServerConnection conn, final ContentDecoder decoder) throws IOException, HttpException {
if (this.log.isDebugEnabled()) {
this.log.debug("HTTP connection " + conn + ": Input ready");
}
@@ -114,7 +120,7 @@ public class LoggingSourceHandler implem
}
}
- public void timeout(final NHttpServerConnection conn) {
+ public void timeout(final NHttpServerConnection conn) throws IOException {
if (this.log.isDebugEnabled()) {
this.log.debug("HTTP connection " + conn + ": Timeout");
}
Modified: synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/logging/LoggingTargetHandler.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/logging/LoggingTargetHandler.java?rev=1506662&r1=1506661&r2=1506662&view=diff
==============================================================================
--- synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/logging/LoggingTargetHandler.java (original)
+++ synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/logging/LoggingTargetHandler.java Wed Jul 24 19:04:18 2013
@@ -16,26 +16,24 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.synapse.transport.passthru.logging;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.http.nio.NHttpClientHandler;
-import org.apache.http.nio.NHttpClientConnection;
-import org.apache.http.nio.ContentEncoder;
-import org.apache.http.nio.ContentDecoder;
+import org.apache.http.nio.*;
import org.apache.http.HttpException;
import org.apache.http.HttpResponse;
import java.io.IOException;
-public class LoggingTargetHandler implements NHttpClientHandler {
+public class LoggingTargetHandler implements NHttpClientEventHandler {
private final Log log;
- private final NHttpClientHandler handler;
+ private final NHttpClientEventHandler handler;
- public LoggingTargetHandler(final NHttpClientHandler handler) {
+ public LoggingTargetHandler(final NHttpClientEventHandler handler) {
super();
if (handler == null) {
throw new IllegalArgumentException("HTTP client handler may not be null");
@@ -44,7 +42,7 @@ public class LoggingTargetHandler implem
this.log = LogFactory.getLog(handler.getClass());
}
- public void connected(final NHttpClientConnection conn, final Object attachment) {
+ public void connected(final NHttpClientConnection conn, final Object attachment) throws IOException, HttpException {
if (this.log.isDebugEnabled()) {
this.log.debug("HTTP connection " + conn + ": Connected (" + attachment + ")");
}
@@ -58,24 +56,26 @@ public class LoggingTargetHandler implem
this.handler.closed(conn);
}
- public void exception(final NHttpClientConnection conn, final IOException ex) {
- this.log.error("HTTP connection " + conn + ": " + ex.getMessage(), ex);
- this.handler.exception(conn, ex);
+ public void endOfInput(NHttpClientConnection conn) throws IOException {
+ if (this.log.isDebugEnabled()) {
+ this.log.debug("HTTP connection " + conn + ": Closed at remote end");
+ }
+ this.handler.endOfInput(conn);
}
- public void exception(final NHttpClientConnection conn, final HttpException ex) {
+ public void exception(NHttpClientConnection conn, Exception ex) {
this.log.error("HTTP connection " + conn + ": " + ex.getMessage(), ex);
this.handler.exception(conn, ex);
}
- public void requestReady(final NHttpClientConnection conn) {
+ public void requestReady(final NHttpClientConnection conn) throws IOException, HttpException {
if (this.log.isDebugEnabled()) {
this.log.debug("HTTP connection " + conn + ": InRequest ready" + getRequestMessageID(conn));
}
this.handler.requestReady(conn);
}
- public void outputReady(final NHttpClientConnection conn, final ContentEncoder encoder) {
+ public void outputReady(final NHttpClientConnection conn, final ContentEncoder encoder) throws IOException, HttpException {
if (this.log.isDebugEnabled()) {
this.log.debug("HTTP connection " + conn + ": Output ready" + getRequestMessageID(conn));
}
@@ -85,7 +85,7 @@ public class LoggingTargetHandler implem
}
}
- public void responseReceived(final NHttpClientConnection conn) {
+ public void responseReceived(final NHttpClientConnection conn) throws IOException, HttpException {
HttpResponse response = conn.getHttpResponse();
if (this.log.isDebugEnabled()) {
this.log.debug("HTTP connection " + conn + " : "
@@ -94,7 +94,7 @@ public class LoggingTargetHandler implem
this.handler.responseReceived(conn);
}
- public void inputReady(final NHttpClientConnection conn, final ContentDecoder decoder) {
+ public void inputReady(final NHttpClientConnection conn, final ContentDecoder decoder) throws IOException, HttpException {
if (this.log.isDebugEnabled()) {
this.log.debug("HTTP connection " + conn + ": Input ready" + getRequestMessageID(conn));
}
@@ -104,7 +104,7 @@ public class LoggingTargetHandler implem
}
}
- public void timeout(final NHttpClientConnection conn) {
+ public void timeout(final NHttpClientConnection conn) throws IOException, HttpException {
if (this.log.isDebugEnabled()) {
this.log.debug("HTTP connection " + conn + ": Timeout" + getRequestMessageID(conn));
}
Modified: synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/logging/LoggingUtils.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/logging/LoggingUtils.java?rev=1506662&r1=1506661&r2=1506662&view=diff
==============================================================================
--- synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/logging/LoggingUtils.java (original)
+++ synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/logging/LoggingUtils.java Wed Jul 24 19:04:18 2013
@@ -16,13 +16,11 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.synapse.transport.passthru.logging;
+import org.apache.http.nio.*;
import org.apache.http.nio.reactor.IOSession;
-import org.apache.http.nio.NHttpClientHandler;
-import org.apache.http.nio.NHttpServiceHandler;
-import org.apache.http.nio.NHttpClientIOTarget;
-import org.apache.http.nio.NHttpServerIOTarget;
import org.apache.http.nio.util.ByteBufferAllocator;
import org.apache.http.HttpResponseFactory;
import org.apache.http.HttpRequestFactory;
@@ -32,21 +30,21 @@ import org.apache.http.params.HttpParams
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-
public class LoggingUtils {
+
public final static String HEADER_LOG_ID = "org.wso2.carbon.transport.passthru.headers";
public final static String WIRE_LOG_ID = "org.wso2.carbon.transport.passthru.wire";
public static IOSession decorate(IOSession session, final String id) {
Log log = LogFactory.getLog(session.getClass());
- Log wirelog = LogFactory.getLog(WIRE_LOG_ID);
- if (wirelog.isDebugEnabled() || log.isDebugEnabled()) {
- session = new LoggingIOSession(wirelog, session, id);
+ Log wireLog = LogFactory.getLog(WIRE_LOG_ID);
+ if (wireLog.isDebugEnabled() || log.isDebugEnabled()) {
+ session = new LoggingIOSession(wireLog, session, id);
}
return session;
}
- public static NHttpClientHandler decorate(NHttpClientHandler handler) {
+ public static NHttpClientEventHandler decorate(NHttpClientEventHandler handler) {
Log log = LogFactory.getLog(handler.getClass());
if (log.isDebugEnabled()) {
handler = new LoggingTargetHandler(handler);
@@ -54,7 +52,7 @@ public class LoggingUtils {
return handler;
}
- public static NHttpServiceHandler decorate(NHttpServiceHandler handler) {
+ public static NHttpServerEventHandler decorate(NHttpServerEventHandler handler) {
Log log = LogFactory.getLog(handler.getClass());
if (log.isDebugEnabled()) {
handler = new LoggingSourceHandler(handler);
@@ -62,17 +60,17 @@ public class LoggingUtils {
return handler;
}
- public static NHttpClientIOTarget createClientConnection(
+ public static DefaultNHttpClientConnection createClientConnection(
final IOSession iosession,
final HttpResponseFactory responseFactory,
final ByteBufferAllocator allocator,
final HttpParams params) {
Log log = LogFactory.getLog(DefaultNHttpClientConnection.class);
- Log headerlog = LogFactory.getLog(HEADER_LOG_ID);
- if (headerlog.isDebugEnabled() || log.isDebugEnabled()) {
+ Log headerLog = LogFactory.getLog(HEADER_LOG_ID);
+ if (headerLog.isDebugEnabled() || log.isDebugEnabled()) {
return new LoggingNHttpTargetConnection(
log,
- headerlog,
+ headerLog,
iosession,
responseFactory,
allocator,
@@ -86,17 +84,17 @@ public class LoggingUtils {
}
}
- public static NHttpServerIOTarget createServerConnection(
+ public static DefaultNHttpServerConnection createServerConnection(
final IOSession iosession,
final HttpRequestFactory requestFactory,
final ByteBufferAllocator allocator,
final HttpParams params) {
Log log = LogFactory.getLog(DefaultNHttpClientConnection.class);
- Log headerlog = LogFactory.getLog(HEADER_LOG_ID);
- if (headerlog.isDebugEnabled() || log.isDebugEnabled()) {
+ Log headerLog = LogFactory.getLog(HEADER_LOG_ID);
+ if (headerLog.isDebugEnabled() || log.isDebugEnabled()) {
return new LoggingNHttpSourceConnection(
log,
- headerlog,
+ headerLog,
iosession,
requestFactory,
allocator,
Added: synapse/trunk/java/modules/transports/core/nhttp/src/test/resources/nhttp.properties
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/transports/core/nhttp/src/test/resources/nhttp.properties?rev=1506662&view=auto
==============================================================================
--- synapse/trunk/java/modules/transports/core/nhttp/src/test/resources/nhttp.properties (added)
+++ synapse/trunk/java/modules/transports/core/nhttp/src/test/resources/nhttp.properties Wed Jul 24 19:04:18 2013
@@ -0,0 +1,8 @@
+http.socket.timeout=60000
+http.connection.timeout=0
+http.socket.buffer-size=8096
+http.tcp.nodelay=1
+http.nio.interest-ops-queueing=false
+
+# This property is crucial for automated tests
+http.socket.reuseaddr=true
\ No newline at end of file
Modified: synapse/trunk/java/pom.xml
URL: http://svn.apache.org/viewvc/synapse/trunk/java/pom.xml?rev=1506662&r1=1506661&r2=1506662&view=diff
==============================================================================
--- synapse/trunk/java/pom.xml (original)
+++ synapse/trunk/java/pom.xml Wed Jul 24 19:04:18 2013
@@ -1102,7 +1102,7 @@
<truezip.version>6.6</truezip.version>
<jsch.version>0.1.31</jsch.version>
<jms-1.1-spec.version>1.1</jms-1.1-spec.version>
- <httpcore.nio.version>4.1.4</httpcore.nio.version>
+ <httpcore.nio.version>4.2.4</httpcore.nio.version>
<http.client.version>4.1</http.client.version>
<aspectj.version>1.6.1</aspectj.version>
<qfj.version>1.4.0</qfj.version>