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
Modifier and Type | Field and Description |
---|---|
static AttributeKey |
SESSION_CREATED_FUTURE
|
Constructor and Description |
---|
DefaultIoFilterChain(AbstractIoSession session)
Create a new default chain, associated with a session.
|
Modifier and Type | Method and Description |
---|---|
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)
Returns true if this chain contains an
IoFilter of the
specified filterType. |
boolean |
contains(IoFilter filter)
Returns true if this chain contains the specified filter.
|
boolean |
contains(java.lang.String name)
Returns true if this chain contains an
IoFilter with the
specified name. |
protected void |
finalize() |
void |
fireExceptionCaught(java.lang.Throwable cause)
Fires a
IoHandler.exceptionCaught(IoSession, Throwable) event. |
void |
fireFilterClose()
Fires a
IoSession.close() event. |
void |
fireFilterWrite(WriteRequest writeRequest)
Fires a
IoSession.write(Object) event. |
void |
fireMessageReceived(java.lang.Object message)
Fires a
IoFilterChain.fireMessageReceived(Object) event. |
void |
fireMessageSent(WriteRequest request)
Fires a
IoHandler.sessionOpened(IoSession) 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()
Returns the list of all
IoFilterChain.Entry s this chain contains. |
java.util.List<IoFilterChain.Entry> |
getAllReversed()
Returns the reversed list of all
IoFilterChain.Entry s this chain contains. |
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()
Returns the parent
IoSession of this chain. |
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()
IoFilterChain
IoSession
of this chain.getSession
in interface IoFilterChain
IoSession
public IoFilterChain.Entry getEntry(java.lang.String name)
IoFilterChain
IoFilterChain.Entry
with the specified name in this chain.getEntry
in interface IoFilterChain
public IoFilterChain.Entry getEntry(IoFilter filter)
IoFilterChain
IoFilterChain.Entry
with the specified filter in this chain.getEntry
in interface IoFilterChain
public 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
in interface IoFilterChain
public IoFilter get(java.lang.String name)
IoFilterChain
IoFilter
with the specified name in this chain.get
in interface IoFilterChain
public 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
in interface IoFilterChain
public IoFilter.NextFilter getNextFilter(java.lang.String name)
IoFilterChain
IoFilter.NextFilter
of the IoFilter
with the
specified name in this chain.getNextFilter
in interface IoFilterChain
public IoFilter.NextFilter getNextFilter(IoFilter filter)
IoFilterChain
IoFilter.NextFilter
of the specified IoFilter
in this chain.getNextFilter
in interface IoFilterChain
public 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
in interface IoFilterChain
public void addFirst(java.lang.String name, IoFilter filter)
IoFilterChain
addFirst
in interface IoFilterChain
public void addLast(java.lang.String name, IoFilter filter)
IoFilterChain
addLast
in interface IoFilterChain
public void addBefore(java.lang.String baseName, java.lang.String name, IoFilter filter)
IoFilterChain
baseName
in this chain.addBefore
in interface IoFilterChain
public void addAfter(java.lang.String baseName, java.lang.String name, IoFilter filter)
IoFilterChain
baseName
in this chain.addAfter
in interface IoFilterChain
public IoFilter remove(java.lang.String name)
IoFilterChain
remove
in interface IoFilterChain
public void remove(IoFilter filter)
IoFilterChain
remove
in interface IoFilterChain
public IoFilter remove(java.lang.Class<? extends IoFilter> filterType)
IoFilterChain
remove
in interface IoFilterChain
public IoFilter replace(java.lang.String name, IoFilter newFilter)
IoFilterChain
replace
in interface IoFilterChain
public void replace(IoFilter oldFilter, IoFilter newFilter)
IoFilterChain
replace
in interface IoFilterChain
public IoFilter replace(java.lang.Class<? extends IoFilter> oldFilterType, IoFilter newFilter)
IoFilterChain
replace
in interface IoFilterChain
public void clear() throws java.lang.Exception
IoFilterChain
clear
in interface IoFilterChain
java.lang.Exception
- if IoFilter.onPostRemove(IoFilterChain, String, NextFilter)
thrown an exception.public 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
in interface 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
in interface 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
in interface 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
in interface IoFilterChain
public void fireMessageReceived(java.lang.Object message)
IoFilterChain
IoFilterChain.fireMessageReceived(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
in interface IoFilterChain
public void fireMessageSent(WriteRequest request)
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.fireMessageSent
in interface IoFilterChain
public 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
in interface 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
in interface IoFilterChain
public void fireFilterClose()
IoFilterChain
IoSession.close()
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
in interface IoFilterChain
public java.util.List<IoFilterChain.Entry> getAll()
IoFilterChain
IoFilterChain.Entry
s this chain contains.getAll
in interface IoFilterChain
public java.util.List<IoFilterChain.Entry> getAllReversed()
IoFilterChain
IoFilterChain.Entry
s this chain contains.getAllReversed
in interface IoFilterChain
public boolean contains(java.lang.String name)
IoFilterChain
IoFilter
with the
specified name.contains
in interface IoFilterChain
public boolean contains(IoFilter filter)
IoFilterChain
contains
in interface IoFilterChain
public boolean contains(java.lang.Class<? extends IoFilter> filterType)
IoFilterChain
IoFilter
of the
specified filterType.contains
in interface IoFilterChain
public java.lang.String toString()
toString
in class java.lang.Object
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
Copyright © 2004-2019 Apache MINA Project. All Rights Reserved.