[jira] [Commented] (CAMEL-11474) Camel-Hipchat: Allow configurable http client
[ https://issues.apache.org/jira/browse/CAMEL-11474?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16309490#comment-16309490 ] ASF GitHub Bot commented on CAMEL-11474: ricardozanini commented on issue #2157: CAMEL-11474: adding HttpClient custom configuration support URL: https://github.com/apache/camel/pull/2157#issuecomment-354987758 Oh god, I swear I won't miss the CS next time. :( This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Camel-Hipchat: Allow configurable http client > - > > Key: CAMEL-11474 > URL: https://issues.apache.org/jira/browse/CAMEL-11474 > Project: Camel > Issue Type: Improvement > Components: camel-hipcat >Affects Versions: 2.19.1 >Reporter: Paul Watson >Assignee: Andrea Cosentino >Priority: Minor > Fix For: 2.21.0 > > > As it stands the Hipchat component uses a sealed private static final to > define the apache http client for communication. It would be great if we > could allow a more configurable client. > One such prominent use-case here is on-premise versions of Hipchat using > private certificates that need configuring on the SSLContext. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (CAMEL-11474) Camel-Hipchat: Allow configurable http client
[ https://issues.apache.org/jira/browse/CAMEL-11474?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16309437#comment-16309437 ] ASF GitHub Bot commented on CAMEL-11474: Github user oscerd closed the pull request at: https://github.com/apache/camel/pull/2157 > Camel-Hipchat: Allow configurable http client > - > > Key: CAMEL-11474 > URL: https://issues.apache.org/jira/browse/CAMEL-11474 > Project: Camel > Issue Type: Improvement > Components: camel-hipcat >Affects Versions: 2.19.1 >Reporter: Paul Watson >Priority: Minor > > As it stands the Hipchat component uses a sealed private static final to > define the apache http client for communication. It would be great if we > could allow a more configurable client. > One such prominent use-case here is on-premise versions of Hipchat using > private certificates that need configuring on the SSLContext. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (CAMEL-11474) Camel-Hipchat: Allow configurable http client
[ https://issues.apache.org/jira/browse/CAMEL-11474?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16309436#comment-16309436 ] ASF GitHub Bot commented on CAMEL-11474: oscerd closed pull request #2157: CAMEL-11474: adding HttpClient custom configuration support URL: https://github.com/apache/camel/pull/2157 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/components/camel-hipchat/src/main/docs/hipchat-component.adoc b/components/camel-hipchat/src/main/docs/hipchat-component.adoc index 2b15e62801f..7c9814d7867 100644 --- a/components/camel-hipchat/src/main/docs/hipchat-component.adoc +++ b/components/camel-hipchat/src/main/docs/hipchat-component.adoc @@ -79,6 +79,7 @@ with the following path and query parameters: | *startScheduler* (scheduler) | Whether the scheduler should be auto started. | true | boolean | *timeUnit* (scheduler) | Time unit for initialDelay and delay options. | MILLISECONDS | TimeUnit | *useFixedDelay* (scheduler) | Controls if fixed delay or fixed rate is used. See ScheduledExecutorService in JDK for details. | true | boolean +| *httpClient* | The custom `CloseableHttpClient` reference from registry to be used during API HTTP requests. Could be configured using Http Client class `HttpClientBuilder`. | Default `CloseableHttpClinent` from HttpClient library | org.apache.http.impl.client.CloseableHttpClient |=== // endpoint options: END @@ -180,6 +181,24 @@ The status of the API response received when message sent to the user. |HipchatFromUserResponseStatus |HipchatConstants.TO_ROOM_RESPONSE_STATUS |_http://hc.apache.org/httpcomponents-core-4.2.x/httpcore/apidocs/org/apache/http/StatusLine.html[StatusLine]_ |The status of the API response received when message sent to the room. |=== + Configuring Http Client + +The HipChat component allow your own `HttpClient` configuration. This can be done by defining a reference for `CloseableHttpClient` in the http://camel.apache.org/registry.html[registry] (e.g. Spring Context) and then, set the parameter during the Endpoint definition, for example: `hipchat:http://api.hipchat.com?httpClient=#myHttpClient`. + +[source,java] +-- +CloseableHttpClient httpclient = HttpClients.custom() +.setConnectionManager(connManager) +.setDefaultCookieStore(cookieStore) +.setDefaultCredentialsProvider(credentialsProvider) +.setProxy(new HttpHost("myproxy", 8080)) +.setDefaultRequestConfig(defaultRequestConfig) +.build(); +-- + +To see more information about Http Client configuration, please check the https://hc.apache.org/httpcomponents-client-ga/examples.html[official documentation]. + + Dependencies Maven users will need to add the following dependency to their pom.xml. diff --git a/components/camel-hipchat/src/main/java/org/apache/camel/component/hipchat/HipchatConfiguration.java b/components/camel-hipchat/src/main/java/org/apache/camel/component/hipchat/HipchatConfiguration.java index 6f54aed7559..a76836912da 100644 --- a/components/camel-hipchat/src/main/java/org/apache/camel/component/hipchat/HipchatConfiguration.java +++ b/components/camel-hipchat/src/main/java/org/apache/camel/component/hipchat/HipchatConfiguration.java @@ -20,12 +20,16 @@ import org.apache.camel.spi.UriParam; import org.apache.camel.spi.UriParams; import org.apache.camel.spi.UriPath; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; @UriParams public class HipchatConfiguration { -@UriPath @Metadata(required = "true") +@UriPath +@Metadata(required = "true") private String protocol; -@UriPath @Metadata(required = "true") +@UriPath +@Metadata(required = "true") private String host = HipchatConstants.DEFAULT_HOST; @UriPath(defaultValue = "" + HipchatConstants.DEFAULT_PORT) private Integer port = HipchatConstants.DEFAULT_PORT; @@ -33,6 +37,8 @@ private String authToken; @UriParam private String consumeUsers; +@UriParam(description = "The CloseableHttpClient reference from registry to be used during API HTTP requests.", defaultValue = "CloseableHttpClient default from HttpClient library") +private CloseableHttpClient httpClient = HttpClients.createDefault(); public String getHost() { return host; @@ -102,4 +108,12 @@ public String hipChatUrl() { public String withAuthToken(String urlPath) { return urlPath + HipchatApiConstants.AUTH_TOKEN_PREFIX + getAuthToken(); } + +public CloseableHttpCl
[jira] [Commented] (CAMEL-11474) Camel-Hipchat: Allow configurable http client
[ https://issues.apache.org/jira/browse/CAMEL-11474?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16309435#comment-16309435 ] ASF GitHub Bot commented on CAMEL-11474: oscerd commented on issue #2157: CAMEL-11474: adding HttpClient custom configuration support URL: https://github.com/apache/camel/pull/2157#issuecomment-354979620 I fixed the CS a bit. Closing this. Thanks. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Camel-Hipchat: Allow configurable http client > - > > Key: CAMEL-11474 > URL: https://issues.apache.org/jira/browse/CAMEL-11474 > Project: Camel > Issue Type: Improvement > Components: camel-hipcat >Affects Versions: 2.19.1 >Reporter: Paul Watson >Priority: Minor > > As it stands the Hipchat component uses a sealed private static final to > define the apache http client for communication. It would be great if we > could allow a more configurable client. > One such prominent use-case here is on-premise versions of Hipchat using > private certificates that need configuring on the SSLContext. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (CAMEL-11474) Camel-Hipchat: Allow configurable http client
[ https://issues.apache.org/jira/browse/CAMEL-11474?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16309419#comment-16309419 ] ASF GitHub Bot commented on CAMEL-11474: oscerd commented on issue #2157: CAMEL-11474: adding HttpClient custom configuration support URL: https://github.com/apache/camel/pull/2157#issuecomment-354977007 LGTM. I'm gonna merge. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Camel-Hipchat: Allow configurable http client > - > > Key: CAMEL-11474 > URL: https://issues.apache.org/jira/browse/CAMEL-11474 > Project: Camel > Issue Type: Improvement > Components: camel-hipcat >Affects Versions: 2.19.1 >Reporter: Paul Watson >Priority: Minor > > As it stands the Hipchat component uses a sealed private static final to > define the apache http client for communication. It would be great if we > could allow a more configurable client. > One such prominent use-case here is on-premise versions of Hipchat using > private certificates that need configuring on the SSLContext. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (CAMEL-11474) Camel-Hipchat: Allow configurable http client
[ https://issues.apache.org/jira/browse/CAMEL-11474?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16308056#comment-16308056 ] Ricardo Zanini commented on CAMEL-11474: PR sent https://github.com/apache/camel/pull/2157 > Camel-Hipchat: Allow configurable http client > - > > Key: CAMEL-11474 > URL: https://issues.apache.org/jira/browse/CAMEL-11474 > Project: Camel > Issue Type: Improvement > Components: camel-hipcat >Affects Versions: 2.19.1 >Reporter: Paul Watson >Priority: Minor > > As it stands the Hipchat component uses a sealed private static final to > define the apache http client for communication. It would be great if we > could allow a more configurable client. > One such prominent use-case here is on-premise versions of Hipchat using > private certificates that need configuring on the SSLContext. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (CAMEL-11474) Camel-Hipchat: Allow configurable http client
[ https://issues.apache.org/jira/browse/CAMEL-11474?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16066835#comment-16066835 ] Claus Ibsen commented on CAMEL-11474: - Yeah that sounds okay, you are welcome to work on a github PR > Camel-Hipchat: Allow configurable http client > - > > Key: CAMEL-11474 > URL: https://issues.apache.org/jira/browse/CAMEL-11474 > Project: Camel > Issue Type: Improvement > Components: camel-hipcat >Affects Versions: 2.19.1 >Reporter: Paul Watson >Priority: Trivial > > As it stands the Hipchat component uses a sealed private static final to > define the apache http client for communication. It would be great if we > could allow a more configurable client. > One such prominent use-case here is on-premise versions of Hipchat using > private certificates that need configuring on the SSLContext. -- This message was sent by Atlassian JIRA (v6.4.14#64029)