public class DefaultIoFilterChain extends java.lang.Object implements IoFilterChain
IoFilterChain
that provides
all operations for developers who want to implement their own
transport layer once used with AbstractIoSession
.IoFilterChain.Entry
限定符和类型 | 字段和说明 |
---|---|
static AttributeKey |
SESSION_CREATED_FUTURE
|
构造器和说明 |
---|
DefaultIoFilterChain(AbstractIoSession session)
Create a new default chain, associated with a session.
|
限定符和类型 | 方法和说明 |
---|---|
void |
addAfter(java.lang.String baseName,
java.lang.String name,
IoFilter filter)
Adds the specified filter with the specified name just after the filter whose name is
baseName in this chain. |
void |
addBefore(java.lang.String baseName,
java.lang.String name,
IoFilter filter)
Adds the specified filter with the specified name just before the filter whose name is
baseName in this chain. |
void |
addFirst(java.lang.String name,
IoFilter filter)
Adds the specified filter with the specified name at the beginning of this chain.
|
void |
addLast(java.lang.String name,
IoFilter filter)
Adds the specified filter with the specified name at the end of this chain.
|
void |
clear()
Removes all filters added to this chain.
|
boolean |
contains(java.lang.Class<? extends IoFilter> filterType) |
boolean |
contains(IoFilter filter) |
boolean |
contains(java.lang.String name) |
void |
fireExceptionCaught(java.lang.Throwable cause)
Fires a
IoHandler.exceptionCaught(IoSession, Throwable) event. |
void |
fireFilterClose()
Fires a
IoSession.close(boolean) event. |
void |
fireFilterWrite(WriteRequest writeRequest)
Fires a
IoSession.write(Object) event. |
void |
fireInputClosed()
Fires a
IoHandler.inputClosed(IoSession) event. |
void |
fireMessageReceived(java.lang.Object message)
Fires a
IoHandler.messageReceived(IoSession, Object) event. |
void |
fireMessageSent(WriteRequest request)
Fires a
IoHandler.messageSent(IoSession, Object) event. |
void |
fireSessionClosed()
Fires a
IoHandler.sessionClosed(IoSession) event. |
void |
fireSessionCreated()
Fires a
IoHandler.sessionCreated(IoSession) event. |
void |
fireSessionIdle(IdleStatus status)
Fires a
IoHandler.sessionIdle(IoSession, IdleStatus) event. |
void |
fireSessionOpened()
Fires a
IoHandler.sessionOpened(IoSession) event. |
IoFilter |
get(java.lang.Class<? extends IoFilter> filterType)
Returns the
IoFilter with the specified filterType
in this chain. |
IoFilter |
get(java.lang.String name)
Returns the
IoFilter with the specified name in this chain. |
java.util.List<IoFilterChain.Entry> |
getAll() |
java.util.List<IoFilterChain.Entry> |
getAllReversed() |
IoFilterChain.Entry |
getEntry(java.lang.Class<? extends IoFilter> filterType)
Returns the
IoFilterChain.Entry with the specified filterType
in this chain. |
IoFilterChain.Entry |
getEntry(IoFilter filter)
Returns the
IoFilterChain.Entry with the specified filter in this chain. |
IoFilterChain.Entry |
getEntry(java.lang.String name)
Returns the
IoFilterChain.Entry with the specified name in this chain. |
IoFilter.NextFilter |
getNextFilter(java.lang.Class<? extends IoFilter> filterType)
Returns the
IoFilter.NextFilter of the specified filterType
in this chain. |
IoFilter.NextFilter |
getNextFilter(IoFilter filter)
Returns the
IoFilter.NextFilter of the specified IoFilter
in this chain. |
IoFilter.NextFilter |
getNextFilter(java.lang.String name)
Returns the
IoFilter.NextFilter of the IoFilter with the
specified name in this chain. |
IoSession |
getSession() |
IoFilter |
remove(java.lang.Class<? extends IoFilter> filterType)
Replace the filter of the specified type with the specified new filter.
|
void |
remove(IoFilter filter)
Replace the filter with the specified name with the specified new filter.
|
IoFilter |
remove(java.lang.String name)
Removes the filter with the specified name from this chain.
|
IoFilter |
replace(java.lang.Class<? extends IoFilter> oldFilterType,
IoFilter newFilter)
Replace the filter of the specified type with the specified new
filter.
|
void |
replace(IoFilter oldFilter,
IoFilter newFilter)
Replace the filter with the specified name with the specified new
filter.
|
IoFilter |
replace(java.lang.String name,
IoFilter newFilter)
Replace the filter with the specified name with the specified new
filter.
|
java.lang.String |
toString() |
public static final AttributeKey SESSION_CREATED_FUTURE
IoFuture
related with
the IoSession
. DefaultIoFilterChain
clears this
attribute and notifies the future when fireSessionCreated()
or fireExceptionCaught(Throwable)
is invoked.public DefaultIoFilterChain(AbstractIoSession session)
session
- The session associated with the created filter chainpublic IoSession getSession()
getSession
在接口中 IoFilterChain
IoSession
of this chain.public IoFilterChain.Entry getEntry(java.lang.String name)
IoFilterChain
IoFilterChain.Entry
with the specified name in this chain.getEntry
在接口中 IoFilterChain
name
- The filter's name we are looking forpublic IoFilterChain.Entry getEntry(IoFilter filter)
IoFilterChain
IoFilterChain.Entry
with the specified filter in this chain.getEntry
在接口中 IoFilterChain
filter
- The Filter we are looking forpublic IoFilterChain.Entry getEntry(java.lang.Class<? extends IoFilter> filterType)
IoFilterChain
IoFilterChain.Entry
with the specified filterType
in this chain. If there's more than one filter with the specified
type, the first match will be chosen.getEntry
在接口中 IoFilterChain
filterType
- The filter class we are looking forpublic IoFilter get(java.lang.String name)
IoFilterChain
IoFilter
with the specified name in this chain.get
在接口中 IoFilterChain
name
- the filter's namepublic IoFilter get(java.lang.Class<? extends IoFilter> filterType)
IoFilterChain
IoFilter
with the specified filterType
in this chain. If there's more than one filter with the specified
type, the first match will be chosen.get
在接口中 IoFilterChain
filterType
- The filter classpublic IoFilter.NextFilter getNextFilter(java.lang.String name)
IoFilterChain
IoFilter.NextFilter
of the IoFilter
with the
specified name in this chain.getNextFilter
在接口中 IoFilterChain
name
- The filter's name we want the next filterpublic IoFilter.NextFilter getNextFilter(IoFilter filter)
IoFilterChain
IoFilter.NextFilter
of the specified IoFilter
in this chain.getNextFilter
在接口中 IoFilterChain
filter
- The filter for which we want the next filterpublic IoFilter.NextFilter getNextFilter(java.lang.Class<? extends IoFilter> filterType)
IoFilterChain
IoFilter.NextFilter
of the specified filterType
in this chain. If there's more than one filter with the specified
type, the first match will be chosen.getNextFilter
在接口中 IoFilterChain
filterType
- The Filter class for which we want the next filterpublic void addFirst(java.lang.String name, IoFilter filter)
IoFilterChain
addFirst
在接口中 IoFilterChain
name
- The filter's namefilter
- The filter to addpublic void addLast(java.lang.String name, IoFilter filter)
IoFilterChain
addLast
在接口中 IoFilterChain
name
- The filter's namefilter
- The filter to addpublic void addBefore(java.lang.String baseName, java.lang.String name, IoFilter filter)
IoFilterChain
baseName
in this chain.addBefore
在接口中 IoFilterChain
baseName
- The targeted Filter's namename
- The filter's namefilter
- The filter to addpublic void addAfter(java.lang.String baseName, java.lang.String name, IoFilter filter)
IoFilterChain
baseName
in this chain.addAfter
在接口中 IoFilterChain
baseName
- The targeted Filter's namename
- The filter's namefilter
- The filter to addpublic IoFilter remove(java.lang.String name)
IoFilterChain
remove
在接口中 IoFilterChain
name
- The name of the filter to removepublic void remove(IoFilter filter)
IoFilterChain
remove
在接口中 IoFilterChain
filter
- The filter to removepublic IoFilter remove(java.lang.Class<? extends IoFilter> filterType)
IoFilterChain
remove
在接口中 IoFilterChain
filterType
- The filter class to removepublic IoFilter replace(java.lang.String name, IoFilter newFilter)
IoFilterChain
replace
在接口中 IoFilterChain
name
- The name of the filter we want to replacenewFilter
- The new filterpublic void replace(IoFilter oldFilter, IoFilter newFilter)
IoFilterChain
replace
在接口中 IoFilterChain
oldFilter
- The filter we want to replacenewFilter
- The new filterpublic IoFilter replace(java.lang.Class<? extends IoFilter> oldFilterType, IoFilter newFilter)
IoFilterChain
replace
在接口中 IoFilterChain
oldFilterType
- The filter class we want to replacenewFilter
- The new filterpublic void clear() throws java.lang.Exception
IoFilterChain
clear
在接口中 IoFilterChain
java.lang.Exception
- If we weren't able to clear the filterspublic void fireSessionCreated()
IoFilterChain
IoHandler.sessionCreated(IoSession)
event. Most users don't need to
call this method at all. Please use this method only when you implement a new transport
or fire a virtual event.fireSessionCreated
在接口中 IoFilterChain
public void fireSessionOpened()
IoFilterChain
IoHandler.sessionOpened(IoSession)
event. Most users don't need to call
this method at all. Please use this method only when you implement a new transport or
fire a virtual event.fireSessionOpened
在接口中 IoFilterChain
public void fireSessionClosed()
IoFilterChain
IoHandler.sessionClosed(IoSession)
event. Most users don't need to call
this method at all. Please use this method only when you implement a new transport or
fire a virtual event.fireSessionClosed
在接口中 IoFilterChain
public void fireSessionIdle(IdleStatus status)
IoFilterChain
IoHandler.sessionIdle(IoSession, IdleStatus)
event. Most users don't
need to call this method at all. Please use this method only when you implement a new
transport or fire a virtual event.fireSessionIdle
在接口中 IoFilterChain
status
- The current status to propagatepublic void fireMessageReceived(java.lang.Object message)
IoFilterChain
IoHandler.messageReceived(IoSession, Object)
event. Most
users don't need to call this method at all. Please use this method only
when you implement a new transport or fire a virtual event.fireMessageReceived
在接口中 IoFilterChain
message
- The received messagepublic void fireMessageSent(WriteRequest request)
IoFilterChain
IoHandler.messageSent(IoSession, Object)
event. Most
users don't need to call this method at all. Please use this method only
when you implement a new transport or fire a virtual event.fireMessageSent
在接口中 IoFilterChain
request
- The sent requestpublic void fireExceptionCaught(java.lang.Throwable cause)
IoFilterChain
IoHandler.exceptionCaught(IoSession, Throwable)
event. Most users don't
need to call this method at all. Please use this method only when you implement a new
transport or fire a virtual event.fireExceptionCaught
在接口中 IoFilterChain
cause
- The exception causepublic void fireInputClosed()
IoFilterChain
IoHandler.inputClosed(IoSession)
event. Most users don't
need to call this method at all. Please use this method only when you
implement a new transport or fire a virtual event.fireInputClosed
在接口中 IoFilterChain
public void fireFilterWrite(WriteRequest writeRequest)
IoFilterChain
IoSession.write(Object)
event. Most users don't need to
call this method at all. Please use this method only when you implement a
new transport or fire a virtual event.fireFilterWrite
在接口中 IoFilterChain
writeRequest
- The message to writepublic void fireFilterClose()
IoFilterChain
IoSession.close(boolean)
event. Most users don't need to call this method at
all. Please use this method only when you implement a new transport or fire a virtual
event.fireFilterClose
在接口中 IoFilterChain
public java.util.List<IoFilterChain.Entry> getAll()
getAll
在接口中 IoFilterChain
IoFilterChain.Entry
s this chain contains.public java.util.List<IoFilterChain.Entry> getAllReversed()
getAllReversed
在接口中 IoFilterChain
IoFilterChain.Entry
s this chain contains.public boolean contains(java.lang.String name)
contains
在接口中 IoFilterChain
name
- The filter's name we are looking forIoFilter
with the
specified name.public boolean contains(IoFilter filter)
contains
在接口中 IoFilterChain
filter
- The filter we are looking forpublic boolean contains(java.lang.Class<? extends IoFilter> filterType)
contains
在接口中 IoFilterChain
filterType
- The filter's class we are looking forIoFilter
of the
specified filterType.public java.lang.String toString()
toString
在类中 java.lang.Object