public class HttpClient extends DefaultHttpClient implements Closeable
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
|
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.
|
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.
|
setDefaultHttpParams
addRequestInterceptor, addRequestInterceptor, addResponseInterceptor, addResponseInterceptor, clearRequestInterceptors, clearResponseInterceptors, execute, execute, execute, execute, execute, execute, execute, execute, getAuthSchemes, getBackoffManager, getConnectionBackoffStrategy, getConnectionKeepAliveStrategy, getConnectionManager, getConnectionReuseStrategy, getCookieSpecs, getCookieStore, getCredentialsProvider, 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, setUserTokenHandler
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"
public 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 Closeable
close
in interface AutoCloseable
IOException
- if an error occurs releasing resourcespublic String getWsapiUrl()