public abstract class ServerCall extends Call
Constructor and Description |
---|
ServerCall(Server server)
Constructor.
|
ServerCall(java.lang.String serverAddress,
int serverPort)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
abstract boolean |
abort()
Ask the connector to abort the related network connection, for example
immediately closing the socket.
|
void |
complete()
Complete the response
|
void |
flushBuffers()
Flushes the buffers onto the network so that for example you can force
headers to be written before the entity is becoming available.
|
java.util.List<java.security.cert.Certificate> |
getCertificates()
Returns the chain of client SSL certificates, if available and
accessible.
|
java.lang.String |
getCipherSuite()
Returns the SSL Cipher Suite, if available and accessible.
|
protected long |
getContentLength()
Returns the content length of the request entity if know,
Representation.UNKNOWN_SIZE otherwise. |
java.lang.String |
getHostDomain()
Returns the host domain name.
|
int |
getHostPort()
Returns the host port.
|
Representation |
getRequestEntity()
Returns the request entity if available.
|
abstract java.io.InputStream |
getRequestEntityStream(long size)
Returns the request entity stream if it exists.
|
abstract java.io.InputStream |
getRequestHeadStream()
Returns the request head stream if it exists.
|
abstract java.io.OutputStream |
getResponseEntityStream()
Returns the response entity stream if it exists.
|
java.lang.Integer |
getSslKeySize()
Returns the SSL key size, if available and accessible.
|
java.lang.String |
getSslSessionId()
Returns the SSL session ID, in hexadecimal encoding, if available and
accessible.
|
protected byte[] |
getSslSessionIdBytes()
Returns the SSL session ID, as a byte array, if available and accessible
in that format (to be used by getSslSessionId).
|
protected boolean |
isClientKeepAlive()
Indicates if the client wants a persistent connection.
|
protected boolean |
isServerKeepAlive()
Indicates if the server wants a persistent connection.
|
protected void |
readRequestHead(java.io.InputStream headStream)
Reads the HTTP request head (request line and headers).
|
void |
sendResponse(Response response)
Sends the response back to the client.
|
boolean |
shouldResponseBeChunked(Response response)
Indicates if the response should be chunked because its length is
unknown.
|
protected void |
writeResponseBody(Representation entity,
java.io.OutputStream responseEntityStream)
Effectively writes the response body.
|
protected void |
writeResponseHead(Response response)
Writes the response status line and headers.
|
protected void |
writeResponseHead(Response response,
java.io.OutputStream headStream)
Writes the response head to the given output stream.
|
getClientAddress, getClientPort, 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 ServerCall(Server server)
server
- The parent server connector.public ServerCall(java.lang.String serverAddress, int serverPort)
serverAddress
- The server IP address.serverPort
- The server port.public abstract boolean abort()
public void complete()
public void flushBuffers() throws java.io.IOException
java.io.IOException
public java.util.List<java.security.cert.Certificate> getCertificates()
public java.lang.String getCipherSuite()
protected long getContentLength()
Representation.UNKNOWN_SIZE
otherwise.public java.lang.String getHostDomain()
getHostDomain
in class Call
public int getHostPort()
getHostPort
in class Call
public Representation getRequestEntity()
public abstract java.io.InputStream getRequestEntityStream(long size)
size
- The expected entity size or -1 if unknown.public abstract java.io.InputStream getRequestHeadStream()
public abstract java.io.OutputStream getResponseEntityStream()
public java.lang.Integer getSslKeySize()
public java.lang.String getSslSessionId()
protected byte[] getSslSessionIdBytes()
protected boolean isClientKeepAlive()
Call
isClientKeepAlive
in class Call
protected boolean isServerKeepAlive()
Call
isServerKeepAlive
in class Call
protected void readRequestHead(java.io.InputStream headStream) throws java.io.IOException
java.io.IOException
public void sendResponse(Response response) throws java.io.IOException
response
- The high-level response.java.io.IOException
- if the Response could not be written to the network.public boolean shouldResponseBeChunked(Response response)
response
- The response to analyze.protected void writeResponseBody(Representation entity, java.io.OutputStream responseEntityStream) throws java.io.IOException
entity
- The representation to write as entity of the body.responseEntityStream
- The response entity stream or null if a channel is used.java.io.IOException
protected void writeResponseHead(Response response) throws java.io.IOException
response
- The response.java.io.IOException
protected void writeResponseHead(Response response, java.io.OutputStream headStream) throws java.io.IOException
response
- The response.headStream
- The output stream to write to.java.io.IOException
Copyright © 2005-2020 Restlet.