1
votes

I need to implement https for <int-http:outbound-gateway>. my code is the following is it sufficient? What should i add to my code?

      <int-http:outbound-gateway id="oeactivatedGateway"
         url="${trigger.url}" http-method="DELETE" charset="UTF-8"
         reply-timeout="${ws.reply.timeout}" mapped-request-headers="Authorization,Content-Type,Accept"
         request-channel="channel.authorized.request" reply-channel="channel.reply"
         request-factory="requestFactory">

<bean id="requestFactory"
         class="org.springframework.http.client.SimpleClientHttpRequestFactory">
         <property name="proxy">
                <bean id="proxy" class="java.net.Proxy">
                       <constructor-arg>
                              <util:constant static-field="java.net.Proxy.Type.HTTP" />
                       </constructor-arg>
                       <constructor-arg>
                              <bean class="java.net.InetSocketAddress">
                                    <constructor-arg value="${http.proxy.address}" />
                                    <constructor-arg value="${http.proxy.port}" />
                              </bean>
                       </constructor-arg>
                </bean>
         </property>
   </bean>
1

1 Answers

1
votes

What do you mean "implement https"? To allow to perform HTTPS requests over the gateway? There is nothing to do with Spring Integration.

You just need to follow with standard Java SSL support - -Djavax.net.ssl.trustStore and -Djavax.net.ssl.keyStore. In the end there won't be anything to do from the application side.

It doesn't depend of the ClientHttpRequestFactory implementation by default.

Even if you can customize it somehow from the application context, e.g.:

CloseableHttpClient httpClient = 
  HttpClients.custom()
             .setSSLHostnameVerifier(new NoopHostnameVerifier())
             .build();
HttpComponentsClientHttpRequestFactory requestFactory = 
  new HttpComponentsClientHttpRequestFactory();
requestFactory.setHttpClient(httpClient);

it doesn't relate to Spring Integration and you feel free to go ahead with any your requirement. Since everything is Spring you will be able to wire everything together to let your <int-http:outbound-gateway> to work with HTTPS.