Package org.restlet.engine.adapter
Class Call
- java.lang.Object
-
- org.restlet.engine.adapter.Call
-
- Direct Known Subclasses:
ClientCall,ServerCall
public abstract class Call extends java.lang.ObjectLow-level call for the HTTP connectors.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringclientAddressThe client IP address.private intclientPortThe client port.private booleanconfidentialIndicates if the call is confidential.private java.lang.StringhostDomainThe hostRef domain.private inthostPortThe hostRef port.private java.lang.StringmethodThe method.private ProtocolprotocolThe exact protocol.private java.lang.StringreasonPhraseThe reason phrase.private Series<Header>requestHeadersThe request headers.private java.lang.StringrequestUriThe request URI.private Series<Header>responseHeadersThe response headers.private java.lang.StringserverAddressThe server IP address.private intserverPortThe server port.private intstatusCodeThe status code.private java.security.PrincipaluserPrincipalThe user principal.private java.lang.StringversionThe protocol version.
-
Constructor Summary
Constructors Constructor Description Call()Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetClientAddress()Returns the client address.
Corresponds to the IP address of the requesting client.intgetClientPort()Returns the client port.
Corresponds to the TCP/IP port of the requesting client.java.lang.StringgetHostDomain()Returns the host domain.intgetHostPort()Returns the host port.java.util.logging.LoggergetLogger()Returns the logger.java.lang.StringgetMethod()Returns the request method.ProtocolgetProtocol()Returns the exact protocol (HTTP or HTTPS).java.lang.StringgetReasonPhrase()Returns the reason phrase.protected RepresentationgetRepresentation(java.io.InputStream stream)Returns the representation wrapping the given stream.protected RepresentationgetRepresentation(java.nio.channels.ReadableByteChannel channel)Returns the representation wrapping the given channel.Series<Header>getRequestHeaders()Returns the modifiable list of request headers.java.lang.StringgetRequestUri()Returns the URI on the request line (most like a relative reference, but not necessarily).Series<Header>getResponseHeaders()Returns the modifiable list of server headers.java.lang.StringgetServerAddress()Returns the response address.
Corresponds to the IP address of the responding server.intgetServerPort()Returns the server port.intgetStatusCode()Returns the status code.java.security.PrincipalgetUserPrincipal()Returns the user principal.java.lang.StringgetVersion()Returns the protocol version used.static booleanisBroken(java.lang.Throwable exception)Returns true if the given exception is caused by a broken connection.protected abstract booleanisClientKeepAlive()Indicates if the client wants a persistent connection.booleanisConfidential()Indicates if the confidentiality of the call is ensured (ex: via SSL).booleanisConnectionBroken(java.lang.Throwable exception)Returns true if the given exception is caused by a broken connection.protected booleanisKeepAlive()Indicates if both the client and the server want a persistent connection.protected booleanisRequestChunked()Indicates if the request entity is chunked.protected booleanisResponseChunked()Indicates if the response entity is chunked.protected abstract booleanisServerKeepAlive()Indicates if the server wants a persistent connection.protected voidsetClientAddress(java.lang.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(java.lang.String hostDomain)Sets the host domain name.voidsetHostPort(int hostPort)Sets the host port.protected voidsetMethod(java.lang.String method)Sets the request method.voidsetProtocol(Protocol protocol)Sets the exact protocol used (HTTP or HTTPS).voidsetReasonPhrase(java.lang.String reasonPhrase)Sets the reason phrase.protected voidsetRequestUri(java.lang.String requestUri)Sets the full request URI.voidsetServerAddress(java.lang.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(java.security.Principal principal)Sets the user principal.voidsetVersion(java.lang.String version)Sets the protocol version used.
-
-
-
Field Detail
-
clientAddress
private volatile java.lang.String clientAddress
The client IP address.
-
clientPort
private volatile int clientPort
The client port.
-
confidential
private volatile boolean confidential
Indicates if the call is confidential.
-
hostDomain
private volatile java.lang.String hostDomain
The hostRef domain.
-
hostPort
private volatile int hostPort
The hostRef port.
-
method
private volatile java.lang.String method
The method.
-
protocol
private volatile Protocol protocol
The exact protocol.
-
reasonPhrase
private volatile java.lang.String reasonPhrase
The reason phrase.
-
requestUri
private volatile java.lang.String requestUri
The request URI.
-
serverAddress
private volatile java.lang.String serverAddress
The server IP address.
-
serverPort
private volatile int serverPort
The server port.
-
statusCode
private volatile int statusCode
The status code.
-
userPrincipal
private volatile java.security.Principal userPrincipal
The user principal.
-
version
private volatile java.lang.String version
The protocol version.
-
-
Method Detail
-
isBroken
public static boolean isBroken(java.lang.Throwable exception)
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
public java.lang.String 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
public java.lang.String getHostDomain()
Returns the host domain.- Returns:
- The host domain.
-
getHostPort
public int getHostPort()
Returns the host port.- Returns:
- The host port.
-
getLogger
public java.util.logging.Logger getLogger()
Returns the logger.- Returns:
- The logger.
-
getMethod
public java.lang.String getMethod()
Returns the request method.- Returns:
- The request method.
-
getProtocol
public Protocol getProtocol()
Returns the exact protocol (HTTP or HTTPS).- Returns:
- The exact protocol (HTTP or HTTPS).
-
getReasonPhrase
public java.lang.String getReasonPhrase()
Returns the reason phrase.- Returns:
- The reason phrase.
-
getRepresentation
protected Representation getRepresentation(java.io.InputStream stream)
Returns the representation wrapping the given stream.- Parameters:
stream- The response input stream.- Returns:
- The wrapping representation.
-
getRepresentation
protected Representation getRepresentation(java.nio.channels.ReadableByteChannel channel)
Returns the representation wrapping the given channel.- Parameters:
channel- The response channel.- Returns:
- The wrapping representation.
-
getRequestHeaders
public Series<Header> getRequestHeaders()
Returns the modifiable list of request headers.- Returns:
- The modifiable list of request headers.
-
getRequestUri
public java.lang.String getRequestUri()
Returns the URI on the request line (most like a relative reference, but not necessarily).- Returns:
- The URI on the request line.
-
getResponseHeaders
public Series<Header> getResponseHeaders()
Returns the modifiable list of server headers.- Returns:
- The modifiable list of server headers.
-
getServerAddress
public java.lang.String 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
public int getStatusCode() throws java.io.IOExceptionReturns the status code.- Returns:
- The status code.
- Throws:
java.io.IOException
-
getUserPrincipal
public java.security.Principal getUserPrincipal()
Returns the user principal.- Returns:
- The user principal.
-
getVersion
public java.lang.String 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
public boolean isConnectionBroken(java.lang.Throwable exception)
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
protected void setClientAddress(java.lang.String clientAddress)
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
public void setHostDomain(java.lang.String hostDomain)
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
protected void setMethod(java.lang.String method)
Sets the request method.- Parameters:
method- The request method.
-
setProtocol
public void setProtocol(Protocol protocol)
Sets the exact protocol used (HTTP or HTTPS).- Parameters:
protocol- The protocol.
-
setReasonPhrase
public void setReasonPhrase(java.lang.String reasonPhrase)
Sets the reason phrase.- Parameters:
reasonPhrase- The reason phrase.
-
setRequestUri
protected void setRequestUri(java.lang.String requestUri)
Sets the full request URI.- Parameters:
requestUri- The full request URI.
-
setServerAddress
public void setServerAddress(java.lang.String responseAddress)
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
public void setUserPrincipal(java.security.Principal principal)
Sets the user principal.- Parameters:
principal- The user principal.
-
setVersion
public void setVersion(java.lang.String version)
Sets the protocol version used.- Parameters:
version- The protocol version used.
-
-