public class NingHttpPoster extends Object implements HttpPoster
HttpPoster.Response| Constructor and Description |
|---|
NingHttpPoster(String authHeader,
String apiUrl) |
NingHttpPoster(String authHeader,
String apiUrl,
com.ning.http.client.AsyncHttpClientConfig httpClientConfig) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
static NingHttpPoster |
newPoster(String username,
String token,
String apiUrl)
Return a new poster with the correct authentication header.
|
static NingHttpPoster |
newPoster(String username,
String token,
String apiUrl,
com.ning.http.client.AsyncHttpClientConfig httpClientConfig)
Return a new poster with the correct authentication header.
|
Future<HttpPoster.Response> |
post(String userAgent,
String payload)
POST the payload as JSON to librato.
|
public static NingHttpPoster newPoster(String username, String token, String apiUrl)
username - the librato usernametoken - the librato tokenapiUrl - the URL to post topublic static NingHttpPoster newPoster(String username, String token, String apiUrl, com.ning.http.client.AsyncHttpClientConfig httpClientConfig)
username - the librato usernametoken - the librato tokenapiUrl - the URL to post tohttpClientConfig - configuration of http client, this can be use to pass a proxy server.public Future<HttpPoster.Response> post(String userAgent, String payload) throws IOException
HttpPosterpost in interface HttpPosteruserAgent - the user agent to usepayload - the payload to postIOException - on IO-related errorpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionCopyright © 2015. All rights reserved.