|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.atlassian.sal.core.net.HttpClientRequest
public class HttpClientRequest
HttpClient implementation of Request interface
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface com.atlassian.sal.api.net.Request |
|---|
Request.MethodType |
| Field Summary | |
|---|---|
static int |
MAX_REDIRECTS
|
| Constructor Summary | |
|---|---|
HttpClientRequest(org.apache.commons.httpclient.HttpClient httpClient,
Request.MethodType methodType,
String url,
CertificateFactory certificateFactory,
UserManager userManager)
|
|
| Method Summary | ||
|---|---|---|
HttpClientRequest |
addAuthentication(Authenticator authenticator)
Adds generic Authenticator to the request. |
|
HttpClientRequest |
addBasicAuthentication(String username,
String password)
Adds basic authentication to the request. |
|
HttpClientRequest |
addHeader(String headerName,
String headerValue)
Adds the specified header to the request, not overwriting any previous value. |
|
HttpClientRequest |
addHeaders(String... params)
|
|
HttpClientRequest |
addRequestParameters(String... params)
Sets parameters of the request. |
|
HttpClientRequest |
addSeraphAuthentication(String username,
String password)
Adds seraph authentication to the request. |
|
HttpClientRequest |
addTrustedTokenAuthentication()
Adds TrustedTokenAuthentication to the request. |
|
HttpClientRequest |
addTrustedTokenAuthentication(String username)
Adds TrustedTokenAuthentication to the request. |
|
String |
execute()
Executes a request and if response is successful, returns response as a string. |
|
void |
execute(ResponseHandler<HttpClientResponse> responseHandler)
Executes the request. |
|
|
executeAndReturn(ReturningResponseHandler<HttpClientResponse,E> httpClientResponseResponseHandler)
Executes the request and returns a result value. |
|
Map<String,List<String>> |
getHeaders()
|
|
Request.MethodType |
getMethodType()
|
|
protected org.apache.commons.httpclient.HttpMethod |
makeMethod()
|
|
HttpClientRequest |
setConnectionTimeout(int connectionTimeout)
Setting connection timeout in milliseconds. |
|
HttpClientRequest |
setEntity(Object entity)
Set an entity as the request body |
|
HttpClientRequest |
setHeader(String headerName,
String headerValue)
Sets the specified header to the request, overwriting any previous value. |
|
HttpClientRequest |
setRequestBody(String requestBody)
Sets the body of the request. |
|
HttpClientRequest |
setRequestContentType(String requestContentType)
Sets Content-Type of the body of the request. |
|
HttpClientRequest |
setSoTimeout(int soTimeout)
Setting socket timeout in milliseconds. |
|
HttpClientRequest |
setUrl(String url)
|
|
static void |
shutdownStream(InputStream input)
Unconditionally close an InputStream. |
|
String |
toString()
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int MAX_REDIRECTS
| Constructor Detail |
|---|
public HttpClientRequest(org.apache.commons.httpclient.HttpClient httpClient,
Request.MethodType methodType,
String url,
CertificateFactory certificateFactory,
UserManager userManager)
| Method Detail |
|---|
public HttpClientRequest setUrl(String url)
setUrl in interface Request<HttpClientRequest,HttpClientResponse>url - the url to request
public HttpClientRequest addAuthentication(Authenticator authenticator)
Request
addAuthentication in interface Request<HttpClientRequest,HttpClientResponse>authenticator - the authenticator to use for authentication
public HttpClientRequest addTrustedTokenAuthentication()
Request
addTrustedTokenAuthentication in interface Request<HttpClientRequest,HttpClientResponse>public HttpClientRequest addTrustedTokenAuthentication(String username)
Request
addTrustedTokenAuthentication in interface Request<HttpClientRequest,HttpClientResponse>username - The user to make the request with
public HttpClientRequest addBasicAuthentication(String username,
String password)
Request
addBasicAuthentication in interface Request<HttpClientRequest,HttpClientResponse>username - The user namepassword - The password
public HttpClientRequest addSeraphAuthentication(String username,
String password)
Request
addSeraphAuthentication in interface Request<HttpClientRequest,HttpClientResponse>username - The user namepassword - The password
public HttpClientRequest setConnectionTimeout(int connectionTimeout)
Request
setConnectionTimeout in interface Request<HttpClientRequest,HttpClientResponse>connectionTimeout - The timeout in milliseconds
public HttpClientRequest setSoTimeout(int soTimeout)
Request
setSoTimeout in interface Request<HttpClientRequest,HttpClientResponse>soTimeout - the timeout in milliseconds
public HttpClientRequest setRequestBody(String requestBody)
RequestRequest.MethodType.POST and Request.MethodType.POST can have request body.
setRequestBody in interface Request<HttpClientRequest,HttpClientResponse>requestBody - the body of the request
public HttpClientRequest setEntity(Object entity)
Request
setEntity in interface Request<HttpClientRequest,HttpClientResponse>entity - the request entity to be marshalled, not null
public HttpClientRequest setRequestContentType(String requestContentType)
RequestRequest.MethodType.POST and Request.MethodType.POST can have request body.
setRequestContentType in interface Request<HttpClientRequest,HttpClientResponse>requestContentType - the contentType of the request
public HttpClientRequest addRequestParameters(String... params)
RequestRequest.MethodType.POST and Request.MethodType.POST can have parameters.
For other requests include parameters in url. This method accepts an even number of arguments, in form of name, value, name, value, name, value, etc
addRequestParameters in interface Request<HttpClientRequest,HttpClientResponse>params - parameters of the request in as name, value pairs
public HttpClientRequest addHeader(String headerName,
String headerValue)
Request
addHeader in interface Request<HttpClientRequest,HttpClientResponse>headerName - the header's nameheaderValue - the header's value
RequestFactory.supportsHeader()
public HttpClientRequest setHeader(String headerName,
String headerValue)
Request
setHeader in interface Request<HttpClientRequest,HttpClientResponse>headerName - the header's nameheaderValue - the header's value
RequestFactory.supportsHeader()public HttpClientRequest addHeaders(String... params)
public <E> E executeAndReturn(ReturningResponseHandler<HttpClientResponse,E> httpClientResponseResponseHandler)
throws ResponseException
Request
executeAndReturn in interface Request<HttpClientRequest,HttpClientResponse>httpClientResponseResponseHandler - Callback handler of the response.
ResponseException - If the response cannot be retrieved
public void execute(ResponseHandler<HttpClientResponse> responseHandler)
throws ResponseException
Request
execute in interface Request<HttpClientRequest,HttpClientResponse>responseHandler - Callback handler of the response.
ResponseException - If the response cannot be retrievedpublic static void shutdownStream(InputStream input)
InputStream.
Equivalent to InputStream.close(), except any exceptions will be ignored.
input - A (possibly null) InputStream
public String execute()
throws ResponseException
RequestResponse.getResponseBodyAsString()
execute in interface Request<HttpClientRequest,HttpClientResponse>ResponseException - If the response cannot be retrievedprotected org.apache.commons.httpclient.HttpMethod makeMethod()
public Map<String,List<String>> getHeaders()
getHeaders in interface Request<HttpClientRequest,HttpClientResponse>public Request.MethodType getMethodType()
public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||