public class HttpServerConnection extends Object implements HandshakeCompletedListener
| Constructor and Description |
|---|
HttpServerConnection(Socket socket,
String encoding,
HttpConnector connector) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
protected HttpRequest |
createHttpRequest() |
String |
getFullUri() |
InputStream |
getInputStream() |
Certificate[] |
getLocalCertificateChain() |
OutputStream |
getOutputStream() |
Certificate[] |
getPeerCertificateChain() |
String |
getRemoteClientAddress() |
RequestLine |
getRequestLine() |
int |
getSocketReceiveBufferSize()
Gets the value of the SO_RCVBUF for the underlying socket.
|
int |
getSocketTimeout()
Returns the value of the SO_TIMEOUT for the underlying socket.
|
org.mule.util.concurrent.Latch |
getSslSocketHandshakeCompleteLatch() |
String |
getUrlWithoutRequestParams()
Returns the path of the http request without the http parameters encoded in the URL
|
ResponseWriter |
getWriter()
Returns the ResponseWriter used to write the output to the socket.
|
void |
handshakeCompleted(HandshakeCompletedEvent handshakeCompletedEvent) |
boolean |
isKeepAlive() |
boolean |
isOpen() |
boolean |
isSocketKeepAlive()
Tests if SO_KEEPALIVE is enabled in the underlying socket.
|
boolean |
isSocketTcpNoDelay()
Tests if TCP_NODELAY is enabled in the underlying socket.
|
HttpRequest |
readRequest() |
HttpResponse |
readResponse() |
void |
reset()
Clean up cached values.
|
void |
setKeepAlive(boolean b) |
void |
setSocketTimeout(int timeout) |
void |
writeFailureResponse(int statusCode,
String description)
Sends to the customer a Failure response.
|
void |
writeFailureResponse(int statusCode,
String description,
Map<String,String> headers)
Sends a customer a failure response but also adds the headers in the headers map
|
void |
writeRequest(HttpRequest request) |
void |
writeResponse(HttpResponse response) |
void |
writeResponse(HttpResponse response,
Map<String,String> headers)
Write an HttpResponse and add the map entries as headers
|
public HttpServerConnection(Socket socket, String encoding, HttpConnector connector) throws IOException
IOExceptionpublic void close()
public boolean isOpen()
public void setKeepAlive(boolean b)
public boolean isKeepAlive()
public InputStream getInputStream()
public OutputStream getOutputStream()
public ResponseWriter getWriter() throws UnsupportedEncodingException
UnsupportedEncodingExceptionpublic HttpRequest readRequest() throws IOException
IOExceptionprotected HttpRequest createHttpRequest() throws IOException
IOExceptionpublic HttpResponse readResponse() throws IOException
IOExceptionpublic void writeRequest(HttpRequest request) throws IOException
IOExceptionpublic void writeResponse(HttpResponse response) throws IOException
IOExceptionpublic void writeResponse(HttpResponse response, Map<String,String> headers) throws IOException
response - http response with the content of the responseheaders - headers to add to the http response besides the one already contained in the HttpResponse objectIOExceptionpublic String getUrlWithoutRequestParams() throws IOException
IOExceptionpublic String getRemoteClientAddress()
public void writeFailureResponse(int statusCode,
String description)
throws IOException
statusCode - http status code to send to the clientdescription - description to send as the body of the responseIOException - when it's not possible to write the response back to the client.public void writeFailureResponse(int statusCode,
String description,
Map<String,String> headers)
throws IOException
statusCode - status code of the failure responsedescription - message to be send as the bodyheaders - headers to send with the failure responseIOExceptionpublic String getFullUri() throws IOException
IOExceptionpublic int getSocketTimeout()
throws SocketException
SocketException - If there is an error in the underlying protocol.public void setSocketTimeout(int timeout)
throws SocketException
SocketExceptionpublic boolean isSocketKeepAlive()
throws SocketException
boolean indicating whether or not SO_KEEPALIVE is enabled.SocketException - If there is an error in the underlying protocol.public boolean isSocketTcpNoDelay()
throws SocketException
boolean indicating whether or not TCP_NODELAY is enabled.SocketException - If there is an error in the underlying protocol.public int getSocketReceiveBufferSize()
throws SocketException
SocketException - If there is an error in the underlying protocol.public org.mule.util.concurrent.Latch getSslSocketHandshakeCompleteLatch()
public void reset()
throws IOException
IOExceptionpublic void handshakeCompleted(HandshakeCompletedEvent handshakeCompletedEvent)
handshakeCompleted in interface HandshakeCompletedListenerpublic Certificate[] getLocalCertificateChain()
public Certificate[] getPeerCertificateChain()
public RequestLine getRequestLine() throws IOException
IOExceptionCopyright © 2003–2016 MuleSoft, Inc.. All rights reserved.