public class UrlConnectionHttpClient extends Object implements IHttpClient
Modifier and Type | Class and Description |
---|---|
class |
UrlConnectionHttpClient.CallbackTrustManager |
IHttpClient.ISSLCertificateCallback
Modifier and Type | Field and Description |
---|---|
protected String |
acceptedMediaType |
protected String |
acceptedVersion |
protected String |
authIV |
protected String |
authKey |
protected Integer |
configTimeout |
protected String |
password |
protected IHttpClient.ISSLCertificateCallback |
sslAuthorizationCallback |
protected String |
token |
protected String |
userAgent |
protected String |
username |
AMPERSAND, AUTHORIZATION_BASIC, AUTHORIZATION_BEARER, COLON, COMMA, DEFAULT_READ_TIMEOUT, EQUALS, HTTP, MEDIATYPE_APPLICATION_FORMURLENCODED, MEDIATYPE_APPLICATION_JSON, MEDIATYPE_APPLICATION_XML, NO_TIMEOUT, PROPERTY_ACCEPT, PROPERTY_AUTHIV, PROPERTY_AUTHKEY, PROPERTY_AUTHORIZATION, PROPERTY_CONTENT_TYPE, PROPERTY_USER_AGENT, QUESTION_MARK, SEMICOLON, SLASH, SPACE, STATUS_BAD_REQUEST, STATUS_INTERNAL_SERVER_ERROR, STATUS_NOT_FOUND, STATUS_OK, STATUS_UNAUTHORIZED, SYSPROP_DEFAULT_CONNECT_TIMEOUT, SYSPROP_DEFAULT_READ_TIMEOUT, SYSPROP_OPENSHIFT_CONNECT_TIMEOUT, SYSPROP_OPENSHIFT_READ_TIMEOUT, VERSION
Constructor and Description |
---|
UrlConnectionHttpClient(String username,
String password,
String userAgent,
String acceptedMediaType,
String version) |
UrlConnectionHttpClient(String username,
String password,
String userAgent,
String acceptedMediaType,
String version,
String authKey,
String authIV) |
UrlConnectionHttpClient(String username,
String password,
String userAgent,
String acceptedMediaType,
String version,
String authKey,
String authIV,
String token,
IHttpClient.ISSLCertificateCallback callback,
Integer configTimeout,
String excludedSSLCipherRegex) |
Modifier and Type | Method and Description |
---|---|
protected HttpURLConnection |
createConnection(URL url,
String username,
String password,
String authKey,
String authIV,
String token,
String userAgent,
String acceptedVersion,
String acceptedMediaType,
IHttpClient.ISSLCertificateCallback callback,
int timeout) |
protected String |
createErrorMessage(IOException ioe,
HttpURLConnection connection) |
String |
delete(URL url,
IMediaType mediaType,
int timeout,
Parameter... parameters) |
String |
delete(URL url,
int timeout) |
String |
get(URL url,
int timeout) |
protected String[] |
getSupportedCiphers(SSLContext sslContext) |
String |
head(URL url,
int timeout) |
String |
patch(URL url,
IMediaType mediaType,
int timeout,
Parameter... parameters) |
String |
post(URL url,
IMediaType mediaType,
int timeout,
Parameter... parameters) |
String |
put(URL url,
IMediaType mediaType,
int timeout,
Parameter... parameters) |
protected String |
request(HttpMethod httpMethod,
URL url,
IMediaType requestMediaType,
int timeout,
Parameter... parameters) |
protected String |
request(HttpMethod httpMethod,
URL url,
IMediaType requestMediaType,
int timeout,
ParameterValueMap parameters) |
void |
setAcceptedMediaType(String acceptedMediaType) |
void |
setAcceptVersion(String version) |
protected SSLContext |
setFilteredCiphers(String excludedSSLCipherRegex,
SSLContext sslContext,
HttpsURLConnection connection)
Sets a ssl socket factory that sets a filtered list of ciphers based on
the #excludedSSLCipherRegex to the given connection.
|
void |
setUserAgent(String userAgent) |
protected String userAgent
protected String username
protected String password
protected String authKey
protected String authIV
protected String token
protected String acceptedMediaType
protected String acceptedVersion
protected IHttpClient.ISSLCertificateCallback sslAuthorizationCallback
protected Integer configTimeout
public UrlConnectionHttpClient(String username, String password, String userAgent, String acceptedMediaType, String version)
public UrlConnectionHttpClient(String username, String password, String userAgent, String acceptedMediaType, String version, String authKey, String authIV)
public String get(URL url, int timeout) throws HttpClientException, SocketTimeoutException
get
in interface IHttpClient
HttpClientException
SocketTimeoutException
public String head(URL url, int timeout) throws HttpClientException, SocketTimeoutException
head
in interface IHttpClient
HttpClientException
SocketTimeoutException
public String put(URL url, IMediaType mediaType, int timeout, Parameter... parameters) throws HttpClientException, SocketTimeoutException, EncodingException
put
in interface IHttpClient
HttpClientException
SocketTimeoutException
EncodingException
public String post(URL url, IMediaType mediaType, int timeout, Parameter... parameters) throws HttpClientException, SocketTimeoutException, EncodingException
post
in interface IHttpClient
HttpClientException
SocketTimeoutException
EncodingException
public String patch(URL url, IMediaType mediaType, int timeout, Parameter... parameters) throws HttpClientException, SocketTimeoutException, EncodingException
patch
in interface IHttpClient
HttpClientException
SocketTimeoutException
EncodingException
public String delete(URL url, IMediaType mediaType, int timeout, Parameter... parameters) throws HttpClientException, SocketTimeoutException, EncodingException
delete
in interface IHttpClient
HttpClientException
SocketTimeoutException
EncodingException
public String delete(URL url, int timeout) throws HttpClientException, SocketTimeoutException, EncodingException
delete
in interface IHttpClient
HttpClientException
SocketTimeoutException
EncodingException
protected String request(HttpMethod httpMethod, URL url, IMediaType requestMediaType, int timeout, Parameter... parameters) throws SocketTimeoutException, HttpClientException
protected String request(HttpMethod httpMethod, URL url, IMediaType requestMediaType, int timeout, ParameterValueMap parameters) throws SocketTimeoutException, HttpClientException
protected String createErrorMessage(IOException ioe, HttpURLConnection connection) throws IOException
IOException
protected HttpURLConnection createConnection(URL url, String username, String password, String authKey, String authIV, String token, String userAgent, String acceptedVersion, String acceptedMediaType, IHttpClient.ISSLCertificateCallback callback, int timeout) throws IOException
IOException
protected SSLContext setFilteredCiphers(String excludedSSLCipherRegex, SSLContext sslContext, HttpsURLConnection connection)
sslContext
- sslContext
- the ssl context that shall be usedurl
- the url we are connecting toconnection
- the connection that the cipher filter shall be applied toprotected String[] getSupportedCiphers(SSLContext sslContext)
public void setUserAgent(String userAgent)
setUserAgent
in interface IHttpClient
public void setAcceptVersion(String version)
setAcceptVersion
in interface IHttpClient
public void setAcceptedMediaType(String acceptedMediaType)
setAcceptedMediaType
in interface IHttpClient
Copyright © 2017 JBoss by Red Hat. All rights reserved.