public class UrlConnectionHttpClient extends Object implements IHttpClient
| Modifier and Type | Field and Description |
|---|---|
protected String |
acceptedMediaType |
protected String |
acceptedVersion |
protected String |
authIV |
protected String |
authKey |
protected String |
password |
protected boolean |
sslChecks |
protected String |
userAgent |
protected String |
username |
AMPERSAND, AUTHORIZATION_BASIC, COLON, COMMA, DEFAULT_CONNECT_TIMEOUT, 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, VERSION| Constructor and Description |
|---|
UrlConnectionHttpClient(String username,
String password,
String userAgent,
boolean sslChecks,
String acceptedMediaType,
String version) |
UrlConnectionHttpClient(String username,
String password,
String userAgent,
boolean sslChecks,
String acceptedMediaType,
String version,
String authKey,
String authIV) |
| Modifier and Type | Method and Description |
|---|---|
protected HttpURLConnection |
createConnection(URL url,
String username,
String password,
String authKey,
String authIV,
String userAgent,
String acceptedVersion,
String acceptedMediaType,
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) |
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) |
void |
setUserAgent(String userAgent) |
protected String userAgent
protected boolean sslChecks
protected String username
protected String password
protected String authKey
protected String authIV
protected String acceptedMediaType
protected String acceptedVersion
public UrlConnectionHttpClient(String username, String password, String userAgent, boolean sslChecks, String acceptedMediaType, String version)
public String get(URL url, int timeout) throws HttpClientException, SocketTimeoutException
get in interface IHttpClientHttpClientExceptionSocketTimeoutExceptionpublic String put(URL url, IMediaType mediaType, int timeout, Parameter... parameters) throws HttpClientException, SocketTimeoutException, EncodingException
put in interface IHttpClientHttpClientExceptionSocketTimeoutExceptionEncodingExceptionpublic String post(URL url, IMediaType mediaType, int timeout, Parameter... parameters) throws HttpClientException, SocketTimeoutException, EncodingException
post in interface IHttpClientHttpClientExceptionSocketTimeoutExceptionEncodingExceptionpublic String delete(URL url, IMediaType mediaType, int timeout, Parameter... parameters) throws HttpClientException, SocketTimeoutException, EncodingException
delete in interface IHttpClientHttpClientExceptionSocketTimeoutExceptionEncodingExceptionpublic String delete(URL url, int timeout) throws HttpClientException, SocketTimeoutException, EncodingException
delete in interface IHttpClientHttpClientExceptionSocketTimeoutExceptionEncodingExceptionprotected 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
IOExceptionprotected HttpURLConnection createConnection(URL url, String username, String password, String authKey, String authIV, String userAgent, String acceptedVersion, String acceptedMediaType, int timeout) throws IOException
IOExceptionpublic void setUserAgent(String userAgent)
setUserAgent in interface IHttpClientpublic void setAcceptVersion(String version)
setAcceptVersion in interface IHttpClientpublic void setAcceptedMediaType(String acceptedMediaType)
setAcceptedMediaType in interface IHttpClientCopyright © 2013 JBoss by Red Hat. All rights reserved.