com.ecwid.mailchimp.connection
Class JavaNetURLConnectionManager

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

public class JavaNetURLConnectionManager
extends Object
implements MailChimpConnectionManager

Implementation of MailChimpConnectionManager which uses standard java.net.* libraries to access MailChimp API service point.

Author:
James Broberg

Constructor Summary
JavaNetURLConnectionManager()
          Constructor.
JavaNetURLConnectionManager(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

JavaNetURLConnectionManager

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


JavaNetURLConnectionManager

public JavaNetURLConnectionManager(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()
           throws IOException
Specified by:
close in interface Closeable
Throws:
IOException

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.