public final class HttpUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
static Function<org.apache.http.HttpResponse,String> |
getContentFn
Return the content of the response as a string.
|
static Function<org.apache.http.HttpResponse,Integer> |
getStatusCode |
static Function<Tuple<String,String>,org.apache.http.NameValuePair> |
param_ |
| Modifier and Type | Method and Description |
|---|---|
static Function<org.apache.http.HttpResponse,org.apache.http.HttpResponse> |
expect(int... status)
Return the response if its status code equals one of the given statuses or throw an exception.
|
static org.apache.http.client.methods.HttpGet |
get(String path,
Tuple<String,String>... queryParams) |
static Function<org.apache.http.HttpResponse,String> |
getContentOn(int... status)
Return the content of the response as a string if its status code equals one of the given statuses.
|
static String |
getContentOn(TrustedHttpClient.RequestRunner<String> runner,
int... status) |
static <A> A |
getOrError(Either<Exception,A> response)
Get the value or throw the exception.
|
static boolean |
isOk(org.apache.http.HttpResponse res) |
static org.apache.http.NameValuePair |
param(String name,
String value) |
static org.apache.http.NameValuePair |
param(Tuple<String,String> p) |
static String |
path(String... path) |
static org.apache.http.client.methods.HttpPost |
post(org.apache.http.NameValuePair... formParams) |
static org.apache.http.client.methods.HttpPost |
post(String uri,
List<org.apache.http.NameValuePair> formParams) |
static org.apache.http.client.methods.HttpPost |
post(String uri,
org.apache.http.NameValuePair... formParams) |
static Either<Exception,Integer> |
waitForResource(TrustedHttpClient http,
URI resourceUri,
int expectedStatus,
long timeout,
long pollingInterval)
Wait for a certain status of a resource.
|
public static org.apache.http.client.methods.HttpPost post(org.apache.http.NameValuePair... formParams)
public static org.apache.http.client.methods.HttpPost post(String uri, org.apache.http.NameValuePair... formParams)
public static org.apache.http.client.methods.HttpPost post(String uri, List<org.apache.http.NameValuePair> formParams)
public static org.apache.http.client.methods.HttpGet get(String path, Tuple<String,String>... queryParams)
public static Function<org.apache.http.HttpResponse,String> getContentOn(int... status)
Function composition of getContentFn and expect(int...).
public static String getContentOn(TrustedHttpClient.RequestRunner<String> runner, int... status)
public static Function<org.apache.http.HttpResponse,org.apache.http.HttpResponse> expect(int... status)
public static <A> A getOrError(Either<Exception,A> response)
public static boolean isOk(org.apache.http.HttpResponse res)
public static Either<Exception,Integer> waitForResource(TrustedHttpClient http, URI resourceUri, int expectedStatus, long timeout, long pollingInterval)
Copyright © 2009–2021 Opencast Project. All rights reserved.