public class HttpClient extends org.apache.http.impl.client.DefaultHttpClient implements Closeable
| Modifier and Type | Field and Description |
|---|---|
protected org.apache.http.impl.client.DecompressingHttpClient |
client |
protected URI |
server |
protected String |
wsapiVersion |
| Modifier | Constructor and Description |
|---|---|
protected |
HttpClient(URI server) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Release all resources associated with this instance.
|
String |
doDelete(String url)
Perform a delete against the WSAPI
|
String |
doGet(String url)
Perform a get against the WSAPI
|
String |
doPost(String url,
String body)
Perform a post against the WSAPI
|
String |
doPut(String url,
String body)
Perform a put against the WSAPI
|
protected String |
doRequest(org.apache.http.client.methods.HttpRequestBase request)
Execute a request against the WSAPI
|
protected String |
executeRequest(org.apache.http.client.methods.HttpRequestBase request)
Execute a request against the WSAPI
|
String |
getServer()
Get the current server being targeted.
|
String |
getWsapiUrl()
Get the WSAPI base url based on the current server and WSAPI version
|
String |
getWsapiVersion()
Get the current version of the WSAPI being targeted.
|
void |
setApplicationName(String value)
Set the value of the X-RallyIntegrationName header included on all requests.
|
void |
setApplicationVendor(String value)
Set the value of the X-RallyIntegrationVendor header included on all requests.
|
void |
setApplicationVersion(String value)
Set the value of the X-RallyIntegrationVersion header included on all requests.
|
protected org.apache.http.auth.Credentials |
setClientCredentials(URI server,
String userName,
String password) |
void |
setProxy(URI proxy)
Set the unauthenticated proxy server to use.
|
void |
setProxy(URI proxy,
String userName,
String password)
Set the authenticated proxy server to use.
|
void |
setWsapiVersion(String wsapiVersion)
Set the current version of the WSAPI being targeted.
|
createHttpParams, createHttpProcessor, setDefaultHttpParamsaddRequestInterceptor, addRequestInterceptor, addResponseInterceptor, addResponseInterceptor, clearRequestInterceptors, clearResponseInterceptors, createAuthSchemeRegistry, createClientConnectionManager, createClientRequestDirector, createClientRequestDirector, createClientRequestDirector, createConnectionKeepAliveStrategy, createConnectionReuseStrategy, createCookieSpecRegistry, createCookieStore, createCredentialsProvider, createHttpContext, createHttpRequestRetryHandler, createHttpRoutePlanner, createProxyAuthenticationHandler, createProxyAuthenticationStrategy, createRedirectHandler, createRequestExecutor, createTargetAuthenticationHandler, createTargetAuthenticationStrategy, createUserTokenHandler, determineParams, execute, execute, execute, execute, execute, execute, execute, execute, getAuthSchemes, getBackoffManager, getConnectionBackoffStrategy, getConnectionKeepAliveStrategy, getConnectionManager, getConnectionReuseStrategy, getCookieSpecs, getCookieStore, getCredentialsProvider, getHttpProcessor, getHttpRequestRetryHandler, getParams, getProxyAuthenticationHandler, getProxyAuthenticationStrategy, getRedirectHandler, getRedirectStrategy, getRequestExecutor, getRequestInterceptor, getRequestInterceptorCount, getResponseInterceptor, getResponseInterceptorCount, getRoutePlanner, getTargetAuthenticationHandler, getTargetAuthenticationStrategy, getUserTokenHandler, removeRequestInterceptorByClass, removeResponseInterceptorByClass, setAuthSchemes, setBackoffManager, setConnectionBackoffStrategy, setCookieSpecs, setCookieStore, setCredentialsProvider, setHttpRequestRetryHandler, setKeepAliveStrategy, setParams, setProxyAuthenticationHandler, setProxyAuthenticationStrategy, setRedirectHandler, setRedirectStrategy, setReuseStrategy, setRoutePlanner, setTargetAuthenticationHandler, setTargetAuthenticationStrategy, setUserTokenHandlerprotected URI server
protected String wsapiVersion
protected org.apache.http.impl.client.DecompressingHttpClient client
protected HttpClient(URI server)
public void setProxy(URI proxy)
proxy - The proxy server, e.g. new URI("http://my.proxy.com:8000")public void setProxy(URI proxy, String userName, String password)
proxy - The proxy server, e.g. new URI("http://my.proxy.com:8000")userName - The username to be used for authentication.password - The password to be used for authentication.public void setApplicationVendor(String value)
value - The vendor header to be included on all requests.public void setApplicationVersion(String value)
value - The vendor header to be included on all requests.public void setApplicationName(String value)
value - The vendor header to be included on all requests.public String getServer()
public String getWsapiVersion()
public void setWsapiVersion(String wsapiVersion)
wsapiVersion - the new version, e.g. "1.30"protected String doRequest(org.apache.http.client.methods.HttpRequestBase request) throws IOException
request - the request to be executedIOException - if a non-200 response code is returned or if some other
problem occurs while executing the requestprotected String executeRequest(org.apache.http.client.methods.HttpRequestBase request) throws IOException
request - the request to be executedIOException - if a non-200 response code is returned or if some other
problem occurs while executing the requestpublic String doPost(String url, String body) throws IOException
url - the request urlbody - the body of the postIOException - if a non-200 response code is returned or if some other
problem occurs while executing the requestpublic String doPut(String url, String body) throws IOException
url - the request urlbody - the body of the putIOException - if a non-200 response code is returned or if some other
problem occurs while executing the requestpublic String doDelete(String url) throws IOException
url - the request urlIOException - if a non-200 response code is returned or if some other
problem occurs while executing the requestpublic String doGet(String url) throws IOException
url - the request urlIOException - if a non-200 response code is returned or if some other
problem occurs while executing the requestpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOException - if an error occurs releasing resourcesprotected org.apache.http.auth.Credentials setClientCredentials(URI server, String userName, String password)
public String getWsapiUrl()
Copyright © 2016. All Rights Reserved.