Package org.restlet.engine.connector
Class HttpExchangeCall
- java.lang.Object
-
- org.restlet.engine.adapter.Call
-
- org.restlet.engine.adapter.ServerCall
-
- org.restlet.engine.connector.HttpExchangeCall
-
public class HttpExchangeCall extends ServerCall
Call that is used by the Basic HTTP server.- Author:
- Jerome Louvel
-
-
Constructor Summary
Constructors Constructor Description HttpExchangeCall(org.restlet.Server server, com.sun.net.httpserver.HttpExchange exchange)
Constructor.HttpExchangeCall(org.restlet.Server server, com.sun.net.httpserver.HttpExchange exchange, boolean confidential)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
abort()
Ask the connector to abort the related network connection, for example immediately closing the socket.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.lang.String
getClientAddress()
Returns the client address.
Corresponds to the IP address of the requesting client.int
getClientPort()
Returns the client port.
Corresponds to the TCP/IP port of the requesting client.java.lang.String
getMethod()
Returns the request method.java.io.InputStream
getRequestEntityStream(long size)
Returns the request entity stream if it exists.org.restlet.util.Series<org.restlet.data.Header>
getRequestHeaders()
Returns the modifiable list of request headers.java.io.InputStream
getRequestHeadStream()
Returns the request head stream if it exists.java.lang.String
getRequestUri()
Returns the URI on the request line (most like a relative reference, but not necessarily).java.io.OutputStream
getResponseEntityStream()
Returns the response entity stream if it exists.void
writeResponseHead(org.restlet.Response restletResponse)
Writes the response status line and headers.-
Methods inherited from class org.restlet.engine.adapter.ServerCall
complete, getCertificates, getCipherSuite, getContentLength, getHostDomain, getHostPort, getRequestEntity, getSslKeySize, getSslSessionId, getSslSessionIdBytes, isClientKeepAlive, isServerKeepAlive, readRequestHead, sendResponse, shouldResponseBeChunked, writeResponseBody, writeResponseHead
-
Methods inherited from class org.restlet.engine.adapter.Call
getLogger, getProtocol, getReasonPhrase, getRepresentation, getRepresentation, 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 Detail
-
HttpExchangeCall
public HttpExchangeCall(org.restlet.Server server, com.sun.net.httpserver.HttpExchange exchange)
Constructor.- Parameters:
server
- The parent server.exchange
- The wrappedHttpExchange
instance.
-
HttpExchangeCall
public HttpExchangeCall(org.restlet.Server server, com.sun.net.httpserver.HttpExchange exchange, boolean confidential)
Constructor.- Parameters:
server
- The parent server.exchange
- The wrappedHttpExchange
instance.confidential
- True if the confidentiality of the call is ensured (ex: via SSL)
-
-
Method Detail
-
abort
public boolean abort()
Description copied from class:ServerCall
Ask the connector to abort the related network connection, for example immediately closing the socket.- Specified by:
abort
in classServerCall
- Returns:
- True if the connection was aborted.
-
flushBuffers
public void flushBuffers() throws java.io.IOException
Description copied from class:ServerCall
Flushes the buffers onto the network so that for example you can force headers to be written before the entity is becoming available.- Overrides:
flushBuffers
in classServerCall
- Throws:
java.io.IOException
-
getClientAddress
public java.lang.String getClientAddress()
Description copied from class:Call
Returns the client address.
Corresponds to the IP address of the requesting client.- Overrides:
getClientAddress
in classCall
- Returns:
- The client address.
-
getClientPort
public int getClientPort()
Description copied from class:Call
Returns the client port.
Corresponds to the TCP/IP port of the requesting client.- Overrides:
getClientPort
in classCall
- Returns:
- The client port.
-
getMethod
public java.lang.String getMethod()
Description copied from class:Call
Returns the request method.
-
getRequestHeaders
public org.restlet.util.Series<org.restlet.data.Header> getRequestHeaders()
Description copied from class:Call
Returns the modifiable list of request headers.- Overrides:
getRequestHeaders
in classCall
- Returns:
- The modifiable list of request headers.
-
getRequestEntityStream
public java.io.InputStream getRequestEntityStream(long size)
Description copied from class:ServerCall
Returns the request entity stream if it exists.- Specified by:
getRequestEntityStream
in classServerCall
- Parameters:
size
- The expected entity size or -1 if unknown.- Returns:
- The request entity stream if it exists.
-
getRequestHeadStream
public java.io.InputStream getRequestHeadStream()
Description copied from class:ServerCall
Returns the request head stream if it exists.- Specified by:
getRequestHeadStream
in classServerCall
- Returns:
- The request head stream if it exists.
-
getRequestUri
public java.lang.String getRequestUri()
Description copied from class:Call
Returns the URI on the request line (most like a relative reference, but not necessarily).- Overrides:
getRequestUri
in classCall
- Returns:
- The URI on the request line.
-
getResponseEntityStream
public java.io.OutputStream getResponseEntityStream()
Description copied from class:ServerCall
Returns the response entity stream if it exists.- Specified by:
getResponseEntityStream
in classServerCall
- Returns:
- The response entity stream if it exists.
-
writeResponseHead
public void writeResponseHead(org.restlet.Response restletResponse) throws java.io.IOException
Description copied from class:ServerCall
Writes the response status line and headers. Does nothing by default.- Overrides:
writeResponseHead
in classServerCall
- Parameters:
restletResponse
- The response.- Throws:
java.io.IOException
-
-