public class HttpClientAdapter extends Object implements Closeable
Constructor and Description |
---|
HttpClientAdapter(String url) |
HttpClientAdapter(String url,
boolean enablePool) |
HttpClientAdapter(String url,
String username,
String password) |
HttpClientAdapter(String url,
String username,
String password,
boolean enablePool) |
HttpClientAdapter(URI uri) |
HttpClientAdapter(URI uri,
boolean enablePool) |
HttpClientAdapter(URI uri,
String username,
String password) |
HttpClientAdapter(URI uri,
String username,
String password,
boolean enablePool) |
Modifier and Type | Method and Description |
---|---|
void |
addCookie(org.apache.http.cookie.Cookie cookie) |
static org.apache.http.client.HttpResponseException |
buildHttpResponseException(org.apache.http.client.methods.HttpRequestBase request,
org.apache.http.HttpResponse response) |
static org.apache.http.client.HttpResponseException |
buildHttpResponseException(org.apache.http.client.methods.HttpRequestBase method,
org.apache.http.StatusLine statusLine)
Build Http Exception from method status
|
void |
close() |
static void |
close(HttpClientAdapter httpClientAdapter) |
org.apache.http.client.methods.CloseableHttpResponse |
execute(org.apache.http.client.methods.HttpRequestBase request)
Execute request, do not follow redirects.
|
org.apache.http.client.methods.CloseableHttpResponse |
execute(org.apache.http.client.methods.HttpRequestBase request,
org.apache.http.client.protocol.HttpClientContext context)
Execute request, do not follow redirects.
|
org.apache.jackrabbit.webdav.MultiStatus |
executeDavRequest(org.apache.jackrabbit.webdav.client.methods.BaseDavRequest request)
Execute WebDav request
|
org.apache.jackrabbit.webdav.MultiStatusResponse[] |
executeDavRequest(ExchangeDavRequest request)
Execute Exchange WebDav request
|
GetRequest |
executeFollowRedirect(GetRequest request) |
ResponseWrapper |
executeFollowRedirect(PostRequest request) |
String |
executeGetRequest(GetRequest getRequest)
Execute get request and return response body as string.
|
String |
executePostRequest(PostRequest postRequest)
Execute post request and return response body as string.
|
org.codehaus.jettison.json.JSONObject |
executeRestRequest(RestRequest restRequest) |
org.apache.jackrabbit.webdav.MultiStatusResponse[] |
executeSearchRequest(String path,
String searchStatement,
int maxCount)
Execute webdav search method.
|
List<org.apache.http.cookie.Cookie> |
getCookies() |
String |
getHost()
Get current uri host
|
static URI |
getRedirectLocation(org.apache.http.HttpResponse response)
Get redirect location from header.
|
URI |
getUri()
Current uri.
|
String |
getUserAgent() |
static boolean |
isGzipEncoded(org.apache.http.HttpResponse response)
Test if the response is gzip encoded
|
protected static boolean |
isNoProxyFor(URI uri) |
static boolean |
isRedirect(org.apache.http.HttpResponse response) |
static boolean |
isRedirect(int status)
Check if status is a redirect (various 30x values).
|
void |
setCredentials(String username,
String password) |
void |
setUri(URI uri)
Force current uri.
|
void |
startEvictorThread() |
public HttpClientAdapter(String url)
public HttpClientAdapter(String url, boolean enablePool)
public HttpClientAdapter(String url, String username, String password, boolean enablePool)
public HttpClientAdapter(URI uri)
public HttpClientAdapter(URI uri, boolean enablePool)
public static boolean isGzipEncoded(org.apache.http.HttpResponse response)
response
- http responsepublic String getHost()
public void setUri(URI uri)
uri
- new uripublic URI getUri()
protected static boolean isNoProxyFor(URI uri)
public void startEvictorThread()
public void close()
close
in interface Closeable
close
in interface AutoCloseable
public static void close(HttpClientAdapter httpClientAdapter)
public org.apache.http.client.methods.CloseableHttpResponse execute(org.apache.http.client.methods.HttpRequestBase request) throws IOException
request
- Http requestIOException
- on errorpublic org.apache.http.client.methods.CloseableHttpResponse execute(org.apache.http.client.methods.HttpRequestBase request, org.apache.http.client.protocol.HttpClientContext context) throws IOException
request
- Http requestcontext
- Http request contextIOException
- on errorpublic ResponseWrapper executeFollowRedirect(PostRequest request) throws IOException
IOException
public GetRequest executeFollowRedirect(GetRequest request) throws IOException
IOException
public String executeGetRequest(GetRequest getRequest) throws IOException
getRequest
- get requestIOException
- on errorpublic String executePostRequest(PostRequest postRequest) throws IOException
postRequest
- post requestIOException
- on errorpublic org.codehaus.jettison.json.JSONObject executeRestRequest(RestRequest restRequest) throws IOException
IOException
public org.apache.jackrabbit.webdav.MultiStatus executeDavRequest(org.apache.jackrabbit.webdav.client.methods.BaseDavRequest request) throws IOException
request
- WebDav requestIOException
- on errorpublic org.apache.jackrabbit.webdav.MultiStatusResponse[] executeDavRequest(ExchangeDavRequest request) throws IOException
request
- WebDav requestIOException
- on errorpublic org.apache.jackrabbit.webdav.MultiStatusResponse[] executeSearchRequest(String path, String searchStatement, int maxCount) throws IOException
path
- encoded searched folder pathsearchStatement
- (SQL like) search statementmaxCount
- max item countIOException
- on errorpublic static boolean isRedirect(org.apache.http.HttpResponse response)
public static boolean isRedirect(int status)
status
- Http statuspublic static URI getRedirectLocation(org.apache.http.HttpResponse response)
response
- Http responsepublic List<org.apache.http.cookie.Cookie> getCookies()
public void addCookie(org.apache.http.cookie.Cookie cookie)
public String getUserAgent()
public static org.apache.http.client.HttpResponseException buildHttpResponseException(org.apache.http.client.methods.HttpRequestBase request, org.apache.http.HttpResponse response)
public static org.apache.http.client.HttpResponseException buildHttpResponseException(org.apache.http.client.methods.HttpRequestBase method, org.apache.http.StatusLine statusLine)
method
- Http MethodCopyright © 2001–2024 MickaĆ«l Guessant. All rights reserved.