Package org.restlet.engine.adapter
Class Call
java.lang.Object
org.restlet.engine.adapter.Call
- Direct Known Subclasses:
ClientCall,ServerCall
Low-level call for the HTTP connectors.
- Author:
- Jerome Louvel
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the client address.
Corresponds to the IP address of the requesting client.intReturns the client port.
Corresponds to the TCP/IP port of the requesting client.Returns the host domain.intReturns the host port.Returns the logger.Returns the request method.Returns the exact protocol (HTTP or HTTPS).Returns the reason phrase.protected RepresentationgetRepresentation(InputStream stream) Returns the representation wrapping the given stream.Returns the modifiable list of request headers.Returns the URI on the request line (most like a relative reference, but not necessarily).Returns the modifiable list of server headers.Returns the response address.
Corresponds to the IP address of the responding server.intReturns the server port.intReturns the status code.Returns the user principal.Returns the protocol version used.static booleanReturns true if the given exception is caused by a broken connection.protected abstract booleanIndicates if the client wants a persistent connection.booleanIndicates if the confidentiality of the call is ensured (ex: via SSL).booleanisConnectionBroken(Throwable exception) Returns true if the given exception is caused by a broken connection.protected booleanIndicates if both the client and the server want a persistent connection.protected booleanIndicates if the request entity is chunked.protected booleanIndicates if the response entity is chunked.protected abstract booleanIndicates if the server wants a persistent connection.protected voidsetClientAddress(String clientAddress) Sets the client address.protected voidsetClientPort(int clientPort) Sets the client port.protected voidsetConfidential(boolean confidential) Indicates if the confidentiality of the call is ensured (ex: via SSL).voidsetHostDomain(String hostDomain) Sets the host domain name.voidsetHostPort(int hostPort) Sets the host port.protected voidSets the request method.voidsetProtocol(Protocol protocol) Sets the exact protocol used (HTTP or HTTPS).voidsetReasonPhrase(String reasonPhrase) Sets the reason phrase.protected voidsetRequestUri(String requestUri) Sets the full request URI.voidsetServerAddress(String responseAddress) Sets the response address.
Corresponds to the IP address of the responding server.voidsetServerPort(int serverPort) Sets the server port.voidsetStatusCode(int code) Sets the status code.voidsetUserPrincipal(Principal principal) Sets the user principal.voidsetVersion(String version) Sets the protocol version used.
-
Constructor Details
-
Call
public Call()Constructor.
-
-
Method Details
-
isBroken
Returns true if the given exception is caused by a broken connection.- Parameters:
exception- The exception to inspect.- Returns:
- True if the given exception is caused by a broken connection.
-
getClientAddress
Returns the client address.
Corresponds to the IP address of the requesting client.- Returns:
- The client address.
-
getClientPort
public int getClientPort()Returns the client port.
Corresponds to the TCP/IP port of the requesting client.- Returns:
- The client port.
-
getHostDomain
Returns the host domain.- Returns:
- The host domain.
-
getHostPort
public int getHostPort()Returns the host port.- Returns:
- The host port.
-
getLogger
Returns the logger.- Returns:
- The logger.
-
getMethod
Returns the request method.- Returns:
- The request method.
-
getProtocol
Returns the exact protocol (HTTP or HTTPS).- Returns:
- The exact protocol (HTTP or HTTPS).
-
getReasonPhrase
Returns the reason phrase.- Returns:
- The reason phrase.
-
getRepresentation
Returns the representation wrapping the given stream.- Parameters:
stream- The response input stream.- Returns:
- The wrapping representation.
-
getRequestHeaders
Returns the modifiable list of request headers.- Returns:
- The modifiable list of request headers.
-
getRequestUri
Returns the URI on the request line (most like a relative reference, but not necessarily).- Returns:
- The URI on the request line.
-
getResponseHeaders
Returns the modifiable list of server headers.- Returns:
- The modifiable list of server headers.
-
getServerAddress
Returns the response address.
Corresponds to the IP address of the responding server.- Returns:
- The response address.
-
getServerPort
public int getServerPort()Returns the server port.- Returns:
- The server port.
-
getStatusCode
Returns the status code.- Returns:
- The status code.
- Throws:
IOException
-
getUserPrincipal
Returns the user principal.- Returns:
- The user principal.
-
getVersion
Returns the protocol version used.- Returns:
- The protocol version used.
-
isClientKeepAlive
protected abstract boolean isClientKeepAlive()Indicates if the client wants a persistent connection.- Returns:
- True if the client wants a persistent connection.
-
isConfidential
public boolean isConfidential()Indicates if the confidentiality of the call is ensured (ex: via SSL).- Returns:
- True if the confidentiality of the call is ensured (ex: via SSL).
-
isConnectionBroken
Returns true if the given exception is caused by a broken connection.- Parameters:
exception- The exception to inspect.- Returns:
- True if the given exception is caused by a broken connection.
-
isKeepAlive
protected boolean isKeepAlive()Indicates if both the client and the server want a persistent connection.- Returns:
- True if the connection should be kept alive after the call processing.
-
isRequestChunked
protected boolean isRequestChunked()Indicates if the request entity is chunked.- Returns:
- True if the request entity is chunked.
-
isResponseChunked
protected boolean isResponseChunked()Indicates if the response entity is chunked.- Returns:
- True if the response entity is chunked.
-
isServerKeepAlive
protected abstract boolean isServerKeepAlive()Indicates if the server wants a persistent connection.- Returns:
- True if the server wants a persistent connection.
-
setClientAddress
Sets the client address.- Parameters:
clientAddress- The client address.
-
setClientPort
protected void setClientPort(int clientPort) Sets the client port.- Parameters:
clientPort- The client port.
-
setConfidential
protected void setConfidential(boolean confidential) Indicates if the confidentiality of the call is ensured (ex: via SSL).- Parameters:
confidential- True if the confidentiality of the call is ensured (ex: via SSL).
-
setHostDomain
Sets the host domain name.- Parameters:
hostDomain- The baseRef domain name.
-
setHostPort
public void setHostPort(int hostPort) Sets the host port.- Parameters:
hostPort- The host port.
-
setMethod
Sets the request method.- Parameters:
method- The request method.
-
setProtocol
Sets the exact protocol used (HTTP or HTTPS).- Parameters:
protocol- The protocol.
-
setReasonPhrase
Sets the reason phrase.- Parameters:
reasonPhrase- The reason phrase.
-
setRequestUri
Sets the full request URI.- Parameters:
requestUri- The full request URI.
-
setServerAddress
Sets the response address.
Corresponds to the IP address of the responding server.- Parameters:
responseAddress- The response address.
-
setServerPort
public void setServerPort(int serverPort) Sets the server port.- Parameters:
serverPort- The server port.
-
setStatusCode
public void setStatusCode(int code) Sets the status code.- Parameters:
code- The status code.
-
setUserPrincipal
Sets the user principal.- Parameters:
principal- The user principal.
-
setVersion
Sets the protocol version used.- Parameters:
version- The protocol version used.
-