Package org.dmfs.httpessentials.client
Interface HttpRequest<T>
- Type Parameters:
T- The type of the expected response.
public interface HttpRequest<T>
Defines an interface of an HTTP request. The request is typed to the class of the expected response.
-
Method Summary
Modifier and TypeMethodDescriptionheaders()method()Returns the HTTP method of this request.Returns anHttpRequestEntitythat contains the body of this request.responseHandler(HttpResponse response) Returns a handler for the response.
-
Method Details
-
method
HttpMethod method()Returns the HTTP method of this request.- Returns:
- The
HttpMethodthis request uses.
-
headers
Headers headers()- Returns:
- A
Headers, nevernull.
-
requestEntity
HttpRequestEntity requestEntity()Returns anHttpRequestEntitythat contains the body of this request.- Returns:
- An
HttpRequestEntityobject, nevernull.
-
responseHandler
HttpResponseHandler<T> responseHandler(HttpResponse response) throws IOException, ProtocolError, ProtocolException Returns a handler for the response. If the response can not be handled an exception is thrown.- Parameters:
response- TheHttpResponsethat needs to be handled.- Returns:
- An
HttpResponseHandler. - Throws:
IOExceptionProtocolError- If the response is an error response as specified by the application protocol.ProtocolException- If the response is invalid or malformed and can not be handled properly.
-