Package org.apache.mina.common.support
Class AbstractIoFilterChain
java.lang.Object
org.apache.mina.common.support.AbstractIoFilterChain
- All Implemented Interfaces:
IoFilterChain
- Direct Known Subclasses:
VmPipeFilterChain
An abstract implementation of
IoFilterChain that provides
common operations for developers to implement their own transport layer.
The only method a developer should implement is
doWrite(IoSession, IoFilter.WriteRequest). This method is invoked
when filter chain is evaluated for
IoFilter.filterWrite(NextFilter, IoSession, IoFilter.WriteRequest) and
finally to be written out.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.mina.common.IoFilterChain
IoFilterChain.Entry -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringA session attribute that stores aConnectFuturerelated with theIoSession. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds the specified filter with the specified name just after the filter whose name isbaseNamein this chain.voidAdds the specified filter with the specified name just before the filter whose name isbaseNamein this chain.voidAdds the specified filter with the specified name at the beginning of this chain.voidAdds the specified filter with the specified name at the end of this chain.voidclear()Removes all filters added to this chain.booleanReturns true if this chain contains anIoFilterof the specified filterType.booleanReturns true if this chain contains anIoFilterwith the specified name.booleanReturns true if this chain contains the specified filter.protected abstract voidprotected abstract voiddoWrite(IoSession session, IoFilter.WriteRequest writeRequest) protected voidfinalize()voidfireExceptionCaught(IoSession session, Throwable cause) Fires aIoHandler.exceptionCaught(IoSession, Throwable)event.voidfireFilterClose(IoSession session) Fires aIoSession.close()event.voidfireFilterWrite(IoSession session, IoFilter.WriteRequest writeRequest) Fires aIoSession.write(Object)event.voidfireMessageReceived(IoSession session, Object message) Fires aIoFilterChain.fireMessageReceived(IoSession, Object)event.voidfireMessageSent(IoSession session, IoFilter.WriteRequest request) Fires aIoHandler.sessionOpened(IoSession)event.voidfireSessionClosed(IoSession session) Fires aIoHandler.sessionClosed(IoSession)event.voidfireSessionCreated(IoSession session) Fires aIoHandler.sessionCreated(IoSession)event.voidfireSessionIdle(IoSession session, IdleStatus status) Fires aIoHandler.sessionIdle(IoSession, IdleStatus)event.voidfireSessionOpened(IoSession session) Fires aIoHandler.sessionOpened(IoSession)event.Returns theIoFilterwith the specified name in this chain.getAll()Returns the list of allIoFilterChain.Entrys this chain contains.Returns the reversed list of allIoFilterChain.Entrys this chain contains.Returns theIoFilterChain.Entrywith the specified name in this chain.getNextFilter(String name) Returns theIoFilter.NextFilterof theIoFilterwith the specified name in this chain.Returns the parentIoSessionof this chain.Removes the filter with the specified name from this chain.toString()
-
Field Details
-
CONNECT_FUTURE
A session attribute that stores aConnectFuturerelated with theIoSession.AbstractIoFilterChainclears this attribute and notifies the future whenfireSessionOpened(IoSession)orfireExceptionCaught(IoSession, Throwable)is invoked
-
-
Constructor Details
-
AbstractIoFilterChain
-
-
Method Details
-
getSession
Description copied from interface:IoFilterChainReturns the parentIoSessionof this chain.- Specified by:
getSessionin interfaceIoFilterChain- Returns:
IoSession
-
getEntry
Description copied from interface:IoFilterChainReturns theIoFilterChain.Entrywith the specified name in this chain.- Specified by:
getEntryin interfaceIoFilterChain- Returns:
- null if there's no such name in this chain
-
get
Description copied from interface:IoFilterChainReturns theIoFilterwith the specified name in this chain.- Specified by:
getin interfaceIoFilterChain- Returns:
- null if there's no such name in this chain
-
getNextFilter
Description copied from interface:IoFilterChainReturns theIoFilter.NextFilterof theIoFilterwith the specified name in this chain.- Specified by:
getNextFilterin interfaceIoFilterChain- Returns:
- null if there's no such name in this chain
-
addFirst
Description copied from interface:IoFilterChainAdds the specified filter with the specified name at the beginning of this chain.- Specified by:
addFirstin interfaceIoFilterChain
-
addLast
Description copied from interface:IoFilterChainAdds the specified filter with the specified name at the end of this chain.- Specified by:
addLastin interfaceIoFilterChain
-
addBefore
Description copied from interface:IoFilterChainAdds the specified filter with the specified name just before the filter whose name isbaseNamein this chain.- Specified by:
addBeforein interfaceIoFilterChain
-
addAfter
Description copied from interface:IoFilterChainAdds the specified filter with the specified name just after the filter whose name isbaseNamein this chain.- Specified by:
addAfterin interfaceIoFilterChain
-
remove
Description copied from interface:IoFilterChainRemoves the filter with the specified name from this chain.- Specified by:
removein interfaceIoFilterChain
-
clear
Description copied from interface:IoFilterChainRemoves all filters added to this chain.- Specified by:
clearin interfaceIoFilterChain- Throws:
Exception- ifIoFilter.onPostRemove(IoFilterChain, String, NextFilter)thrown an exception.
-
fireSessionCreated
Description copied from interface:IoFilterChainFires aIoHandler.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.- Specified by:
fireSessionCreatedin interfaceIoFilterChain
-
fireSessionOpened
Description copied from interface:IoFilterChainFires aIoHandler.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.- Specified by:
fireSessionOpenedin interfaceIoFilterChain
-
fireSessionClosed
Description copied from interface:IoFilterChainFires aIoHandler.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.- Specified by:
fireSessionClosedin interfaceIoFilterChain
-
fireSessionIdle
Description copied from interface:IoFilterChainFires aIoHandler.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.- Specified by:
fireSessionIdlein interfaceIoFilterChain
-
fireMessageReceived
Description copied from interface:IoFilterChainFires aIoFilterChain.fireMessageReceived(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.- Specified by:
fireMessageReceivedin interfaceIoFilterChain
-
fireMessageSent
Description copied from interface:IoFilterChainFires aIoHandler.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.- Specified by:
fireMessageSentin interfaceIoFilterChain
-
fireExceptionCaught
Description copied from interface:IoFilterChainFires aIoHandler.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.- Specified by:
fireExceptionCaughtin interfaceIoFilterChain
-
fireFilterWrite
Description copied from interface:IoFilterChainFires aIoSession.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.- Specified by:
fireFilterWritein interfaceIoFilterChain
-
fireFilterClose
Description copied from interface:IoFilterChainFires aIoSession.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.- Specified by:
fireFilterClosein interfaceIoFilterChain
-
getAll
Description copied from interface:IoFilterChainReturns the list of allIoFilterChain.Entrys this chain contains.- Specified by:
getAllin interfaceIoFilterChain
-
getAllReversed
Description copied from interface:IoFilterChainReturns the reversed list of allIoFilterChain.Entrys this chain contains.- Specified by:
getAllReversedin interfaceIoFilterChain
-
contains
Description copied from interface:IoFilterChainReturns true if this chain contains anIoFilterwith the specified name.- Specified by:
containsin interfaceIoFilterChain
-
contains
Description copied from interface:IoFilterChainReturns true if this chain contains the specified filter.- Specified by:
containsin interfaceIoFilterChain
-
contains
Description copied from interface:IoFilterChainReturns true if this chain contains anIoFilterof the specified filterType.- Specified by:
containsin interfaceIoFilterChain
-
toString
-
finalize
-
doWrite
protected abstract void doWrite(IoSession session, IoFilter.WriteRequest writeRequest) throws Exception - Throws:
Exception
-
doClose
- Throws:
Exception
-