Repository: camel Updated Branches: refs/heads/master 2ceeb4eba -> 6f916d800
CAMEL-9713: Expose the httpClient option, and use the correct name. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/6f916d80 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/6f916d80 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/6f916d80 Branch: refs/heads/master Commit: 6f916d80003d4f4ad11a66c81cf3ebb668d550be Parents: 2ceeb4e Author: Claus Ibsen <davscl...@apache.org> Authored: Tue Mar 15 20:48:01 2016 +0100 Committer: Claus Ibsen <davscl...@apache.org> Committed: Tue Mar 15 20:48:01 2016 +0100 ---------------------------------------------------------------------- .../component/jetty/JettyHttpEndpoint.java | 24 ++++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/6f916d80/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpEndpoint.java b/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpEndpoint.java index c5f11e5..f21d8c4 100644 --- a/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpEndpoint.java +++ b/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpEndpoint.java @@ -41,8 +41,12 @@ import org.eclipse.jetty.server.Handler; */ public abstract class JettyHttpEndpoint extends HttpCommonEndpoint { - private HttpClient client; - + @UriParam(label = "producer,advanced", + description = "Sets a shared HttpClient to use for all producers created by this endpoint. By default each producer will" + + " use a new http client, and not share. Important: Make sure to handle the lifecycle of the shared" + + " client, such as stopping the client, when it is no longer in use. Camel will call the start method on the client to ensure" + + " its started when this endpoint creates a producer. This options should only be used in special circumstances.") + private HttpClient httpClient; @UriParam(label = "consumer", description = "Specifies whether to enable the session manager on the server side of Jetty.") private boolean sessionSupport; @@ -138,11 +142,11 @@ public abstract class JettyHttpEndpoint extends HttpCommonEndpoint { @Override public Producer createProducer() throws Exception { JettyHttpProducer answer = new JettyHttpProducer(this); - if (client != null) { + if (httpClient != null) { // use shared client, and ensure its started so we can use it - client.start(); - answer.setSharedClient(client); - answer.setBinding(getJettyBinding(client)); + httpClient.start(); + answer.setSharedClient(httpClient); + answer.setBinding(getJettyBinding(httpClient)); } else { HttpClient httpClient = createJettyHttpClient(); answer.setClient(httpClient); @@ -213,8 +217,8 @@ public abstract class JettyHttpEndpoint extends HttpCommonEndpoint { this.handlers = handlers; } - public HttpClient getClient() throws Exception { - return client; + public HttpClient getHttpClient() throws Exception { + return httpClient; } /** @@ -229,8 +233,8 @@ public abstract class JettyHttpEndpoint extends HttpCommonEndpoint { * <p/> * This options should only be used in special circumstances. */ - public void setClient(HttpClient client) { - this.client = client; + public void setHttpClient(HttpClient httpClient) { + this.httpClient = httpClient; } public synchronized JettyHttpBinding getJettyBinding(HttpClient httpClient) {