Search in sources :

Example 1 with BootstrapConfiguration

use of org.wso2.transport.http.netty.contractimpl.sender.channel.BootstrapConfiguration in project wso2-synapse by wso2.

the class Axis2HttpTransportSender method init.

@Override
public void init(ConfigurationContext configurationContext, TransportOutDescription transportOutDescription) throws AxisFault {
    httpWsConnectorFactory = new DefaultHttpWsConnectorFactory();
    connectionManager = HttpUtils.getConnectionManager();
    bootstrapConfiguration = new BootstrapConfiguration(new HashMap<>());
    targetConfiguration = new TargetConfiguration(configurationContext, transportOutDescription);
    targetConfiguration.build();
}
Also used : TargetConfiguration(org.apache.synapse.transport.netty.config.TargetConfiguration) DefaultHttpWsConnectorFactory(org.wso2.transport.http.netty.contractimpl.DefaultHttpWsConnectorFactory) HashMap(java.util.HashMap) BootstrapConfiguration(org.wso2.transport.http.netty.contractimpl.sender.channel.BootstrapConfiguration)

Example 2 with BootstrapConfiguration

use of org.wso2.transport.http.netty.contractimpl.sender.channel.BootstrapConfiguration in project wso2-synapse by wso2.

the class TargetRequestHandler method createHttpClient.

public static HttpClientConnector createHttpClient(URL url, MessageContext msgContext, HttpWsConnectorFactory httpWsConnectorFactory, ConnectionManager connectionManager, BootstrapConfiguration bootstrapConfiguration, TargetConfiguration targetConfiguration) throws AxisFault {
    try {
        SenderConfiguration senderConfiguration = new SenderConfiguration();
        populateSenderConfigurations(msgContext, senderConfiguration, targetConfiguration, url);
        return httpWsConnectorFactory.createHttpClientConnector(bootstrapConfiguration, senderConfiguration, connectionManager);
    } catch (Exception ex) {
        throw new AxisFault("Error while creating the HTTP Client Connector. ", ex);
    }
}
Also used : AxisFault(org.apache.axis2.AxisFault) SenderConfiguration(org.wso2.transport.http.netty.contract.config.SenderConfiguration) MalformedURLException(java.net.MalformedURLException) IOException(java.io.IOException)

Example 3 with BootstrapConfiguration

use of org.wso2.transport.http.netty.contractimpl.sender.channel.BootstrapConfiguration in project wso2-synapse by wso2.

the class Axis2HttpTransportSender method sendRequestToBackendService.

/**
 * Sends an outbound request to the backend service.
 *
 * @param msgCtx axis2 message context
 * @param url    request URL of the backend service
 * @throws IOException if something goes wrong when sending the outbound request to the backend service
 */
private void sendRequestToBackendService(MessageContext msgCtx, URL url) throws IOException {
    HttpCarbonMessage outboundRequestMsg = TargetRequestHandler.createOutboundRequestMsg(url, msgCtx, targetConfiguration);
    HttpClientConnector clientConnector = TargetRequestHandler.createHttpClient(url, msgCtx, httpWsConnectorFactory, connectionManager, bootstrapConfiguration, targetConfiguration);
    TargetRequestHandler.sendRequest(clientConnector, outboundRequestMsg, msgCtx, targetConfiguration);
}
Also used : HttpCarbonMessage(org.wso2.transport.http.netty.message.HttpCarbonMessage) HttpClientConnector(org.wso2.transport.http.netty.contract.HttpClientConnector)

Aggregations

IOException (java.io.IOException)1 MalformedURLException (java.net.MalformedURLException)1 HashMap (java.util.HashMap)1 AxisFault (org.apache.axis2.AxisFault)1 TargetConfiguration (org.apache.synapse.transport.netty.config.TargetConfiguration)1 HttpClientConnector (org.wso2.transport.http.netty.contract.HttpClientConnector)1 SenderConfiguration (org.wso2.transport.http.netty.contract.config.SenderConfiguration)1 DefaultHttpWsConnectorFactory (org.wso2.transport.http.netty.contractimpl.DefaultHttpWsConnectorFactory)1 BootstrapConfiguration (org.wso2.transport.http.netty.contractimpl.sender.channel.BootstrapConfiguration)1 HttpCarbonMessage (org.wso2.transport.http.netty.message.HttpCarbonMessage)1