Package org.restlet.engine.adapter
Class ClientCall
java.lang.Object
org.restlet.engine.adapter.Call
org.restlet.engine.adapter.ClientCall
- Direct Known Subclasses:
HttpUrlConnectionCall
Low-level HTTP client call.
- Author:
- Jerome Louvel
-
Constructor Summary
ConstructorsConstructorDescriptionClientCall(HttpClientHelper helper, String method, String requestUri) Constructor setting the request address to the local host. -
Method Summary
Modifier and TypeMethodDescriptionprotected longReturns the content length of the request entity if know,Representation.UNKNOWN_SIZEotherwise.Returns the HTTP client helper.static StringReturns the local IP address or 127.0.0.1 if the resolution fails.abstract OutputStreamReturns the request entity stream if it exists.abstract OutputStreamReturns the request head stream if it exists.getResponseEntity(Response response) Returns the response entity if available.abstract InputStreamgetResponseEntityStream(long size) Returns the response entity stream if it exists.protected booleanIndicates if the client wants a persistent connection.protected booleanIndicates if the server wants a persistent connection.sendRequest(Request request) Sends the request to the client.voidsendRequest(Request request, Response response, Uniform callback) Sends the request to the client.protected booleanshouldRequestBeChunked(Request request) Indicates if the request entity should be chunked.Methods inherited from class org.restlet.engine.adapter.Call
getClientAddress, getClientPort, getHostDomain, getHostPort, getLogger, getMethod, getProtocol, getReasonPhrase, getRepresentation, getRequestHeaders, getRequestUri, getResponseHeaders, getServerAddress, getServerPort, getStatusCode, getUserPrincipal, getVersion, isBroken, isConfidential, isConnectionBroken, isKeepAlive, isRequestChunked, isResponseChunked, setClientAddress, setClientPort, setConfidential, setHostDomain, setHostPort, setMethod, setProtocol, setReasonPhrase, setRequestUri, setServerAddress, setServerPort, setStatusCode, setUserPrincipal, setVersion
-
Constructor Details
-
ClientCall
Constructor setting the request address to the local host.- Parameters:
helper- The parent HTTP client helper.method- The method name.requestUri- The request URI.
-
-
Method Details
-
getLocalAddress
Returns the local IP address or 127.0.0.1 if the resolution fails.- Returns:
- The local IP address or 127.0.0.1 if the resolution fails.
-
getContentLength
protected long getContentLength()Returns the content length of the request entity if know,Representation.UNKNOWN_SIZEotherwise.- Returns:
- The request content length.
-
getHelper
Returns the HTTP client helper.- Returns:
- The HTTP client helper.
-
getRequestEntityStream
Returns the request entity stream if it exists.- Returns:
- The request entity stream if it exists.
-
getRequestHeadStream
Returns the request head stream if it exists.- Returns:
- The request head stream if it exists.
-
getResponseEntity
Returns the response entity if available. Note that no metadata is associated by default, you have to manually set them from your headers.- Parameters:
response- the Response to get the entity from- Returns:
- The response entity if available.
-
getResponseEntityStream
Returns the response entity stream if it exists.- Parameters:
size- The expected entity size or -1 if unknown.- Returns:
- The response entity stream if it exists.
-
isClientKeepAlive
protected boolean isClientKeepAlive()Description copied from class:CallIndicates if the client wants a persistent connection.- Specified by:
isClientKeepAlivein classCall- Returns:
- True if the client wants a persistent connection.
-
isServerKeepAlive
protected boolean isServerKeepAlive()Description copied from class:CallIndicates if the server wants a persistent connection.- Specified by:
isServerKeepAlivein classCall- Returns:
- True if the server wants a persistent connection.
-
sendRequest
Sends the request to the client. Commits the request line, headers and optional entity and send them over the network.- Parameters:
request- The high-level request.- Returns:
- the status of the communication
-
sendRequest
Sends the request to the client. Commits the request line, headers and optional entity and send them over the network.- Parameters:
request- The high-level request.response- The high-level response.callback- The callback invoked upon request completion.- Throws:
Exception
-
shouldRequestBeChunked
Indicates if the request entity should be chunked.- Returns:
- True if the request should be chunked
-