public class HTTPClient
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static ResponseHandler |
printResponseHandler |
Constructor and Description |
---|
HTTPClient() |
Modifier and Type | Method and Description |
---|---|
void |
get(java.lang.String url,
ResponseHandler handler)
Send a HTTP get request to an url.
|
void |
post(java.lang.String url,
java.lang.String body,
ResponseHandler handler)
Sends a POST request to a server.
|
public static ResponseHandler printResponseHandler
public void get(java.lang.String url, ResponseHandler handler) throws java.io.IOException
url
- The url.handler
- To handle the response you need a handler.java.io.IOException
- When the server can not be found.public void post(java.lang.String url, java.lang.String body, ResponseHandler handler) throws java.io.IOException
url
- The URL to POST to.body
- the body of the post request. This can contain parameters.handler
- The handler to handle the response from the server.java.io.IOException
- when communication goes wrong.