java.lang.Object
swim.io.http.HttpClientModem
- All Implemented Interfaces:
FlowContext,HttpClientContext,IpContext,IpModem<HttpResponse<?>,HttpRequest<?>>
public class HttpClientModem
extends Object
implements IpModem<HttpResponse<?>,HttpRequest<?>>, HttpClientContext
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final HttpClientprotected IpModemContext<HttpResponse<?>,HttpRequest<?>> protected final HttpSettings -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidReturns the cryptographic cipher suite used by the underlying network connection.voidclose()voidLifecycle callback invoked by the modem context after it hasbecomea newsocketimplementation.voidLifecycle callback invoked by the modem context after the underlying network socket has opened a connection.voidLifecycle callback invoked by the socket context after the underlying network connection has disconnected.voidLifecycle callback invoked by the modem context when the underlying network socket fails by throwing anerror.voiddidRead(HttpResponse<?> response) I/O callback invoked by the modem context with the completed value of the current readDecoderafter it has transitioned to the done state.voidLifecycle callback invoked by the modem context after the underlying network socket has established a secure connection.voidLifecycle callback invoked by the modem context after the underlying network connection has timed out.voiddidWrite(HttpRequest<?> request) I/O callback invoked by the modem context with the completed value of the current writeEncoderafter it has transitioned to the done state.voiddoRead()voiddoRequest(HttpRequester<?> requester) voiddoWrite()Returns the currentFlowControlstate of the underlying network channel.voidflowControl(FlowControl flowControl) Enqueues an atomic replacement of the underlying network channel's flow control state with a newflowControl.flowControl(FlowModifier flowModifier) Enqueues an atomic modification to the underlying network channel's flow control state by applying aflowModifierdelta.longReturns the number of idle milliseconds after which thisIpModemshould be closed due to inactivity.Returns the socket modem context to which thisIpModemis bound; returnsnullif thisIpModemis unbound.booleanisClient()Returnstrueif the underlying network channel initiated an outgoing connection.booleanReturnstrueif the underlying network channel is currently connected.booleanisSecure()Returnstrueif the underlying network transport is encrypted.booleanisServer()Returnstrueif the underlying network channel accepted an incoming connection.Returns the IP address and port of the local endpoint of the underlying network connection.Returns the certificate chain used to authenticate the local endpoint of the underlying network connection.Returns the authenticated identity of the local endpoint of the underlying network connection.voidReturns the IP address and port of the remote endpoint of the underlying network connection.Returns the certificate chain used to authenticate the remote endpoint of the underlying network connection.Returns the authenticated identity of the remote endpoint of the underlying network connection.Returns the name of the transport-layer security protocol used by the underlying network connection.voidsetIpModemContext(IpModemContext<HttpResponse<?>, HttpRequest<?>> context) Sets the socket modem context to which thisIpModemis bound.voidwillBecome(IpSocket socket) Lifecycle callback invoked by the modem context before it hasbecomea newsocketimplementation.voidLifecycle callback invoked by the modem context before the underlying network socket attempts to open a connection.voidLifecycle callback invoked by the modem context before the underlying network socket establishes a secure connection.
-
Field Details
-
client
-
httpSettings
-
context
-
-
Constructor Details
-
HttpClientModem
-
-
Method Details
-
ipModemContext
Description copied from interface:IpModemReturns the socket modem context to which thisIpModemis bound; returnsnullif thisIpModemis unbound.- Specified by:
ipModemContextin interfaceIpModem<HttpResponse<?>,HttpRequest<?>>
-
setIpModemContext
Description copied from interface:IpModemSets the socket modem context to which thisIpModemis bound.- Specified by:
setIpModemContextin interfaceIpModem<HttpResponse<?>,HttpRequest<?>>
-
idleTimeout
public long idleTimeout()Description copied from interface:IpModemReturns the number of idle milliseconds after which thisIpModemshould be closed due to inactivity. Returns-1if a default idle timeout should be used. Returns0if the underlying network socket should not time out.- Specified by:
idleTimeoutin interfaceIpModem<HttpResponse<?>,HttpRequest<?>>
-
doRead
public void doRead()Description copied from interface:IpModemI/O callback invoked by the modem context asking thisIpModemto provide an inputDecoderby invoking the modem context'sreadmethod. The modem context will asynchronously feed input data to the provided readDecoderuntil it transitions out of the cont state. The read flow control of the underlying network socket is automatically managed by the modem context using the state of the readDecoder. May be invoked concurrently to other I/O callbacks, but never concurrently with otherdoReadordidReadcalls.- Specified by:
doReadin interfaceIpModem<HttpResponse<?>,HttpRequest<?>>
-
didRead
Description copied from interface:IpModemI/O callback invoked by the modem context with the completed value of the current readDecoderafter it has transitioned to the done state. May be invoked concurrently to other I/O callbacks, but never concurrently with otherdoReadordidReadcalls.- Specified by:
didReadin interfaceIpModem<HttpResponse<?>,HttpRequest<?>>
-
doWrite
public void doWrite()Description copied from interface:IpModemI/O callback invoked by the modem context asking thisIpModemto provide an outputEncoderby invoking the modem context'swritemethod. The modem context will asynchronously pull output data from the provided writeEncoderuntil it transitions out of the cont state. The write flow control of the underlying network socket is automatically managed by the modem context using the state of the writeEncoder. May be invoked concurrently to other I/O callbacks, but never concurrently with otherdoWriteordidWritecalls.- Specified by:
doWritein interfaceIpModem<HttpResponse<?>,HttpRequest<?>>
-
didWrite
Description copied from interface:IpModemI/O callback invoked by the modem context with the completed value of the current writeEncoderafter it has transitioned to the done state. May be invoked concurrently to other I/O callbacks, but never concurrently with otherdodWriteordidWritecalls.- Specified by:
didWritein interfaceIpModem<HttpResponse<?>,HttpRequest<?>>
-
willConnect
public void willConnect()Description copied from interface:IpModemLifecycle callback invoked by the modem context before the underlying network socket attempts to open a connection.- Specified by:
willConnectin interfaceIpModem<HttpResponse<?>,HttpRequest<?>>
-
didConnect
public void didConnect()Description copied from interface:IpModemLifecycle callback invoked by the modem context after the underlying network socket has opened a connection.- Specified by:
didConnectin interfaceIpModem<HttpResponse<?>,HttpRequest<?>>
-
willSecure
public void willSecure()Description copied from interface:IpModemLifecycle callback invoked by the modem context before the underlying network socket establishes a secure connection.- Specified by:
willSecurein interfaceIpModem<HttpResponse<?>,HttpRequest<?>>
-
didSecure
public void didSecure()Description copied from interface:IpModemLifecycle callback invoked by the modem context after the underlying network socket has established a secure connection.- Specified by:
didSecurein interfaceIpModem<HttpResponse<?>,HttpRequest<?>>
-
willBecome
Description copied from interface:IpModemLifecycle callback invoked by the modem context before it hasbecomea newsocketimplementation.- Specified by:
willBecomein interfaceIpModem<HttpResponse<?>,HttpRequest<?>>
-
didBecome
Description copied from interface:IpModemLifecycle callback invoked by the modem context after it hasbecomea newsocketimplementation.- Specified by:
didBecomein interfaceIpModem<HttpResponse<?>,HttpRequest<?>>
-
didTimeout
public void didTimeout()Description copied from interface:IpModemLifecycle callback invoked by the modem context after the underlying network connection has timed out. The modem will automatically be closed.- Specified by:
didTimeoutin interfaceIpModem<HttpResponse<?>,HttpRequest<?>>
-
didDisconnect
public void didDisconnect()Description copied from interface:IpModemLifecycle callback invoked by the socket context after the underlying network connection has disconnected.- Specified by:
didDisconnectin interfaceIpModem<HttpResponse<?>,HttpRequest<?>>
-
didFail
Description copied from interface:IpModemLifecycle callback invoked by the modem context when the underlying network socket fails by throwing anerror. The modem will automatically be closed.- Specified by:
didFailin interfaceIpModem<HttpResponse<?>,HttpRequest<?>>
-
isConnected
public boolean isConnected()Description copied from interface:IpContextReturnstrueif the underlying network channel is currently connected.- Specified by:
isConnectedin interfaceIpContext
-
isClient
public boolean isClient()Description copied from interface:IpContextReturnstrueif the underlying network channel initiated an outgoing connection. -
isServer
public boolean isServer()Description copied from interface:IpContextReturnstrueif the underlying network channel accepted an incoming connection. -
isSecure
public boolean isSecure()Description copied from interface:IpContextReturnstrueif the underlying network transport is encrypted. -
securityProtocol
Description copied from interface:IpContextReturns the name of the transport-layer security protocol used by the underlying network connection. Returnsnullif the underlying network channel is not currently connected, or if the underlying network connection is not secure.- Specified by:
securityProtocolin interfaceIpContext
-
cipherSuite
Description copied from interface:IpContextReturns the cryptographic cipher suite used by the underlying network connection. Returnsnullif the underlying network channel is not currently connected, or if the underlying network connection is not secure.- Specified by:
cipherSuitein interfaceIpContext
-
localAddress
Description copied from interface:IpContextReturns the IP address and port of the local endpoint of the underlying network connection. Returnsnullif the underlying network channel is not currently connected.- Specified by:
localAddressin interfaceIpContext
-
localPrincipal
Description copied from interface:IpContextReturns the authenticated identity of the local endpoint of the underlying network connection. Returnsnullif the underlying network channel is not currently connected, or if the underlying network connection is not authenticated.- Specified by:
localPrincipalin interfaceIpContext
-
localCertificates
Description copied from interface:IpContextReturns the certificate chain used to authenticate the local endpoint of the underlying network connection. Returnsnullif the underlying network channel is not currently connected, or if the underlying network connection is not authenticated.- Specified by:
localCertificatesin interfaceIpContext
-
remoteAddress
Description copied from interface:IpContextReturns the IP address and port of the remote endpoint of the underlying network connection. Returnsnullif the underlying network channel is not currently connected.- Specified by:
remoteAddressin interfaceIpContext
-
remotePrincipal
Description copied from interface:IpContextReturns the authenticated identity of the remote endpoint of the underlying network connection. Returnsnullif the underlying network channel is not currently connected, or if the underlying network connection is not authenticated.- Specified by:
remotePrincipalin interfaceIpContext
-
remoteCertificates
Description copied from interface:IpContextReturns the certificate chain used to authenticate the remote endpoint of the underlying network connection. Returnsnullif the underlying network channel is not currently connected, or if the underlying network connection is not authenticated.- Specified by:
remoteCertificatesin interfaceIpContext
-
flowControl
Description copied from interface:FlowContextReturns the currentFlowControlstate of the underlying network channel.- Specified by:
flowControlin interfaceFlowContext
-
flowControl
Description copied from interface:FlowContextEnqueues an atomic replacement of the underlying network channel's flow control state with a newflowControl.- Specified by:
flowControlin interfaceFlowContext
-
flowControl
Description copied from interface:FlowContextEnqueues an atomic modification to the underlying network channel's flow control state by applying aflowModifierdelta.- Specified by:
flowControlin interfaceFlowContext
-
httpSettings
- Specified by:
httpSettingsin interfaceHttpClientContext
-
doRequest
- Specified by:
doRequestin interfaceHttpClientContext
-
readResponse
public void readResponse()- Specified by:
readResponsein interfaceHttpClientContext
-
become
- Specified by:
becomein interfaceHttpClientContext
-
close
public void close()- Specified by:
closein interfaceHttpClientContext
-