org.codeforamerica.open311.internals.network
Class HTTPNetworkManager
java.lang.Object
org.codeforamerica.open311.internals.network.HTTPNetworkManager
- All Implemented Interfaces:
- NetworkManager
public class HTTPNetworkManager
- extends Object
- implements NetworkManager
Implementation using the Apache
HttpComponents library.
- Author:
- Santiago Munín
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
HTTPNetworkManager
public HTTPNetworkManager(Format format)
doGet
public String doGet(URL url)
throws IOException
- Description copied from interface:
NetworkManager
- Sends a GET HTTP request.
- Specified by:
doGet
in interface NetworkManager
- Parameters:
url
- Target.
- Returns:
- Server response.
- Throws:
IOException
- If there was any problem with the connection.
doPost
public String doPost(URL url,
Map<String,String> parameters)
throws IOException
- Description copied from interface:
NetworkManager
- Sends a POST HTTP request.
- Specified by:
doPost
in interface NetworkManager
- Parameters:
url
- Target.parameters
- Parameters of the POST operation.
- Returns:
- Server response.
- Throws:
IOException
- If there was any problem with the connection.
setFormat
public void setFormat(Format format)
- Description copied from interface:
NetworkManager
- Sets the desired format of the requests.
- Specified by:
setFormat
in interface NetworkManager
- Parameters:
format
- A serialization format (XML or JSON).
Copyright © 2013 Code for America. All Rights Reserved.