Class HttpMethodCall
- java.lang.Object
-
- org.restlet.engine.adapter.Call
-
- org.restlet.engine.adapter.ClientCall
-
- org.restlet.ext.httpclient.internal.HttpMethodCall
-
public class HttpMethodCall extends ClientCall
HTTP client connector call based on Apache HTTP Client's HttpMethod class.
-
-
Field Summary
Fields Modifier and Type Field Description private HttpClientHelperclientHelperThe associated HTTP client.private org.apache.http.client.methods.HttpUriRequesthttpRequestThe wrapped HTTP request.private org.apache.http.HttpResponsehttpResponseThe wrapped HTTP response.private booleanresponseHeadersAddedIndicates if the response headers were added.
-
Constructor Summary
Constructors Constructor Description HttpMethodCall(HttpClientHelper helper, java.lang.String method, java.lang.String requestUri, boolean hasEntity)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.http.client.methods.HttpUriRequestgetHttpRequest()Returns the HTTP request.org.apache.http.HttpResponsegetHttpResponse()Returns the HTTP response.java.lang.StringgetReasonPhrase()Returns the response reason phrase.java.nio.channels.WritableByteChannelgetRequestEntityChannel()Returns the request entity channel if it exists.java.io.OutputStreamgetRequestEntityStream()Returns the request entity stream if it exists.java.io.OutputStreamgetRequestHeadStream()Returns the request head stream if it exists.java.nio.channels.ReadableByteChannelgetResponseEntityChannel(long size)Returns the response channel if it exists.java.io.InputStreamgetResponseEntityStream(long size)Returns the response entity stream if it exists.Series<Header>getResponseHeaders()Returns the modifiable list of response headers.java.lang.StringgetServerAddress()Returns the response address.
Corresponds to the IP address of the responding server.intgetStatusCode()Returns the response status code.StatussendRequest(Request request)Sends the request to the client.voidsendRequest(Request request, Response response, Uniform callback)Sends the request to the client.-
Methods inherited from class org.restlet.engine.adapter.ClientCall
getContentLength, getHelper, getLocalAddress, getResponseEntity, isClientKeepAlive, isServerKeepAlive, shouldRequestBeChunked
-
Methods inherited from class org.restlet.engine.adapter.Call
getClientAddress, getClientPort, getHostDomain, getHostPort, getLogger, getMethod, getProtocol, getRepresentation, getRepresentation, getRequestHeaders, getRequestUri, getServerPort, getUserPrincipal, getVersion, isBroken, isConfidential, isConnectionBroken, isKeepAlive, isRequestChunked, isResponseChunked, setClientAddress, setClientPort, setConfidential, setHostDomain, setHostPort, setMethod, setProtocol, setReasonPhrase, setRequestUri, setServerAddress, setServerPort, setStatusCode, setUserPrincipal, setVersion
-
-
-
-
Field Detail
-
clientHelper
private volatile HttpClientHelper clientHelper
The associated HTTP client.
-
httpRequest
private volatile org.apache.http.client.methods.HttpUriRequest httpRequest
The wrapped HTTP request.
-
httpResponse
private volatile org.apache.http.HttpResponse httpResponse
The wrapped HTTP response.
-
responseHeadersAdded
private volatile boolean responseHeadersAdded
Indicates if the response headers were added.
-
-
Constructor Detail
-
HttpMethodCall
public HttpMethodCall(HttpClientHelper helper, java.lang.String method, java.lang.String requestUri, boolean hasEntity) throws java.io.IOException
Constructor.- Parameters:
helper- The parent HTTP client helper.method- The method name.requestUri- The request URI.hasEntity- Indicates if the call will have an entity to send to the server.- Throws:
java.io.IOException
-
-
Method Detail
-
getHttpRequest
public org.apache.http.client.methods.HttpUriRequest getHttpRequest()
Returns the HTTP request.- Returns:
- The HTTP request.
-
getHttpResponse
public org.apache.http.HttpResponse getHttpResponse()
Returns the HTTP response.- Returns:
- The HTTP response.
-
getReasonPhrase
public java.lang.String getReasonPhrase()
Returns the response reason phrase.- Overrides:
getReasonPhrasein classCall- Returns:
- The response reason phrase.
-
getRequestEntityChannel
public java.nio.channels.WritableByteChannel getRequestEntityChannel()
Description copied from class:ClientCallReturns the request entity channel if it exists.- Specified by:
getRequestEntityChannelin classClientCall- Returns:
- The request entity channel if it exists.
-
getRequestEntityStream
public java.io.OutputStream getRequestEntityStream()
Description copied from class:ClientCallReturns the request entity stream if it exists.- Specified by:
getRequestEntityStreamin classClientCall- Returns:
- The request entity stream if it exists.
-
getRequestHeadStream
public java.io.OutputStream getRequestHeadStream()
Description copied from class:ClientCallReturns the request head stream if it exists.- Specified by:
getRequestHeadStreamin classClientCall- Returns:
- The request head stream if it exists.
-
getResponseEntityChannel
public java.nio.channels.ReadableByteChannel getResponseEntityChannel(long size)
Description copied from class:ClientCallReturns the response channel if it exists.- Specified by:
getResponseEntityChannelin classClientCall- Parameters:
size- The expected entity size or -1 if unknown.- Returns:
- The response channel if it exists.
-
getResponseEntityStream
public java.io.InputStream getResponseEntityStream(long size)
Description copied from class:ClientCallReturns the response entity stream if it exists.- Specified by:
getResponseEntityStreamin classClientCall- Parameters:
size- The expected entity size or -1 if unknown.- Returns:
- The response entity stream if it exists.
-
getResponseHeaders
public Series<Header> getResponseHeaders()
Returns the modifiable list of response headers.- Overrides:
getResponseHeadersin classCall- Returns:
- The modifiable list of response headers.
-
getServerAddress
public java.lang.String getServerAddress()
Returns the response address.
Corresponds to the IP address of the responding server.- Overrides:
getServerAddressin classCall- Returns:
- The response address.
-
getStatusCode
public int getStatusCode()
Returns the response status code.- Overrides:
getStatusCodein classCall- Returns:
- The response status code.
-
sendRequest
public Status sendRequest(Request request)
Sends the request to the client. Commits the request line, headers and optional entity and send them over the network.- Overrides:
sendRequestin classClientCall- Parameters:
request- The high-level request.- Returns:
- The result status.
-
sendRequest
public void sendRequest(Request request, Response response, Uniform callback) throws java.lang.Exception
Description copied from class:ClientCallSends the request to the client. Commits the request line, headers and optional entity and send them over the network.- Overrides:
sendRequestin classClientCall- Parameters:
request- The high-level request.response- The high-level response.callback- The callback invoked upon request completion.- Throws:
java.lang.Exception
-
-