public class TransportFilter extends BaseFilter
Filter
implementation, which should work with any
Transport
. This Filter
tries to delegate I/O event processing
to the Transport
's specific transport Filter
. If
Transport
doesn't have own implementation - uses common I/O event
processing logic.
TransportFilter could be set to work in 2 modes: stream
or message
. In stream
mode,
TransportFilter produces/consumes the socket channel directly.
In message
mode, TransportFilter represents Connection
data as Buffer
, using FilterChainContext.getMessage()
},
FilterChainContext.setMessage(Object)
.
For specific Transport
, one mode could be more preferable than another.
For example TCPNIOTransport
works just in
stream
mode. UDPNIOTransport
prefers message
mode, but could also work
in stream
mode.Modifier and Type | Class and Description |
---|---|
static class |
TransportFilter.FlushEvent |
Constructor and Description |
---|
TransportFilter()
Create TransportFilter.
|
Modifier and Type | Method and Description |
---|---|
static FilterChainEvent |
createFlushEvent() |
static FilterChainEvent |
createFlushEvent(CompletionHandler completionHandler) |
protected Filter |
getTransportFilter0(Transport transport)
Get default
Transport specific transport filter. |
NextAction |
handleAccept(FilterChainContext ctx)
Delegates accept operation to
Transport 's specific transport
filter. |
NextAction |
handleClose(FilterChainContext ctx)
Delegates close operation to
Transport 's specific transport
filter. |
NextAction |
handleConnect(FilterChainContext ctx)
Delegates connect operation to
Transport 's specific transport
filter. |
NextAction |
handleEvent(FilterChainContext ctx,
FilterChainEvent event)
Delegates event operation to
Transport 's specific transport
filter. |
NextAction |
handleRead(FilterChainContext ctx)
Delegates reading operation to
Transport 's specific transport
filter. |
NextAction |
handleWrite(FilterChainContext ctx)
Delegates writing operation to
Transport 's specific transport
filter. |
createContext, exceptionOccurred, onAdded, onFilterChainChanged, onRemoved
public static FilterChainEvent createFlushEvent()
public static FilterChainEvent createFlushEvent(CompletionHandler completionHandler)
public NextAction handleAccept(FilterChainContext ctx) throws IOException
Transport
's specific transport
filter.handleAccept
in interface Filter
handleAccept
in class BaseFilter
ctx
- FilterChainContext
NextAction
instruction for FilterChain
, how it
should continue the executionIOException
public NextAction handleConnect(FilterChainContext ctx) throws IOException
Transport
's specific transport
filter.handleConnect
in interface Filter
handleConnect
in class BaseFilter
ctx
- FilterChainContext
NextAction
instruction for FilterChain
, how it
should continue the executionIOException
public NextAction handleRead(FilterChainContext ctx) throws IOException
Transport
's specific transport
filter.handleRead
in interface Filter
handleRead
in class BaseFilter
ctx
- FilterChainContext
NextAction
instruction for FilterChain
, how it
should continue the executionIOException
public NextAction handleWrite(FilterChainContext ctx) throws IOException
Transport
's specific transport
filter.handleWrite
in interface Filter
handleWrite
in class BaseFilter
ctx
- FilterChainContext
NextAction
instruction for FilterChain
, how it
should continue the executionIOException
public NextAction handleEvent(FilterChainContext ctx, FilterChainEvent event) throws IOException
Transport
's specific transport
filter.handleEvent
in interface Filter
handleEvent
in class BaseFilter
ctx
- FilterChainContext
NextAction
instruction for FilterChain
, how it
should continue the executionIOException
public NextAction handleClose(FilterChainContext ctx) throws IOException
Transport
's specific transport
filter.handleClose
in interface Filter
handleClose
in class BaseFilter
ctx
- FilterChainContext
NextAction
instruction for FilterChain
, how it
should continue the executionIOException
Copyright © 2014 Oracle Corporation. All rights reserved.