public class HttpURLClient extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
HttpURLClient.Verifier
DO NOT use in production!!!
|
| Constructor and Description |
|---|
HttpURLClient(Map<String,String> headers,
String user,
String pass) |
| Modifier and Type | Method and Description |
|---|---|
static HttpURLClient.Verifier |
getHostnameVerifier() |
static StringBuffer |
getResponseBody(HttpURLConnection con)
Reads the response stream and converts it to a StringBuffer.
|
static SSLSocketFactory |
getSSLSocketFactoryTrusted()
Do not use in production code!!
|
static String |
getStringFromInputStream(InputStream is)
Converts an InputStream to String.
|
boolean |
isVerbose() |
static void |
main(String[] args) |
static de.narimo.commons.http.URLResponse |
makeResponse(HttpURLConnection con,
StringBuffer responseBody,
boolean responseAsStream)
Assemble correct response from the HTTPURLConnection
|
static de.narimo.commons.http.URLResponse |
sendRequest(String wsUrl,
Map<String,String> queryParams,
Map<String,String> connectionHeaders,
String body,
HttpMethod method,
javax.ws.rs.core.Cookie[] cookies,
String user,
String pass,
boolean https,
boolean responseAsStream) |
static de.narimo.commons.http.URLResponse |
sendRequest(String wsUrl,
Map<String,String> queryParams,
Map<String,String> connectionHeaders,
String body,
HttpMethod method,
HTTPAuthorizationFactory authFactory,
boolean https,
boolean responseAsStream,
boolean followRedirects) |
static de.narimo.commons.http.URLResponse |
sendRequest(String wsUrl,
Map<String,String> queryParams,
Map<String,String> connectionHeaders,
String body,
HttpMethod method,
HTTPBasicAuthorizationFactory authFactory,
boolean https,
boolean responseAsStream) |
static de.narimo.commons.http.URLResponse |
sendRequestMultivalue(String wsUrl,
javax.ws.rs.core.MultivaluedMap<String,String> queryParams,
Map<String,String> connectionHeaders,
String body,
HttpMethod method,
HTTPBasicAuthorizationFactory authFactory,
boolean https,
boolean responseAsStream,
boolean followRedirects) |
void |
setFollowRedirects(boolean followRedirects) |
void |
setHttps(boolean https) |
void |
setHttps(boolean https,
SSLSocketFactory optSSLFactory,
HostnameVerifier optHostnameVerifier) |
void |
setResponseAsStream(boolean responseAsStream) |
void |
setVerbose(boolean verbose) |
public void setHttps(boolean https)
public void setHttps(boolean https,
SSLSocketFactory optSSLFactory,
HostnameVerifier optHostnameVerifier)
public void setFollowRedirects(boolean followRedirects)
public static StringBuffer getResponseBody(HttpURLConnection con) throws IOException
con - IOExceptionpublic static de.narimo.commons.http.URLResponse makeResponse(HttpURLConnection con, StringBuffer responseBody, boolean responseAsStream) throws IOException
con - responseBody - responseAsStream - IOExceptionpublic static de.narimo.commons.http.URLResponse sendRequest(String wsUrl, Map<String,String> queryParams, Map<String,String> connectionHeaders, String body, HttpMethod method, javax.ws.rs.core.Cookie[] cookies, String user, String pass, boolean https, boolean responseAsStream) throws IOException
IOExceptionpublic static de.narimo.commons.http.URLResponse sendRequest(String wsUrl, Map<String,String> queryParams, Map<String,String> connectionHeaders, String body, HttpMethod method, HTTPBasicAuthorizationFactory authFactory, boolean https, boolean responseAsStream) throws Exception
Exceptionpublic static de.narimo.commons.http.URLResponse sendRequest(String wsUrl, Map<String,String> queryParams, Map<String,String> connectionHeaders, String body, HttpMethod method, HTTPAuthorizationFactory authFactory, boolean https, boolean responseAsStream, boolean followRedirects) throws Exception
Exceptionpublic static de.narimo.commons.http.URLResponse sendRequestMultivalue(String wsUrl, javax.ws.rs.core.MultivaluedMap<String,String> queryParams, Map<String,String> connectionHeaders, String body, HttpMethod method, HTTPBasicAuthorizationFactory authFactory, boolean https, boolean responseAsStream, boolean followRedirects) throws Exception
Exceptionpublic void setResponseAsStream(boolean responseAsStream)
public static String getStringFromInputStream(InputStream is)
is - public boolean isVerbose()
public void setVerbose(boolean verbose)
public static SSLSocketFactory getSSLSocketFactoryTrusted() throws Exception
Exceptionpublic static HttpURLClient.Verifier getHostnameVerifier()
public static void main(String[] args) throws URISyntaxException, MalformedURLException
Copyright © 2020. All rights reserved.