org.codeforamerica.open311.internals.network
Interface NetworkManager

All Known Implementing Classes:
HTTPNetworkManager, MockNetworkManager

public interface NetworkManager

Specifies the required operations of a NetworkManager

Author:
Santiago MunĂ­n

Field Summary
static String CHARSET
           
static String POST_CONTENT_TYPE
           
 
Method Summary
 String doGet(URL url)
          Sends a GET HTTP request.
 String doPost(URL url, Map<String,String> parameters)
          Sends a POST HTTP request.
 void setFormat(Format format)
          Sets the desired format of the requests.
 

Field Detail

POST_CONTENT_TYPE

static final String POST_CONTENT_TYPE
See Also:
Constant Field Values

CHARSET

static final String CHARSET
See Also:
Constant Field Values
Method Detail

doGet

String doGet(URL url)
             throws IOException
Sends a GET HTTP request.

Parameters:
url - Target.
Returns:
Server response.
Throws:
IOException - If there was any problem with the connection.

doPost

String doPost(URL url,
              Map<String,String> parameters)
              throws IOException
Sends a POST HTTP request.

Parameters:
url - Target.
parameters - Parameters of the POST operation.
Returns:
Server response.
Throws:
IOException - If there was any problem with the connection.

setFormat

void setFormat(Format format)
Sets the desired format of the requests.

Parameters:
format - A serialization format (XML or JSON).


Copyright © 2013 Code for America. All Rights Reserved.