public class PUFilter extends BaseFilter
Constructor and Description |
---|
PUFilter() |
PUFilter(boolean isCloseUnrecognizedConnection)
Constructs PUFilter.
|
Modifier and Type | Method and Description |
---|---|
void |
deregister(PUProtocol puProtocol)
Deregisters the
PUProtocol . |
protected void |
findProtocol(PUContext puContext,
FilterChainContext ctx) |
Filter |
getBackChannelFilter()
Get the back channel
Filter implementation, which should connect the
custom protocol FilterChain with the main FilterChain . |
Set<PUProtocol> |
getProtocols()
Get registered port unification protocols -
PUProtocol s. |
FilterChainBuilder |
getPUFilterChainBuilder()
Returns the
FilterChainBuilder , developers may use to build there
custom protocol filter chain. |
NextAction |
handleClose(FilterChainContext ctx)
Execute a unit of processing work to be performed, when connection
has been closed.
|
NextAction |
handleEvent(FilterChainContext ctx,
FilterChainEvent event)
Handle custom event associated with the
Connection . |
NextAction |
handleRead(FilterChainContext ctx)
Execute a unit of processing work to be performed, when channel will
become available for reading.
|
boolean |
isCloseUnrecognizedConnection()
Returns true if a
Connection whose protocol is not recognized
will be automatically closed, or false if normal
FilterChain processing will be continued for such Connection ,
so a Filter next to PUFilter may implement custom logic
to process unrecognized connection. |
PUProtocol |
register(ProtocolFinder protocolFinder,
FilterChain filterChain)
Registers new
ProtocolFinder - FilterChain pair, which
defines the protocol. |
void |
register(PUProtocol puProtocol)
Registers new
PUProtocol . |
createContext, exceptionOccurred, handleAccept, handleConnect, handleWrite, onAdded, onFilterChainChanged, onRemoved
public PUFilter()
public PUFilter(boolean isCloseUnrecognizedConnection)
isCloseUnrecognizedConnection
- true if a Connection
whose protocol is not recognized will be automatically closed,
or false if normal FilterChain
processing will be
continued for such Connection
, so a Filter
next to
PUFilter may implement custom logic to process unrecognized connection.public PUProtocol register(ProtocolFinder protocolFinder, FilterChain filterChain)
ProtocolFinder
- FilterChain
pair, which
defines the protocol.protocolFinder
- ProtocolFinder
filterChain
- FilterChain
PUProtocol
, which wraps passed ProtocolFinder
and FilterChain
.public void register(PUProtocol puProtocol)
PUProtocol
.puProtocol
- PUProtocol
public void deregister(PUProtocol puProtocol)
PUProtocol
.puProtocol
- PUProtocol
public Set<PUProtocol> getProtocols()
PUProtocol
s.PUProtocol
Set
.public Filter getBackChannelFilter()
Filter
implementation, which should connect the
custom protocol FilterChain
with the main FilterChain
.
Usually developers shouldn't use this method, if they build custom protocol
chains using getPUFilterChainBuilder()
, otherwise they have to
make sure there custom protocol FilterChain
contains back channel
Filter
(usually first Filter in the custom protocol filter chain).Filter
.public FilterChainBuilder getPUFilterChainBuilder()
FilterChainBuilder
, developers may use to build there
custom protocol filter chain.
The returned FilterChainBuilder
may have some Filter
s pre-added.FilterChainBuilder
.public boolean isCloseUnrecognizedConnection()
Connection
whose protocol is not recognized
will be automatically closed, or false if normal
FilterChain
processing will be continued for such Connection
,
so a Filter
next to PUFilter may implement custom logic
to process unrecognized connection.public NextAction handleRead(FilterChainContext ctx) throws IOException
BaseFilter
Filter
may either complete the required processing and
return false, or delegate remaining processing to the next
Filter
in a FilterChain
containing this Filter
by returning true.handleRead
in interface Filter
handleRead
in class BaseFilter
ctx
- FilterChainContext
NextAction
instruction for FilterChain
, how it
should continue the executionIOException
public NextAction handleEvent(FilterChainContext ctx, FilterChainEvent event) throws IOException
BaseFilter
Connection
.
This Filter
may either complete the required processing and
return StopAction
, or delegate remaining processing to the next
Filter
in a FilterChain
containing this Filter
by returning InvokeAction
.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
BaseFilter
Filter
may either complete the required processing and
return false, or delegate remaining processing to the next
Filter
in a FilterChain
containing this Filter
by returning true.handleClose
in interface Filter
handleClose
in class BaseFilter
ctx
- FilterChainContext
NextAction
instruction for FilterChain
, how it
should continue the executionIOException
protected void findProtocol(PUContext puContext, FilterChainContext ctx)
Copyright © 2014 Oracle Corporation. All rights reserved.