Example usage for org.apache.commons.httpclient.contrib.ssl EasySSLProtocolSocketFactory EasySSLProtocolSocketFactory

List of usage examples for org.apache.commons.httpclient.contrib.ssl EasySSLProtocolSocketFactory EasySSLProtocolSocketFactory

Introduction

In this page you can find the example usage for org.apache.commons.httpclient.contrib.ssl EasySSLProtocolSocketFactory EasySSLProtocolSocketFactory.

Prototype

public EasySSLProtocolSocketFactory() 

Source Link

Document

Constructor for EasySSLProtocolSocketFactory.

Usage

From source file:org.wso2.mdm.integration.common.MDMHttpClient.java

public MDMResponse delete(String endpoint) {

    HttpClient client = new HttpClient();

    try {//  ww w .j a  v a 2 s .co  m
        ProtocolSocketFactory socketFactory = new EasySSLProtocolSocketFactory();

        Protocol https = new Protocol("https", socketFactory, 9443);
        Protocol.registerProtocol("https", https);

        String url = backEndUrl + endpoint;

        DeleteMethod method = new DeleteMethod(url);
        method.setRequestHeader(AUTHORIZATION, authrizationString);
        method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER,
                new DefaultHttpMethodRetryHandler(3, false));

        MDMResponse mdmResponse = new MDMResponse();
        mdmResponse.setStatus(client.executeMethod(method));
        mdmResponse.setBody(method.getResponseBodyAsString());
        return mdmResponse;

    } catch (GeneralSecurityException e) {
        log.error("Failure occurred at MDMResponse delete for GeneralSecurityException", e);
    } catch (IOException e) {
        log.error("Failure occurred at MDMResponse delete for IOException", e);
    }
    return null;
}