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 TypeMethodDescriptionvoiddestroy()Invoked byReferenceCountingIoFilterwhen this filter is not used by anyIoFilterChainanymore, so you can destroy shared resources.voidexceptionCaught(IoFilter.NextFilter nextFilter, IoSession session, Throwable cause) FiltersIoHandler.exceptionCaught(IoSession,Throwable)event.voidfilterClose(IoFilter.NextFilter nextFilter, IoSession session) FiltersIoSession.close()method invocation.voidfilterWrite(IoFilter.NextFilter nextFilter, IoSession session, IoFilter.WriteRequest writeRequest) FiltersIoSession.write(Object)method invocation.voidinit()Invoked byReferenceCountingIoFilterwhen this filter is added to aIoFilterChainat the first time, so you can initialize shared resources.voidmessageReceived(IoFilter.NextFilter nextFilter, IoSession session, Object message) FiltersIoHandler.messageReceived(IoSession,Object)event.voidmessageSent(IoFilter.NextFilter nextFilter, IoSession session, Object message) FiltersIoHandler.messageSent(IoSession,Object)event.voidonPostAdd(IoFilterChain parent, String name, IoFilter.NextFilter nextFilter) Invoked after this filter is added to the specified parent.voidonPostRemove(IoFilterChain parent, String name, IoFilter.NextFilter nextFilter) Invoked after this filter is removed from the specified parent.voidonPreAdd(IoFilterChain parent, String name, IoFilter.NextFilter nextFilter) Invoked before this filter is added to the specified parent.voidonPreRemove(IoFilterChain parent, String name, IoFilter.NextFilter nextFilter) Invoked before this filter is removed from the specified parent.voidsessionClosed(IoFilter.NextFilter nextFilter, IoSession session) FiltersIoHandler.sessionClosed(IoSession)event.voidsessionCreated(IoFilter.NextFilter nextFilter, IoSession session) FiltersIoHandler.sessionCreated(IoSession)event.voidsessionIdle(IoFilter.NextFilter nextFilter, IoSession session, IdleStatus status) FiltersIoHandler.sessionIdle(IoSession,IdleStatus)event.voidsessionOpened(IoFilter.NextFilter nextFilter, IoSession session) FiltersIoHandler.sessionOpened(IoSession)event.
-
Constructor Details
-
IoFilterAdapter
public IoFilterAdapter()
-
-
Method Details
-
init
Description copied from interface:IoFilterInvoked byReferenceCountingIoFilterwhen this filter is added to aIoFilterChainat 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:IoFilterInvoked byReferenceCountingIoFilterwhen this filter is not used by anyIoFilterChainanymore, 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:IoFilterInvoked 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:
onPreAddin interfaceIoFilter- Parameters:
parent- the parent who called this methodname- the name assigned to this filternextFilter- theIoFilter.NextFilterfor 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:IoFilterInvoked 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:
onPostAddin interfaceIoFilter- Parameters:
parent- the parent who called this methodname- the name assigned to this filternextFilter- theIoFilter.NextFilterfor 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:IoFilterInvoked 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:
onPreRemovein interfaceIoFilter- Parameters:
parent- the parent who called this methodname- the name assigned to this filternextFilter- theIoFilter.NextFilterfor 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:IoFilterInvoked 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:
onPostRemovein interfaceIoFilter- Parameters:
parent- the parent who called this methodname- the name assigned to this filternextFilter- theIoFilter.NextFilterfor this filter. You can reuse this object until this filter is removed from the chain.- Throws:
Exception
-
sessionCreated
Description copied from interface:IoFilterFiltersIoHandler.sessionCreated(IoSession)event.- Specified by:
sessionCreatedin interfaceIoFilter- Throws:
Exception
-
sessionOpened
Description copied from interface:IoFilterFiltersIoHandler.sessionOpened(IoSession)event.- Specified by:
sessionOpenedin interfaceIoFilter- Throws:
Exception
-
sessionClosed
Description copied from interface:IoFilterFiltersIoHandler.sessionClosed(IoSession)event.- Specified by:
sessionClosedin interfaceIoFilter- Throws:
Exception
-
sessionIdle
public void sessionIdle(IoFilter.NextFilter nextFilter, IoSession session, IdleStatus status) throws Exception Description copied from interface:IoFilterFiltersIoHandler.sessionIdle(IoSession,IdleStatus)event.- Specified by:
sessionIdlein interfaceIoFilter- Throws:
Exception
-
exceptionCaught
public void exceptionCaught(IoFilter.NextFilter nextFilter, IoSession session, Throwable cause) throws Exception Description copied from interface:IoFilterFiltersIoHandler.exceptionCaught(IoSession,Throwable)event.- Specified by:
exceptionCaughtin interfaceIoFilter- Throws:
Exception
-
messageReceived
public void messageReceived(IoFilter.NextFilter nextFilter, IoSession session, Object message) throws Exception Description copied from interface:IoFilterFiltersIoHandler.messageReceived(IoSession,Object)event.- Specified by:
messageReceivedin interfaceIoFilter- Throws:
Exception
-
messageSent
public void messageSent(IoFilter.NextFilter nextFilter, IoSession session, Object message) throws Exception Description copied from interface:IoFilterFiltersIoHandler.messageSent(IoSession,Object)event.- Specified by:
messageSentin interfaceIoFilter- Throws:
Exception
-
filterWrite
public void filterWrite(IoFilter.NextFilter nextFilter, IoSession session, IoFilter.WriteRequest writeRequest) throws Exception Description copied from interface:IoFilterFiltersIoSession.write(Object)method invocation.- Specified by:
filterWritein interfaceIoFilter- Throws:
Exception
-
filterClose
Description copied from interface:IoFilterFiltersIoSession.close()method invocation.- Specified by:
filterClosein interfaceIoFilter- Throws:
Exception
-