Package org.restlet.engine.connector
Class HttpUrlConnectionCall
java.lang.Object
org.restlet.engine.adapter.Call
org.restlet.engine.adapter.ClientCall
org.restlet.engine.connector.HttpUrlConnectionCall
HTTP client connector call based on JDK's java.net.HttpURLConnection class.
- Author:
- Jerome Louvel
-
Constructor Summary
ConstructorsConstructorDescriptionHttpUrlConnectionCall(HttpClientHelper helper, String method, String requestUri, boolean hasEntity) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionReturns the connection.Returns the HTTP client helper.Returns the response reason phrase.protected RepresentationgetRepresentation(InputStream stream) Returns the representation wrapping the given stream.Returns the request entity stream if it exists.Returns the request head stream if it exists.Returns the request entity stream if it exists.getResponseEntityStream(long size) Returns the response entity stream if it exists.Returns the modifiable list of response headers.Returns the response address.
Corresponds to the IP address of the responding server.intReturns the response status code.sendRequest(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, getLocalAddress, getResponseEntity, isClientKeepAlive, isServerKeepAlive, shouldRequestBeChunkedMethods inherited from class org.restlet.engine.adapter.Call
getClientAddress, getClientPort, getHostDomain, getHostPort, getLogger, getMethod, getProtocol, 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
-
Constructor Details
-
HttpUrlConnectionCall
public HttpUrlConnectionCall(HttpClientHelper helper, String method, String requestUri, boolean hasEntity) throws 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:
IOException
-
-
Method Details
-
getConnection
Returns the connection.- Returns:
- The connection.
-
getHelper
Returns the HTTP client helper.- Overrides:
getHelperin classClientCall- Returns:
- The HTTP client helper.
-
getReasonPhrase
Returns the response reason phrase.- Overrides:
getReasonPhrasein classCall- Returns:
- The response reason phrase.
-
getRepresentation
Description copied from class:CallReturns the representation wrapping the given stream.- Overrides:
getRepresentationin classCall- Parameters:
stream- The response input stream.- Returns:
- The wrapping representation.
-
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
Description copied from class:ClientCallReturns the request head stream if it exists.- Specified by:
getRequestHeadStreamin classClientCall- Returns:
- The request head stream if it exists.
-
getRequestStream
Returns the request entity stream if it exists.- Returns:
- The request entity stream if it exists.
-
getResponseEntityStream
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
Returns the modifiable list of response headers.- Overrides:
getResponseHeadersin classCall- Returns:
- The modifiable list of response headers.
-
getServerAddress
Returns the response address.
Corresponds to the IP address of the responding server.- Overrides:
getServerAddressin classCall- Returns:
- The response address.
-
getStatusCode
Returns the response status code.- Overrides:
getStatusCodein classCall- Returns:
- The response status code.
- Throws:
IOExceptionIOException
-
sendRequest
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
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:
Exception
-