public abstract class ClientCall extends Call
Constructor and Description |
---|
ClientCall(HttpClientHelper helper,
java.lang.String method,
java.lang.String requestUri)
Constructor setting the request address to the local host.
|
Modifier and Type | Method and Description |
---|---|
protected long |
getContentLength()
Returns the content length of the request entity if know,
Representation.UNKNOWN_SIZE otherwise. |
HttpClientHelper |
getHelper()
Returns the HTTP client helper.
|
static java.lang.String |
getLocalAddress()
Returns the local IP address or 127.0.0.1 if the resolution fails.
|
abstract java.nio.channels.WritableByteChannel |
getRequestEntityChannel()
Returns the request entity channel if it exists.
|
abstract java.io.OutputStream |
getRequestEntityStream()
Returns the request entity stream if it exists.
|
abstract java.io.OutputStream |
getRequestHeadStream()
Returns the request head stream if it exists.
|
Representation |
getResponseEntity(Response response)
Returns the response entity if available.
|
abstract java.nio.channels.ReadableByteChannel |
getResponseEntityChannel(long size)
Returns the response channel if it exists.
|
abstract java.io.InputStream |
getResponseEntityStream(long size)
Returns the response entity stream if it exists.
|
protected boolean |
isClientKeepAlive()
Indicates if the client wants a persistent connection.
|
protected boolean |
isServerKeepAlive()
Indicates if the server wants a persistent connection.
|
Status |
sendRequest(Request request)
Sends the request to the client.
|
void |
sendRequest(Request request,
Response response,
Uniform callback)
Sends the request to the client.
|
protected boolean |
shouldRequestBeChunked(Request request)
Indicates if the request entity should be chunked.
|
getClientAddress, getClientPort, getHostDomain, getHostPort, getLogger, getMethod, getProtocol, getReasonPhrase, getRepresentation, getRepresentation, getRequestHeaders, getRequestUri, getResponseHeaders, getServerAddress, getServerPort, getStatusCode, getUserPrincipal, getVersion, isBroken, isConfidential, isKeepAlive, isRequestChunked, isResponseChunked, setClientAddress, setClientPort, setConfidential, setHostDomain, setHostPort, setMethod, setProtocol, setReasonPhrase, setRequestUri, setServerAddress, setServerPort, setStatusCode, setUserPrincipal, setVersion
public ClientCall(HttpClientHelper helper, java.lang.String method, java.lang.String requestUri)
helper
- The parent HTTP client helper.method
- The method name.requestUri
- The request URI.public static java.lang.String getLocalAddress()
protected long getContentLength()
Representation.UNKNOWN_SIZE
otherwise.public HttpClientHelper getHelper()
public abstract java.nio.channels.WritableByteChannel getRequestEntityChannel()
public abstract java.io.OutputStream getRequestEntityStream()
public abstract java.io.OutputStream getRequestHeadStream()
public Representation getResponseEntity(Response response)
response
- the Response to get the entity frompublic abstract java.nio.channels.ReadableByteChannel getResponseEntityChannel(long size)
size
- The expected entity size or -1 if unknown.public abstract java.io.InputStream getResponseEntityStream(long size)
size
- The expected entity size or -1 if unknown.protected boolean isClientKeepAlive()
Call
isClientKeepAlive
in class Call
protected boolean isServerKeepAlive()
Call
isServerKeepAlive
in class Call
public Status sendRequest(Request request)
request
- The high-level request.public void sendRequest(Request request, Response response, Uniform callback) throws java.lang.Exception
request
- The high-level request.response
- The high-level response.callback
- The callback invoked upon request completion.java.lang.Exception
protected boolean shouldRequestBeChunked(Request request)
Copyright © 2005-2020 Restlet.