- java.lang.Object
-
- swim.io.http.AbstractHttpResponder<T>
-
- All Implemented Interfaces:
FlowContext
,HttpResponder<T>
,IpContext
- Direct Known Subclasses:
StaticHttpResponder
,WsUpgradeResponder
public abstract class AbstractHttpResponder<T> extends Object implements HttpResponder<T>, IpContext, FlowContext
-
-
Field Summary
Fields Modifier and Type Field Description protected HttpResponderContext
context
-
Constructor Summary
Constructors Constructor Description AbstractHttpResponder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
become(IpSocket socket)
String
cipherSuite()
Returns the cryptographic cipher suite used by the underlying network connection.void
close()
Decoder<T>
contentDecoder(HttpRequest<?> request)
void
didBecome(IpSocket socket)
void
didDisconnect()
void
didFail(Throwable error)
void
didRequest(HttpRequest<T> request)
void
didRespond(HttpResponse<?> response)
void
didTimeout()
void
doRespond(HttpRequest<T> request)
FlowControl
flowControl()
Returns the currentFlowControl
state of the underlying network channel.void
flowControl(FlowControl flowControl)
Enqueues an atomic replacement of the underlying network channel's flow control state with a newflowControl
.FlowControl
flowControl(FlowModifier flowModifier)
Enqueues an atomic modification to the underlying network channel's flow control state by applying aflowModifier
delta.HttpResponderContext
httpResponderContext()
HttpSettings
httpSettings()
boolean
isClient()
Returnstrue
if the underlying network channel initiated an outgoing connection.boolean
isConnected()
Returnstrue
if the underlying network channel is currently connected.boolean
isSecure()
Returnstrue
if the underlying network transport is encrypted.boolean
isServer()
Returnstrue
if the underlying network channel accepted an incoming connection.InetSocketAddress
localAddress()
Returns the IP address and port of the local endpoint of the underlying network connection.Collection<Certificate>
localCertificates()
Returns the certificate chain used to authenticate the local endpoint of the underlying network connection.Principal
localPrincipal()
Returns the authenticated identity of the local endpoint of the underlying network connection.InetSocketAddress
remoteAddress()
Returns the IP address and port of the remote endpoint of the underlying network connection.Collection<Certificate>
remoteCertificates()
Returns the certificate chain used to authenticate the remote endpoint of the underlying network connection.Principal
remotePrincipal()
Returns the authenticated identity of the remote endpoint of the underlying network connection.String
securityProtocol()
Returns the name of the transport-layer security protocol used by the underlying network connection.void
setHttpResponderContext(HttpResponderContext context)
void
willBecome(IpSocket socket)
void
willRequest(HttpRequest<?> request)
void
willRespond(HttpResponse<?> response)
void
writeResponse(HttpResponse<?> response)
-
-
-
Field Detail
-
context
protected HttpResponderContext context
-
-
Method Detail
-
httpResponderContext
public HttpResponderContext httpResponderContext()
- Specified by:
httpResponderContext
in interfaceHttpResponder<T>
-
setHttpResponderContext
public void setHttpResponderContext(HttpResponderContext context)
- Specified by:
setHttpResponderContext
in interfaceHttpResponder<T>
-
contentDecoder
public Decoder<T> contentDecoder(HttpRequest<?> request)
- Specified by:
contentDecoder
in interfaceHttpResponder<T>
-
willRequest
public void willRequest(HttpRequest<?> request)
- Specified by:
willRequest
in interfaceHttpResponder<T>
-
didRequest
public void didRequest(HttpRequest<T> request)
- Specified by:
didRequest
in interfaceHttpResponder<T>
-
doRespond
public void doRespond(HttpRequest<T> request)
- Specified by:
doRespond
in interfaceHttpResponder<T>
-
willRespond
public void willRespond(HttpResponse<?> response)
- Specified by:
willRespond
in interfaceHttpResponder<T>
-
didRespond
public void didRespond(HttpResponse<?> response)
- Specified by:
didRespond
in interfaceHttpResponder<T>
-
willBecome
public void willBecome(IpSocket socket)
- Specified by:
willBecome
in interfaceHttpResponder<T>
-
didBecome
public void didBecome(IpSocket socket)
- Specified by:
didBecome
in interfaceHttpResponder<T>
-
didTimeout
public void didTimeout()
- Specified by:
didTimeout
in interfaceHttpResponder<T>
-
didDisconnect
public void didDisconnect()
- Specified by:
didDisconnect
in interfaceHttpResponder<T>
-
didFail
public void didFail(Throwable error)
- Specified by:
didFail
in interfaceHttpResponder<T>
-
isConnected
public boolean isConnected()
Description copied from interface:IpContext
Returnstrue
if the underlying network channel is currently connected.- Specified by:
isConnected
in interfaceIpContext
-
isClient
public boolean isClient()
Description copied from interface:IpContext
Returnstrue
if the underlying network channel initiated an outgoing connection.
-
isServer
public boolean isServer()
Description copied from interface:IpContext
Returnstrue
if the underlying network channel accepted an incoming connection.
-
isSecure
public boolean isSecure()
Description copied from interface:IpContext
Returnstrue
if the underlying network transport is encrypted.
-
securityProtocol
public String securityProtocol()
Description copied from interface:IpContext
Returns the name of the transport-layer security protocol used by the underlying network connection. Returnsnull
if the underlying network channel is not currently connected, or if the underlying network connection is not secure.- Specified by:
securityProtocol
in interfaceIpContext
-
cipherSuite
public String cipherSuite()
Description copied from interface:IpContext
Returns the cryptographic cipher suite used by the underlying network connection. Returnsnull
if the underlying network channel is not currently connected, or if the underlying network connection is not secure.- Specified by:
cipherSuite
in interfaceIpContext
-
localAddress
public InetSocketAddress localAddress()
Description copied from interface:IpContext
Returns the IP address and port of the local endpoint of the underlying network connection. Returnsnull
if the underlying network channel is not currently connected.- Specified by:
localAddress
in interfaceIpContext
-
localPrincipal
public Principal localPrincipal()
Description copied from interface:IpContext
Returns the authenticated identity of the local endpoint of the underlying network connection. Returnsnull
if the underlying network channel is not currently connected, or if the underlying network connection is not authenticated.- Specified by:
localPrincipal
in interfaceIpContext
-
localCertificates
public Collection<Certificate> localCertificates()
Description copied from interface:IpContext
Returns the certificate chain used to authenticate the local endpoint of the underlying network connection. Returnsnull
if the underlying network channel is not currently connected, or if the underlying network connection is not authenticated.- Specified by:
localCertificates
in interfaceIpContext
-
remoteAddress
public InetSocketAddress remoteAddress()
Description copied from interface:IpContext
Returns the IP address and port of the remote endpoint of the underlying network connection. Returnsnull
if the underlying network channel is not currently connected.- Specified by:
remoteAddress
in interfaceIpContext
-
remotePrincipal
public Principal remotePrincipal()
Description copied from interface:IpContext
Returns the authenticated identity of the remote endpoint of the underlying network connection. Returnsnull
if the underlying network channel is not currently connected, or if the underlying network connection is not authenticated.- Specified by:
remotePrincipal
in interfaceIpContext
-
remoteCertificates
public Collection<Certificate> remoteCertificates()
Description copied from interface:IpContext
Returns the certificate chain used to authenticate the remote endpoint of the underlying network connection. Returnsnull
if the underlying network channel is not currently connected, or if the underlying network connection is not authenticated.- Specified by:
remoteCertificates
in interfaceIpContext
-
flowControl
public FlowControl flowControl()
Description copied from interface:FlowContext
Returns the currentFlowControl
state of the underlying network channel.- Specified by:
flowControl
in interfaceFlowContext
-
flowControl
public void flowControl(FlowControl flowControl)
Description copied from interface:FlowContext
Enqueues an atomic replacement of the underlying network channel's flow control state with a newflowControl
.- Specified by:
flowControl
in interfaceFlowContext
-
flowControl
public FlowControl flowControl(FlowModifier flowModifier)
Description copied from interface:FlowContext
Enqueues an atomic modification to the underlying network channel's flow control state by applying aflowModifier
delta.- Specified by:
flowControl
in interfaceFlowContext
-
httpSettings
public HttpSettings httpSettings()
-
writeResponse
public void writeResponse(HttpResponse<?> response)
-
become
public void become(IpSocket socket)
-
close
public void close()
-
-