【问题标题】:HttpConnectionManagerParams not working for HTTPS URLHttpConnectionManagerParams 不适用于 HTTPS URL
【发布时间】:2019-03-12 05:44:35
【问题描述】:

我们使用 Apache Camel 的 camel-http 组件与 HTTP 端点集成,HttpConnectionManagerParams 用于配置 defaultconnectionsPerHost 和 maxTotalConnections。

<bean class="org.apache.commons.httpclient.params.HttpConnectionManagerParams" id="MyHttpConnectionManagerParams">
    <property name="defaultMaxConnectionsPerHost" value="20"/>
    <property name="maxTotalConnections" value="200"/>
</bean>

以上参数仅在endpoint URL通过HTTP时生效,相同配置无效,默认HttpConnectionManager在endpoint通过HTTPS时生效。

HTTPS url 是否需要额外配置?

【问题讨论】:

    标签: java apache-camel java-ee-6 camel-http


    【解决方案1】:

    在下面添加 bean 已经解决了我的问题。 同意 Camel 中没有名为 HTTPS 的组件,但在旧版本和新版本的 Apache Camel 中都可以使用以下配置。

    <bean class="org.apache.camel.component.http.HttpComponent" id="http">
       <property name="camelContext" ref="myCamelContext"/>
       <property name="httpConnectionManager" ref="MyHttpConnectionManager"/>
     </bean>
    <bean class="org.apache.camel.component.http.HttpComponent" id="https">
       <property name="camelContext" ref="myCamelContext"/>
       <property name="httpConnectionManager" ref="MyHttpConnectionManager"/>
     </bean>
    <bean class="org.apache.commons.httpclient.MultiThreadedHttpConnectionManager" id="MyHttpConnectionManager">
       <property name="params" ref="MyHttpConnectionManagerParams"/>
     </bean>
    <bean class="org.apache.commons.httpclient.params.HttpConnectionManagerParams" id="MyHttpConnectionManagerParams">
       <property name="defaultMaxConnectionsPerHost" value="100"/>
       <property name="maxTotalConnections" value="500"/>
     </bean>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-04-15
      • 1970-01-01
      • 1970-01-01
      • 2022-11-30
      • 2013-09-24
      • 1970-01-01
      • 2011-04-14
      • 2018-08-29
      相关资源
      最近更新 更多