|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.github.ignition.support.http.IgnitedHttpRequestBase
public abstract class IgnitedHttpRequestBase
Field Summary | |
---|---|
protected Set<Integer> |
expectedStatusCodes
|
protected static String |
HTTP_CONTENT_TYPE_HEADER
|
protected org.apache.http.impl.client.AbstractHttpClient |
httpClient
|
protected IgnitedHttp |
ignitedHttp
|
protected int |
maxRetries
|
protected org.apache.http.client.methods.HttpUriRequest |
request
|
Method Summary | |
---|---|
IgnitedHttpRequestBase |
expecting(Integer... statusCodes)
Define the set of HTTP status codes which you anticipate to be returned by the server, including error codes you'd like to explicitly handle. |
String |
getRequestUrl()
|
IgnitedHttpResponse |
handleResponse(org.apache.http.HttpResponse response)
|
IgnitedHttpRequestBase |
retries(int retries)
Set maximum number of retries for this particular request. |
IgnitedHttpResponse |
send()
Sends the current request. |
org.apache.http.client.methods.HttpUriRequest |
unwrap()
|
IgnitedHttpRequest |
withTimeout(int timeout)
Set the global timeout for this specific request (connection and socket timeout). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final String HTTP_CONTENT_TYPE_HEADER
protected Set<Integer> expectedStatusCodes
protected IgnitedHttp ignitedHttp
protected org.apache.http.impl.client.AbstractHttpClient httpClient
protected org.apache.http.client.methods.HttpUriRequest request
protected int maxRetries
Method Detail |
---|
public org.apache.http.client.methods.HttpUriRequest unwrap()
unwrap
in interface IgnitedHttpRequest
public String getRequestUrl()
getRequestUrl
in interface IgnitedHttpRequest
public IgnitedHttpRequestBase expecting(Integer... statusCodes)
IgnitedHttpRequest
HttpResponseException
. This is very useful when dealing with REST-ful Web services,
where it is common to serve error stati that indicate a failure in the application logic
(e.g. 404 if a resource doesn't exist). You typically don't want to treat those as connection
errors, but gracefully handle them like a normal success code.
expecting
in interface IgnitedHttpRequest
statusCodes
- the set of status codes that you want to manually handle as part of the response
public IgnitedHttpRequestBase retries(int retries)
IgnitedHttpRequest
retries
in interface IgnitedHttpRequest
retries
- the maximum number of retries should the request fail
public IgnitedHttpRequest withTimeout(int timeout)
IgnitedHttpRequest
withTimeout
in interface IgnitedHttpRequest
timeout
- the timeout in milliseconds
public IgnitedHttpResponse send() throws ConnectException
IgnitedHttpRequest
send
in interface IgnitedHttpRequest
ConnectException
public IgnitedHttpResponse handleResponse(org.apache.http.HttpResponse response) throws IOException
handleResponse
in interface org.apache.http.client.ResponseHandler<IgnitedHttpResponse>
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |