public class HttpOp extends Object
For HTTP GET, the application supplies a URL, the accept header string, and a list of handlers to deal with different content type responses.
For HTTP POST, the application supplies a URL, content, the accept header string, and a list of handlers to deal with different content type responses, or no response is expected.
For HTTP PUT, the application supplies a URL, content, the accept header string
Constructor and Description |
---|
HttpOp() |
Modifier and Type | Method and Description |
---|---|
static void |
execHttpGet(String url,
String acceptHeader,
Map<String,HttpResponseHandler> handlers)
GET
|
static void |
execHttpPost(String url,
org.apache.http.HttpEntity provider,
String acceptType,
Map<String,HttpResponseHandler> handlers)
POST with response body.
|
static void |
execHttpPost(String url,
String contentType,
ContentProducer provider,
String acceptType,
Map<String,HttpResponseHandler> handlers)
POST with response body
|
static void |
execHttpPost(String url,
String contentType,
InputStream input,
long length)
POST without response body.
|
static void |
execHttpPost(String url,
String contentType,
InputStream input,
long length,
String acceptType,
Map<String,HttpResponseHandler> handlers)
POST with response body.
|
static void |
execHttpPost(String url,
String contentType,
String content)
POST a string without response body.
|
static void |
execHttpPost(String url,
String contentType,
String content,
String acceptType,
Map<String,HttpResponseHandler> handlers)
POST a string, expect a response body.
|
static void |
execHttpPostForm(String url,
List<Pair<String,String>> params,
Map<String,HttpResponseHandler> handlers)
Execute an HTTP POST form operation
|
static void |
execHttpPut(String url,
org.apache.http.HttpEntity entity)
Execute an HTTP PUT operation
|
static void |
execHttpPut(String url,
String contentType,
InputStream input,
long length)
Execute an HTTP PUT operation
|
static void |
execHttpPut(String url,
String contentType,
String content)
Execute an HTTP PUT operation
|
public static void execHttpGet(String url, String acceptHeader, Map<String,HttpResponseHandler> handlers)
The acceptHeader string is any legal value for HTTP Accept: field.
The handlers are the set of content types (without charset), used to dispatch the response body for handling.
A Map entry of ("*",....) is used "no handler found".
HTTP responses 400 and 500 become exceptions.
public static void execHttpPost(String url, String contentType, String content)
Execute an HTTP POST, with the string as content.
No response content expected or processed.
public static void execHttpPost(String url, String contentType, InputStream input, long length)
Execute an HTTP POST, with the string as content.
No response content expected or processed.
public static void execHttpPost(String url, String contentType, String content, String acceptType, Map<String,HttpResponseHandler> handlers)
public static void execHttpPost(String url, String contentType, InputStream input, long length, String acceptType, Map<String,HttpResponseHandler> handlers)
public static void execHttpPost(String url, String contentType, ContentProducer provider, String acceptType, Map<String,HttpResponseHandler> handlers)
public static void execHttpPost(String url, org.apache.http.HttpEntity provider, String acceptType, Map<String,HttpResponseHandler> handlers)
The content for the POST body comes from the HttpEntity.
The response is handled bythe handler map, as per execHttpGet(String, String, Map)
public static void execHttpPostForm(String url, List<Pair<String,String>> params, Map<String,HttpResponseHandler> handlers)
public static void execHttpPut(String url, String contentType, String content)
public static void execHttpPut(String url, String contentType, InputStream input, long length)
public static void execHttpPut(String url, org.apache.http.HttpEntity entity)
Licenced under the Apache License, Version 2.0