|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.deegree.commons.utils.net.HttpUtils
public class HttpUtils
HttpUtils
Example use from rhino:
var u = org.deegree.commons.utils.net.HttpUtils
u.retrieve(u.UTF8STRING, "http://demo.deegree.org/deegree-wms/services?request=capabilities&service=WMS")
Nested Class Summary | |
---|---|
static interface |
HttpUtils.Worker<T>
Worker is used to specify how to return the stream from the remote location. |
Field Summary | |
---|---|
static HttpUtils.Worker<BufferedImage> |
IMAGE
Returns a BufferedImage. |
static HttpUtils.Worker<com.google.gson.JsonElement> |
JSON
|
static HttpUtils.Worker<InputStream> |
STREAM
Directly returns the stream. |
static HttpUtils.Worker<String> |
UTF8STRING
Returns a decoded String. |
static HttpUtils.Worker<XMLAdapter> |
XML
Returns streaming XMLAdapter. |
static HttpUtils.Worker<XMLStreamReaderWrapper> |
XML_STREAM
Returns streaming XMLAdapter. |
Constructor Summary | |
---|---|
HttpUtils()
|
Method Summary | ||
---|---|---|
static org.apache.http.impl.client.DefaultHttpClient |
enableProxyUsage(org.apache.http.impl.client.DefaultHttpClient client,
DURL url)
reads proxyHost and proxyPort from system parameters and sets them to the passed HttpClient instance |
|
static
|
get(HttpUtils.Worker<T> worker,
String url,
Map<String,String> headers)
Performs an HTTP-Get request and provides typed access to the response. |
|
static
|
get(HttpUtils.Worker<T> worker,
String url,
Map<String,String> headers,
String user,
String pass)
Performs an HTTP-Get request and provides typed access to the response. |
|
static
|
getFullResponse(HttpUtils.Worker<T> worker,
String url,
Map<String,String> headers,
String user,
String pass)
Performs an HTTP-Get request and provides typed access to the response. |
|
static
|
getFullResponse(HttpUtils.Worker<T> worker,
String url,
Map<String,String> headers,
String user,
String pass,
int readTimeout)
|
|
static HttpUtils.Worker<String> |
getStringWorker(String encoding)
|
|
static
|
post(HttpUtils.Worker<T> worker,
String url,
File postBody,
Map<String,String> headers,
String user,
String pass)
Performs an HTTP-Get request and provides typed access to the response. |
|
static
|
post(HttpUtils.Worker<T> worker,
String url,
InputStream postBody,
Map<String,String> headers)
Performs an HTTP-Get request and provides typed access to the response. |
|
static
|
post(HttpUtils.Worker<T> worker,
String url,
Map<String,String> params,
Map<String,String> headers,
int readTimeout)
|
|
static
|
postFullResponse(HttpUtils.Worker<T> worker,
String url,
Map<String,String> params,
Map<String,String> headers,
int readTimeout)
|
|
static
|
retrieve(HttpUtils.Worker<T> worker,
DURL url)
|
|
static
|
retrieve(HttpUtils.Worker<T> worker,
String url)
|
|
static
|
retrieve(HttpUtils.Worker<T> worker,
String url,
Map<String,String> map)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final HttpUtils.Worker<InputStream> STREAM
public static final HttpUtils.Worker<XMLAdapter> XML
public static final HttpUtils.Worker<XMLStreamReaderWrapper> XML_STREAM
public static final HttpUtils.Worker<String> UTF8STRING
public static final HttpUtils.Worker<com.google.gson.JsonElement> JSON
public static final HttpUtils.Worker<BufferedImage> IMAGE
Constructor Detail |
---|
public HttpUtils()
Method Detail |
---|
public static HttpUtils.Worker<String> getStringWorker(String encoding)
encoding
-
public static <T> T retrieve(HttpUtils.Worker<T> worker, DURL url) throws IOException
T
- worker
- url
- must be valid
IOException
public static <T> T retrieve(HttpUtils.Worker<T> worker, String url) throws MalformedURLException, IOException
T
- worker
- url
-
MalformedURLException
IOException
public static <T> T retrieve(HttpUtils.Worker<T> worker, String url, Map<String,String> map) throws MalformedURLException, IOException
T
- worker
- url
- map
-
IOException
MalformedURLException
public static <T> T post(HttpUtils.Worker<T> worker, String url, InputStream postBody, Map<String,String> headers) throws IOException
T
- worker
- url
- postBody
- headers
- may be null
IOException
public static <T> T post(HttpUtils.Worker<T> worker, String url, Map<String,String> params, Map<String,String> headers, int readTimeout) throws IOException
T
- worker
- url
- params
- KVP parameter map to set in the post bodyheaders
-
IOException
public static <T> Pair<T,org.apache.http.HttpResponse> postFullResponse(HttpUtils.Worker<T> worker, String url, Map<String,String> params, Map<String,String> headers, int readTimeout) throws IOException
T
- worker
- url
- params
- KVP parameter map to set in the post bodyheaders
-
IOException
public static <T> T post(HttpUtils.Worker<T> worker, String url, File postBody, Map<String,String> headers, String user, String pass) throws IOException
T
- worker
- url
- postBody
- headers
- may be nulluser
- optional username for HTTP basic authenticationpass
- optional password for HTTP basic authentication
IOException
public static <T> T get(HttpUtils.Worker<T> worker, String url, Map<String,String> headers) throws IOException
T
- worker
- url
- headers
- may be null
IOException
public static <T> T get(HttpUtils.Worker<T> worker, String url, Map<String,String> headers, String user, String pass) throws IOException
T
- worker
- url
- headers
- may be nulluser
- optional username for HTTP basic authenticationpass
- optional password for HTTP basic authentication
IOException
public static <T> Pair<T,org.apache.http.HttpResponse> getFullResponse(HttpUtils.Worker<T> worker, String url, Map<String,String> headers, String user, String pass) throws IOException
T
- worker
- url
- headers
- may be nulluser
- optional username for HTTP basic authenticationpass
- optional password for HTTP basic authentication
IOException
public static <T> Pair<T,org.apache.http.HttpResponse> getFullResponse(HttpUtils.Worker<T> worker, String url, Map<String,String> headers, String user, String pass, int readTimeout) throws IOException
IOException
public static org.apache.http.impl.client.DefaultHttpClient enableProxyUsage(org.apache.http.impl.client.DefaultHttpClient client, DURL url)
client
- url
- must be valid
HttpClient
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |