Class TransportFilter
- java.lang.Object
-
- org.glassfish.grizzly.filterchain.BaseFilter
-
- org.glassfish.grizzly.filterchain.TransportFilter
-
- All Implemented Interfaces:
Filter
- Direct Known Subclasses:
SSLBaseFilter.SSLTransportFilterWrapper
public class TransportFilter extends BaseFilter
TransportFilter
implementation, which should work with anyTransport
. ThisFilter
tries to delegate I/O event processing to theTransport
's specific transportFilter
. IfTransport
doesn't have own implementation - uses common I/O event processing logic. TransportFilter could be set to work in 2 modes:stream
ormessage
. Instream
mode, TransportFilter produces/consumes the socket channel directly. Inmessage
mode, TransportFilter representsConnection
data asBuffer
, usingFilterChainContext.getMessage()
},FilterChainContext.setMessage(Object)
. For specificTransport
, one mode could be more preferable than another. For exampleTCPNIOTransport
works just instream
mode.UDPNIOTransport
prefersmessage
mode, but could also work instream
mode.- Author:
- Alexey Stashok
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TransportFilter.FlushEvent
-
Constructor Summary
Constructors Constructor Description TransportFilter()
Create TransportFilter.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static FilterChainEvent
createFlushEvent()
static FilterChainEvent
createFlushEvent(CompletionHandler completionHandler)
protected Filter
getTransportFilter0(Transport transport)
Get defaultTransport
specific transport filter.NextAction
handleAccept(FilterChainContext ctx)
Delegates accept operation toTransport
's specific transport filter.NextAction
handleClose(FilterChainContext ctx)
Delegates close operation toTransport
's specific transport filter.NextAction
handleConnect(FilterChainContext ctx)
Delegates connect operation toTransport
's specific transport filter.NextAction
handleEvent(FilterChainContext ctx, FilterChainEvent event)
Delegates event operation toTransport
's specific transport filter.NextAction
handleRead(FilterChainContext ctx)
Delegates reading operation toTransport
's specific transport filter.NextAction
handleWrite(FilterChainContext ctx)
Delegates writing operation toTransport
's specific transport filter.-
Methods inherited from class org.glassfish.grizzly.filterchain.BaseFilter
createContext, exceptionOccurred, onAdded, onFilterChainChanged, onRemoved, toString
-
-
-
-
Method Detail
-
createFlushEvent
public static FilterChainEvent createFlushEvent()
-
createFlushEvent
public static FilterChainEvent createFlushEvent(CompletionHandler completionHandler)
-
handleAccept
public NextAction handleAccept(FilterChainContext ctx) throws IOException
Delegates accept operation toTransport
's specific transport filter.- Specified by:
handleAccept
in interfaceFilter
- Overrides:
handleAccept
in classBaseFilter
- Parameters:
ctx
-FilterChainContext
- Returns:
NextAction
instruction forFilterChain
, how it should continue the execution- Throws:
IOException
-
handleConnect
public NextAction handleConnect(FilterChainContext ctx) throws IOException
Delegates connect operation toTransport
's specific transport filter.- Specified by:
handleConnect
in interfaceFilter
- Overrides:
handleConnect
in classBaseFilter
- Parameters:
ctx
-FilterChainContext
- Returns:
NextAction
instruction forFilterChain
, how it should continue the execution- Throws:
IOException
-
handleRead
public NextAction handleRead(FilterChainContext ctx) throws IOException
Delegates reading operation toTransport
's specific transport filter.- Specified by:
handleRead
in interfaceFilter
- Overrides:
handleRead
in classBaseFilter
- Parameters:
ctx
-FilterChainContext
- Returns:
NextAction
instruction forFilterChain
, how it should continue the execution- Throws:
IOException
-
handleWrite
public NextAction handleWrite(FilterChainContext ctx) throws IOException
Delegates writing operation toTransport
's specific transport filter.- Specified by:
handleWrite
in interfaceFilter
- Overrides:
handleWrite
in classBaseFilter
- Parameters:
ctx
-FilterChainContext
- Returns:
NextAction
instruction forFilterChain
, how it should continue the execution- Throws:
IOException
-
handleEvent
public NextAction handleEvent(FilterChainContext ctx, FilterChainEvent event) throws IOException
Delegates event operation toTransport
's specific transport filter.- Specified by:
handleEvent
in interfaceFilter
- Overrides:
handleEvent
in classBaseFilter
- Parameters:
ctx
-FilterChainContext
- Returns:
NextAction
instruction forFilterChain
, how it should continue the execution- Throws:
IOException
-
handleClose
public NextAction handleClose(FilterChainContext ctx) throws IOException
Delegates close operation toTransport
's specific transport filter.- Specified by:
handleClose
in interfaceFilter
- Overrides:
handleClose
in classBaseFilter
- Parameters:
ctx
-FilterChainContext
- Returns:
NextAction
instruction forFilterChain
, how it should continue the execution- Throws:
IOException
-
-