com.ecwid.mailchimp.connection
Class HttpClientConnectionManager

java.lang.Object
  extended by com.ecwid.mailchimp.connection.HttpClientConnectionManager
All Implemented Interfaces:
MailChimpConnectionManager, Closeable

public class HttpClientConnectionManager
extends Object
implements MailChimpConnectionManager

Implementation of MailChimpConnectionManager which uses Apache HttpClient library to access MailChimp API service point.

Author:
Vasily Karyaev

Constructor Summary
HttpClientConnectionManager()
          Constructor.
HttpClientConnectionManager(int connectTimeout, int readTimeout)
          Constructor.
 
Method Summary
 void close()
           
 int getConnectTimeout()
           
 int getReadTimeout()
           
 String post(String url, String payload)
          Make a POST request to MailChimp API service point.
 void setConnectTimeout(int connectTimeout)
           
 void setReadTimeout(int readTimeout)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpClientConnectionManager

public HttpClientConnectionManager()
Constructor. Equivalent to calling HttpClientConnectionManager(int, int) with both parameters set to 15000 (15 seconds).


HttpClientConnectionManager

public HttpClientConnectionManager(int connectTimeout,
                                   int readTimeout)
Constructor.

Parameters:
connectTimeout - the timeout (in milliseconds) when trying to connect to the remote server
readTimeout - the timeout (in milliseconds) when when waiting for the response from the remote server
Method Detail

post

public String post(String url,
                   String payload)
            throws IOException
Description copied from interface: MailChimpConnectionManager
Make a POST request to MailChimp API service point.

Specified by:
post in interface MailChimpConnectionManager
Parameters:
url - URL to post data to
payload - data to post
Returns:
service endpoint response body if the response was successful (a 2xx status code)
Throws:
IOException - if an I/O error occurred during the communication, or if the service point response was unsuccessful (>= 300 status code)

close

public void close()
Specified by:
close in interface Closeable

getConnectTimeout

public int getConnectTimeout()

setConnectTimeout

public void setConnectTimeout(int connectTimeout)

getReadTimeout

public int getReadTimeout()

setReadTimeout

public void setReadTimeout(int readTimeout)


Copyright © 2012-2014 Ecwid, Inc. All Rights Reserved.