Package org.apache.mina.common
Class IoFilterAdapter
java.lang.Object
org.apache.mina.common.IoFilterAdapter
- All Implemented Interfaces:
IoFilter
- Direct Known Subclasses:
BlacklistFilter
,ExecutorFilter
,LoggingFilter
,ProtocolCodecFilter
,StreamWriteFilter
An abstract adapter class for
IoFilter
. You can extend
this class and selectively override required event filter methods only. All
methods forwards events to the next filter by default.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.mina.common.IoFilter
IoFilter.NextFilter, IoFilter.WriteRequest
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
destroy()
Invoked byReferenceCountingIoFilter
when this filter is not used by anyIoFilterChain
anymore, so you can destroy shared resources.void
exceptionCaught
(IoFilter.NextFilter nextFilter, IoSession session, Throwable cause) FiltersIoHandler.exceptionCaught(IoSession,Throwable)
event.void
filterClose
(IoFilter.NextFilter nextFilter, IoSession session) FiltersIoSession.close()
method invocation.void
filterWrite
(IoFilter.NextFilter nextFilter, IoSession session, IoFilter.WriteRequest writeRequest) FiltersIoSession.write(Object)
method invocation.void
init()
Invoked byReferenceCountingIoFilter
when this filter is added to aIoFilterChain
at the first time, so you can initialize shared resources.void
messageReceived
(IoFilter.NextFilter nextFilter, IoSession session, Object message) FiltersIoHandler.messageReceived(IoSession,Object)
event.void
messageSent
(IoFilter.NextFilter nextFilter, IoSession session, Object message) FiltersIoHandler.messageSent(IoSession,Object)
event.void
onPostAdd
(IoFilterChain parent, String name, IoFilter.NextFilter nextFilter) Invoked after this filter is added to the specified parent.void
onPostRemove
(IoFilterChain parent, String name, IoFilter.NextFilter nextFilter) Invoked after this filter is removed from the specified parent.void
onPreAdd
(IoFilterChain parent, String name, IoFilter.NextFilter nextFilter) Invoked before this filter is added to the specified parent.void
onPreRemove
(IoFilterChain parent, String name, IoFilter.NextFilter nextFilter) Invoked before this filter is removed from the specified parent.void
sessionClosed
(IoFilter.NextFilter nextFilter, IoSession session) FiltersIoHandler.sessionClosed(IoSession)
event.void
sessionCreated
(IoFilter.NextFilter nextFilter, IoSession session) FiltersIoHandler.sessionCreated(IoSession)
event.void
sessionIdle
(IoFilter.NextFilter nextFilter, IoSession session, IdleStatus status) FiltersIoHandler.sessionIdle(IoSession,IdleStatus)
event.void
sessionOpened
(IoFilter.NextFilter nextFilter, IoSession session) FiltersIoHandler.sessionOpened(IoSession)
event.
-
Constructor Details
-
IoFilterAdapter
public IoFilterAdapter()
-
-
Method Details
-
init
Description copied from interface:IoFilter
Invoked byReferenceCountingIoFilter
when this filter is added to aIoFilterChain
at the first time, so you can initialize shared resources. Please note that this method is never called if you don't wrap a filter withReferenceCountingIoFilter
. -
destroy
Description copied from interface:IoFilter
Invoked byReferenceCountingIoFilter
when this filter is not used by anyIoFilterChain
anymore, so you can destroy shared resources. Please note that this method is never called if you don't wrap a filter withReferenceCountingIoFilter
. -
onPreAdd
public void onPreAdd(IoFilterChain parent, String name, IoFilter.NextFilter nextFilter) throws Exception Description copied from interface:IoFilter
Invoked before this filter is added to the specified parent. Please note that this method can be invoked more than once if this filter is added to more than one parents. This method is not invoked beforeIoFilter.init()
is invoked.- Specified by:
onPreAdd
in interfaceIoFilter
- Parameters:
parent
- the parent who called this methodname
- the name assigned to this filternextFilter
- theIoFilter.NextFilter
for this filter. You can reuse this object until this filter is removed from the chain.- Throws:
Exception
-
onPostAdd
public void onPostAdd(IoFilterChain parent, String name, IoFilter.NextFilter nextFilter) throws Exception Description copied from interface:IoFilter
Invoked after this filter is added to the specified parent. Please note that this method can be invoked more than once if this filter is added to more than one parents. This method is not invoked beforeIoFilter.init()
is invoked.- Specified by:
onPostAdd
in interfaceIoFilter
- Parameters:
parent
- the parent who called this methodname
- the name assigned to this filternextFilter
- theIoFilter.NextFilter
for this filter. You can reuse this object until this filter is removed from the chain.- Throws:
Exception
-
onPreRemove
public void onPreRemove(IoFilterChain parent, String name, IoFilter.NextFilter nextFilter) throws Exception Description copied from interface:IoFilter
Invoked before this filter is removed from the specified parent. Please note that this method can be invoked more than once if this filter is removed from more than one parents. This method is always invoked beforeIoFilter.destroy()
is invoked.- Specified by:
onPreRemove
in interfaceIoFilter
- Parameters:
parent
- the parent who called this methodname
- the name assigned to this filternextFilter
- theIoFilter.NextFilter
for this filter. You can reuse this object until this filter is removed from the chain.- Throws:
Exception
-
onPostRemove
public void onPostRemove(IoFilterChain parent, String name, IoFilter.NextFilter nextFilter) throws Exception Description copied from interface:IoFilter
Invoked after this filter is removed from the specified parent. Please note that this method can be invoked more than once if this filter is removed from more than one parents. This method is always invoked beforeIoFilter.destroy()
is invoked.- Specified by:
onPostRemove
in interfaceIoFilter
- Parameters:
parent
- the parent who called this methodname
- the name assigned to this filternextFilter
- theIoFilter.NextFilter
for this filter. You can reuse this object until this filter is removed from the chain.- Throws:
Exception
-
sessionCreated
Description copied from interface:IoFilter
FiltersIoHandler.sessionCreated(IoSession)
event.- Specified by:
sessionCreated
in interfaceIoFilter
- Throws:
Exception
-
sessionOpened
Description copied from interface:IoFilter
FiltersIoHandler.sessionOpened(IoSession)
event.- Specified by:
sessionOpened
in interfaceIoFilter
- Throws:
Exception
-
sessionClosed
Description copied from interface:IoFilter
FiltersIoHandler.sessionClosed(IoSession)
event.- Specified by:
sessionClosed
in interfaceIoFilter
- Throws:
Exception
-
sessionIdle
public void sessionIdle(IoFilter.NextFilter nextFilter, IoSession session, IdleStatus status) throws Exception Description copied from interface:IoFilter
FiltersIoHandler.sessionIdle(IoSession,IdleStatus)
event.- Specified by:
sessionIdle
in interfaceIoFilter
- Throws:
Exception
-
exceptionCaught
public void exceptionCaught(IoFilter.NextFilter nextFilter, IoSession session, Throwable cause) throws Exception Description copied from interface:IoFilter
FiltersIoHandler.exceptionCaught(IoSession,Throwable)
event.- Specified by:
exceptionCaught
in interfaceIoFilter
- Throws:
Exception
-
messageReceived
public void messageReceived(IoFilter.NextFilter nextFilter, IoSession session, Object message) throws Exception Description copied from interface:IoFilter
FiltersIoHandler.messageReceived(IoSession,Object)
event.- Specified by:
messageReceived
in interfaceIoFilter
- Throws:
Exception
-
messageSent
public void messageSent(IoFilter.NextFilter nextFilter, IoSession session, Object message) throws Exception Description copied from interface:IoFilter
FiltersIoHandler.messageSent(IoSession,Object)
event.- Specified by:
messageSent
in interfaceIoFilter
- Throws:
Exception
-
filterWrite
public void filterWrite(IoFilter.NextFilter nextFilter, IoSession session, IoFilter.WriteRequest writeRequest) throws Exception Description copied from interface:IoFilter
FiltersIoSession.write(Object)
method invocation.- Specified by:
filterWrite
in interfaceIoFilter
- Throws:
Exception
-
filterClose
Description copied from interface:IoFilter
FiltersIoSession.close()
method invocation.- Specified by:
filterClose
in interfaceIoFilter
- Throws:
Exception
-