public class UrlConnectionHttpClient extends Object implements IHttpClient
AMPERSAND, AUTHORIZATION_BASIC, COLON, EQUALS, MEDIATYPE_APPLICATION_FORMURLENCODED, MEDIATYPE_APPLICATION_JSON, MEDIATYPE_APPLICATION_XML, PROPERTY_ACCEPT, PROPERTY_AUTHIV, PROPERTY_AUTHKEY, PROPERTY_AUTHORIZATION, PROPERTY_CONTENT_TYPE, PROPERTY_USER_AGENT, SEMICOLON, SPACE, STATUS_BAD_REQUEST, STATUS_INTERNAL_SERVER_ERROR, STATUS_NOT_FOUND, STATUS_OK, STATUS_UNAUTHORIZED, VERSION
Constructor and Description |
---|
UrlConnectionHttpClient(String username,
String password,
String userAgent,
boolean sslChecks,
IMediaType requestMediaType,
String acceptedMediaType,
String version) |
UrlConnectionHttpClient(String username,
String password,
String userAgent,
boolean sslChecks,
IMediaType requestMediaType,
String acceptedMediaType,
String version,
String authKey,
String authIV) |
Modifier and Type | Method and Description |
---|---|
protected HttpURLConnection |
createConnection(String username,
String password,
String authKey,
String authIV,
String userAgent,
URL url) |
protected HttpURLConnection |
createConnection(String username,
String password,
String userAgent,
URL url) |
protected String |
createErrorMessage(IOException ioe,
HttpURLConnection connection) |
String |
delete(Map<String,Object> parameters,
URL url) |
protected String |
delete(String data,
URL url) |
String |
delete(URL url) |
String |
get(URL url) |
String |
getAcceptedMediaType() |
String |
getUserAgent() |
String |
post(Map<String,Object> parameters,
URL url) |
protected String |
post(String data,
URL url) |
String |
put(Map<String,Object> parameters,
URL url) |
protected String |
put(String data,
URL url) |
void |
setAcceptedMediaType(String acceptedMediaType) |
void |
setUserAgent(String userAgent) |
void |
setVersion(String version) |
protected String |
write(String data,
String requestMethod,
URL url) |
public UrlConnectionHttpClient(String username, String password, String userAgent, boolean sslChecks, IMediaType requestMediaType, String acceptedMediaType, String version)
public void setAcceptedMediaType(String acceptedMediaType)
setAcceptedMediaType
in interface IHttpClient
public String getAcceptedMediaType()
getAcceptedMediaType
in interface IHttpClient
public String get(URL url) throws HttpClientException, SocketTimeoutException
get
in interface IHttpClient
HttpClientException
SocketTimeoutException
public void setUserAgent(String userAgent)
setUserAgent
in interface IHttpClient
public String getUserAgent()
getUserAgent
in interface IHttpClient
public void setVersion(String version)
setVersion
in interface IHttpClient
public String put(Map<String,Object> parameters, URL url) throws SocketTimeoutException, UnsupportedEncodingException, HttpClientException
put
in interface IHttpClient
SocketTimeoutException
UnsupportedEncodingException
HttpClientException
protected String put(String data, URL url) throws HttpClientException, SocketTimeoutException
public String post(Map<String,Object> parameters, URL url) throws SocketTimeoutException, UnsupportedEncodingException, HttpClientException
post
in interface IHttpClient
SocketTimeoutException
UnsupportedEncodingException
HttpClientException
protected String post(String data, URL url) throws HttpClientException, SocketTimeoutException
public String delete(Map<String,Object> parameters, URL url) throws HttpClientException, SocketTimeoutException, UnsupportedEncodingException
delete
in interface IHttpClient
HttpClientException
SocketTimeoutException
UnsupportedEncodingException
public String delete(URL url) throws HttpClientException, SocketTimeoutException, UnsupportedEncodingException
delete
in interface IHttpClient
HttpClientException
SocketTimeoutException
UnsupportedEncodingException
protected String delete(String data, URL url) throws HttpClientException, SocketTimeoutException
protected String write(String data, String requestMethod, URL url) throws SocketTimeoutException, HttpClientException
protected String createErrorMessage(IOException ioe, HttpURLConnection connection) throws IOException
IOException
protected HttpURLConnection createConnection(String username, String password, String userAgent, URL url) throws IOException
IOException
protected HttpURLConnection createConnection(String username, String password, String authKey, String authIV, String userAgent, URL url) throws IOException
IOException
Copyright © 2013 JBoss, a division of Red Hat, Inc.. All Rights Reserved.