Author: davsclaus
Date: Wed May 1 10:28:36 2013
New Revision: 1477945
URL: http://svn.apache.org/r1477945
Log:
CAMEL-6327: More work on new camel-netty-http component.
Modified:
camel/trunk/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpServerPipelineFactory.java
camel/trunk/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettyHttpComponent.java
camel/trunk/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpSSLTest.java
Modified:
camel/trunk/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpServerPipelineFactory.java
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpServerPipelineFactory.java?rev=1477945&r1=1477944&r2=1477945&view=diff
==============================================================================
---
camel/trunk/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpServerPipelineFactory.java
(original)
+++
camel/trunk/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpServerPipelineFactory.java
Wed May 1 10:28:36 2013
@@ -116,12 +116,31 @@ public class HttpServerPipelineFactory e
engine.setNeedClientAuth(consumer.getConfiguration().isNeedClientAuth());
return new SslHandler(engine);
} else {
- SSLEngineFactory sslEngineFactory = new SSLEngineFactory(
- consumer.getConfiguration().getKeyStoreFormat(),
- consumer.getConfiguration().getSecurityProvider(),
- consumer.getConfiguration().getKeyStoreFile(),
- consumer.getConfiguration().getTrustStoreFile(),
- consumer.getConfiguration().getPassphrase().toCharArray());
+ if (consumer.getConfiguration().getKeyStoreFile() == null &&
consumer.getConfiguration().getKeyStoreResource() == null) {
+ LOG.debug("keystorefile is null");
+ }
+ if (consumer.getConfiguration().getTrustStoreFile() == null &&
consumer.getConfiguration().getTrustStoreResource() == null) {
+ LOG.debug("truststorefile is null");
+ }
+ if (consumer.getConfiguration().getPassphrase().toCharArray() ==
null) {
+ LOG.debug("passphrase is null");
+ }
+ SSLEngineFactory sslEngineFactory;
+ if (consumer.getConfiguration().getKeyStoreFile() != null ||
consumer.getConfiguration().getTrustStoreFile() != null) {
+ sslEngineFactory = new SSLEngineFactory(
+ consumer.getConfiguration().getKeyStoreFormat(),
+ consumer.getConfiguration().getSecurityProvider(),
+ consumer.getConfiguration().getKeyStoreFile(),
+ consumer.getConfiguration().getTrustStoreFile(),
+
consumer.getConfiguration().getPassphrase().toCharArray());
+ } else {
+ sslEngineFactory = new
SSLEngineFactory(consumer.getContext().getClassResolver(),
+ consumer.getConfiguration().getKeyStoreFormat(),
+ consumer.getConfiguration().getSecurityProvider(),
+ consumer.getConfiguration().getKeyStoreResource(),
+ consumer.getConfiguration().getTrustStoreResource(),
+
consumer.getConfiguration().getPassphrase().toCharArray());
+ }
SSLEngine sslEngine = sslEngineFactory.createServerSSLEngine();
sslEngine.setUseClientMode(false);
sslEngine.setNeedClientAuth(consumer.getConfiguration().isNeedClientAuth());
Modified:
camel/trunk/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettyHttpComponent.java
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettyHttpComponent.java?rev=1477945&r1=1477944&r2=1477945&view=diff
==============================================================================
---
camel/trunk/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettyHttpComponent.java
(original)
+++
camel/trunk/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettyHttpComponent.java
Wed May 1 10:28:36 2013
@@ -30,6 +30,13 @@ import org.apache.camel.spi.HeaderFilter
*/
public class NettyHttpComponent extends NettyComponent implements
HeaderFilterStrategyAware {
+ // TODO: consider supporting on consumer
+ // - bridgeEndpoint
+ // - matchOnUriPrefix
+
+ // TODO: netty http producer
+ // TODO: make it easy to turn keep-alive on|off on producer
+
private NettyHttpBinding nettyHttpBinding;
private HeaderFilterStrategy headerFilterStrategy;
@@ -40,9 +47,6 @@ public class NettyHttpComponent extends
setNettyHttpBinding(new
DefaultNettyHttpBinding(getHeaderFilterStrategy()));
}
- // TODO: netty http producer
- // TODO: make it easy to turn keep-alive on|off on producer
-
@Override
protected Endpoint createEndpoint(String uri, String remaining,
Map<String, Object> parameters) throws Exception {
NettyConfiguration config;
Modified:
camel/trunk/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpSSLTest.java
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpSSLTest.java?rev=1477945&r1=1477944&r2=1477945&view=diff
==============================================================================
---
camel/trunk/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpSSLTest.java
(original)
+++
camel/trunk/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpSSLTest.java
Wed May 1 10:28:36 2013
@@ -16,12 +16,10 @@
*/
package org.apache.camel.component.netty.http;
-import java.io.File;
import java.net.URL;
import java.util.Properties;
import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.impl.JndiRegistry;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.After;
import org.junit.Test;
@@ -66,15 +64,6 @@ public class NettyHttpSSLTest extends Ba
}
@Override
- protected JndiRegistry createRegistry() throws Exception {
- JndiRegistry registry = super.createRegistry();
- registry.bind("password", "changeit");
- registry.bind("ksf", new File("src/test/resources/jsse/localhost.ks"));
- registry.bind("tsf", new File("src/test/resources/jsse/localhost.ks"));
- return registry;
- }
-
- @Override
public boolean isUseRouteBuilder() {
return false;
}
@@ -90,7 +79,7 @@ public class NettyHttpSSLTest extends Ba
context.addRoutes(new RouteBuilder() {
public void configure() {
-
from("netty-http:http://localhost:{{port}}?ssl=true&passphrase=#password&keyStoreFile=#ksf&trustStoreFile=#tsf")
+
from("netty-http:http://localhost:{{port}}?ssl=true&passphrase=changeit&keyStoreResource=jsse/localhost.ks&trustStoreResource=jsse/localhost.ks")
.to("mock:input")
.transform().constant("Bye World");
}