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
TransportFilterimplementation, which should work with anyTransport. ThisFiltertries to delegate I/O event processing to theTransport's specific transportFilter. IfTransportdoesn't have own implementation - uses common I/O event processing logic. TransportFilter could be set to work in 2 modes:streamormessage. Instreammode, TransportFilter produces/consumes the socket channel directly. Inmessagemode, TransportFilter representsConnectiondata asBuffer, usingFilterChainContext.getMessage()},FilterChainContext.setMessage(Object). For specificTransport, one mode could be more preferable than another. For exampleTCPNIOTransportworks just instreammode.UDPNIOTransportprefersmessagemode, but could also work instreammode.- Author:
- Alexey Stashok
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTransportFilter.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 FilterChainEventcreateFlushEvent()static FilterChainEventcreateFlushEvent(CompletionHandler completionHandler)protected FiltergetTransportFilter0(Transport transport)Get defaultTransportspecific transport filter.NextActionhandleAccept(FilterChainContext ctx)Delegates accept operation toTransport's specific transport filter.NextActionhandleClose(FilterChainContext ctx)Delegates close operation toTransport's specific transport filter.NextActionhandleConnect(FilterChainContext ctx)Delegates connect operation toTransport's specific transport filter.NextActionhandleEvent(FilterChainContext ctx, FilterChainEvent event)Delegates event operation toTransport's specific transport filter.NextActionhandleRead(FilterChainContext ctx)Delegates reading operation toTransport's specific transport filter.NextActionhandleWrite(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:
handleAcceptin interfaceFilter- Overrides:
handleAcceptin classBaseFilter- Parameters:
ctx-FilterChainContext- Returns:
NextActioninstruction 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:
handleConnectin interfaceFilter- Overrides:
handleConnectin classBaseFilter- Parameters:
ctx-FilterChainContext- Returns:
NextActioninstruction 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:
handleReadin interfaceFilter- Overrides:
handleReadin classBaseFilter- Parameters:
ctx-FilterChainContext- Returns:
NextActioninstruction 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:
handleWritein interfaceFilter- Overrides:
handleWritein classBaseFilter- Parameters:
ctx-FilterChainContext- Returns:
NextActioninstruction 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:
handleEventin interfaceFilter- Overrides:
handleEventin classBaseFilter- Parameters:
ctx-FilterChainContext- Returns:
NextActioninstruction 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:
handleClosein interfaceFilter- Overrides:
handleClosein classBaseFilter- Parameters:
ctx-FilterChainContext- Returns:
NextActioninstruction forFilterChain, how it should continue the execution- Throws:
IOException
-
-