com.openshift.internal.client.httpclient
Class UrlConnectionHttpClient
java.lang.Object
  
com.openshift.internal.client.httpclient.UrlConnectionHttpClient
- All Implemented Interfaces: 
 - IHttpClient
 
public class UrlConnectionHttpClient
- extends Object
- implements IHttpClient
  
- Author:
 
  - Andre Dietisheim, Nicolas Spano
 
 
| Fields inherited from interface com.openshift.client.IHttpClient | 
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, SYSPROP_OPENSHIFT_READ_TIMEOUT, VERSION | 
 
| 
Constructor Summary | 
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)
 
            | 
 
| 
Method Summary | 
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 | 
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)
 
            | 
 void | 
setUserAgent(String userAgent)
 
            | 
 
| Methods inherited from class java.lang.Object | 
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
 
userAgent
protected String userAgent
sslChecks
protected boolean sslChecks
username
protected String username
password
protected String password
authKey
protected String authKey
authIV
protected String authIV
acceptedMediaType
protected String acceptedMediaType
acceptedVersion
protected String acceptedVersion
UrlConnectionHttpClient
public UrlConnectionHttpClient(String username,
                               String password,
                               String userAgent,
                               boolean sslChecks,
                               String acceptedMediaType,
                               String version)
UrlConnectionHttpClient
public UrlConnectionHttpClient(String username,
                               String password,
                               String userAgent,
                               boolean sslChecks,
                               String acceptedMediaType,
                               String version,
                               String authKey,
                               String authIV)
get
public String get(URL url,
                  int timeout)
           throws HttpClientException,
                  SocketTimeoutException
- Specified by:
 get in interface IHttpClient
 
- Throws:
 HttpClientException
SocketTimeoutException
 
head
public String head(URL url,
                   int timeout)
            throws HttpClientException,
                   SocketTimeoutException
- Specified by:
 head in interface IHttpClient
 
- Throws:
 HttpClientException
SocketTimeoutException
 
put
public String put(URL url,
                  IMediaType mediaType,
                  int timeout,
                  Parameter... parameters)
           throws HttpClientException,
                  SocketTimeoutException,
                  EncodingException
- Specified by:
 put in interface IHttpClient
 
- Throws:
 HttpClientException
SocketTimeoutException
EncodingException
 
post
public String post(URL url,
                   IMediaType mediaType,
                   int timeout,
                   Parameter... parameters)
            throws HttpClientException,
                   SocketTimeoutException,
                   EncodingException
- Specified by:
 post in interface IHttpClient
 
- Throws:
 HttpClientException
SocketTimeoutException
EncodingException
 
patch
public String patch(URL url,
                    IMediaType mediaType,
                    int timeout,
                    Parameter... parameters)
             throws HttpClientException,
                    SocketTimeoutException,
                    EncodingException
- Specified by:
 patch in interface IHttpClient
 
- Throws:
 HttpClientException
SocketTimeoutException
EncodingException
 
delete
public String delete(URL url,
                     IMediaType mediaType,
                     int timeout,
                     Parameter... parameters)
              throws HttpClientException,
                     SocketTimeoutException,
                     EncodingException
- Specified by:
 delete in interface IHttpClient
 
- Throws:
 HttpClientException
SocketTimeoutException
EncodingException
 
delete
public String delete(URL url,
                     int timeout)
              throws HttpClientException,
                     SocketTimeoutException,
                     EncodingException
- Specified by:
 delete in interface IHttpClient
 
- Throws:
 HttpClientException
SocketTimeoutException
EncodingException
 
request
protected String request(HttpMethod httpMethod,
                         URL url,
                         IMediaType requestMediaType,
                         int timeout,
                         Parameter... parameters)
                  throws SocketTimeoutException,
                         HttpClientException
 
- Throws:
 SocketTimeoutException
HttpClientException
 
request
protected String request(HttpMethod httpMethod,
                         URL url,
                         IMediaType requestMediaType,
                         int timeout,
                         ParameterValueMap parameters)
                  throws SocketTimeoutException,
                         HttpClientException
 
- Throws:
 SocketTimeoutException
HttpClientException
 
createErrorMessage
protected String createErrorMessage(IOException ioe,
                                    HttpURLConnection connection)
                             throws IOException
 
- Throws:
 IOException
 
createConnection
protected HttpURLConnection createConnection(URL url,
                                             String username,
                                             String password,
                                             String authKey,
                                             String authIV,
                                             String userAgent,
                                             String acceptedVersion,
                                             String acceptedMediaType,
                                             int timeout)
                                      throws IOException
 
- Throws:
 IOException
 
setUserAgent
public void setUserAgent(String userAgent)
- Specified by:
 setUserAgent in interface IHttpClient
 
 
setAcceptVersion
public void setAcceptVersion(String version)
- Specified by:
 setAcceptVersion in interface IHttpClient
 
 
setAcceptedMediaType
public void setAcceptedMediaType(String acceptedMediaType)
- Specified by:
 setAcceptedMediaType in interface IHttpClient
 
 
Copyright © 2014 JBoss, a division of Red Hat, Inc.. All Rights Reserved.