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
public class IoFilterAdapter extends java.lang.Object implements IoFilter
An abstract adapter class forIoFilter. 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 Constructor Description IoFilterAdapter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddestroy()Invoked byReferenceCountingIoFilterwhen this filter is not used by anyIoFilterChainanymore, so you can destroy shared resources.voidexceptionCaught(IoFilter.NextFilter nextFilter, IoSession session, java.lang.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, java.lang.Object message)FiltersIoHandler.messageReceived(IoSession,Object)event.voidmessageSent(IoFilter.NextFilter nextFilter, IoSession session, java.lang.Object message)FiltersIoHandler.messageSent(IoSession,Object)event.voidonPostAdd(IoFilterChain parent, java.lang.String name, IoFilter.NextFilter nextFilter)Invoked after this filter is added to the specified parent.voidonPostRemove(IoFilterChain parent, java.lang.String name, IoFilter.NextFilter nextFilter)Invoked after this filter is removed from the specified parent.voidonPreAdd(IoFilterChain parent, java.lang.String name, IoFilter.NextFilter nextFilter)Invoked before this filter is added to the specified parent.voidonPreRemove(IoFilterChain parent, java.lang.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.
-
-
-
Method Detail
-
init
public void init() throws java.lang.ExceptionDescription 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
public void destroy() throws java.lang.ExceptionDescription 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, java.lang.String name, IoFilter.NextFilter nextFilter) throws java.lang.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:
java.lang.Exception
-
onPostAdd
public void onPostAdd(IoFilterChain parent, java.lang.String name, IoFilter.NextFilter nextFilter) throws java.lang.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:
java.lang.Exception
-
onPreRemove
public void onPreRemove(IoFilterChain parent, java.lang.String name, IoFilter.NextFilter nextFilter) throws java.lang.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:
java.lang.Exception
-
onPostRemove
public void onPostRemove(IoFilterChain parent, java.lang.String name, IoFilter.NextFilter nextFilter) throws java.lang.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:
java.lang.Exception
-
sessionCreated
public void sessionCreated(IoFilter.NextFilter nextFilter, IoSession session) throws java.lang.Exception
Description copied from interface:IoFilterFiltersIoHandler.sessionCreated(IoSession)event.- Specified by:
sessionCreatedin interfaceIoFilter- Throws:
java.lang.Exception
-
sessionOpened
public void sessionOpened(IoFilter.NextFilter nextFilter, IoSession session) throws java.lang.Exception
Description copied from interface:IoFilterFiltersIoHandler.sessionOpened(IoSession)event.- Specified by:
sessionOpenedin interfaceIoFilter- Throws:
java.lang.Exception
-
sessionClosed
public void sessionClosed(IoFilter.NextFilter nextFilter, IoSession session) throws java.lang.Exception
Description copied from interface:IoFilterFiltersIoHandler.sessionClosed(IoSession)event.- Specified by:
sessionClosedin interfaceIoFilter- Throws:
java.lang.Exception
-
sessionIdle
public void sessionIdle(IoFilter.NextFilter nextFilter, IoSession session, IdleStatus status) throws java.lang.Exception
Description copied from interface:IoFilterFiltersIoHandler.sessionIdle(IoSession,IdleStatus)event.- Specified by:
sessionIdlein interfaceIoFilter- Throws:
java.lang.Exception
-
exceptionCaught
public void exceptionCaught(IoFilter.NextFilter nextFilter, IoSession session, java.lang.Throwable cause) throws java.lang.Exception
Description copied from interface:IoFilterFiltersIoHandler.exceptionCaught(IoSession,Throwable)event.- Specified by:
exceptionCaughtin interfaceIoFilter- Throws:
java.lang.Exception
-
messageReceived
public void messageReceived(IoFilter.NextFilter nextFilter, IoSession session, java.lang.Object message) throws java.lang.Exception
Description copied from interface:IoFilterFiltersIoHandler.messageReceived(IoSession,Object)event.- Specified by:
messageReceivedin interfaceIoFilter- Throws:
java.lang.Exception
-
messageSent
public void messageSent(IoFilter.NextFilter nextFilter, IoSession session, java.lang.Object message) throws java.lang.Exception
Description copied from interface:IoFilterFiltersIoHandler.messageSent(IoSession,Object)event.- Specified by:
messageSentin interfaceIoFilter- Throws:
java.lang.Exception
-
filterWrite
public void filterWrite(IoFilter.NextFilter nextFilter, IoSession session, IoFilter.WriteRequest writeRequest) throws java.lang.Exception
Description copied from interface:IoFilterFiltersIoSession.write(Object)method invocation.- Specified by:
filterWritein interfaceIoFilter- Throws:
java.lang.Exception
-
filterClose
public void filterClose(IoFilter.NextFilter nextFilter, IoSession session) throws java.lang.Exception
Description copied from interface:IoFilterFiltersIoSession.close()method invocation.- Specified by:
filterClosein interfaceIoFilter- Throws:
java.lang.Exception
-
-