Package org.apache.mina.core.filterchain
Interface IoFilterChain
- All Known Implementing Classes:
DefaultIoFilterChain,VmPipeFilterChain
public interface IoFilterChain
A container of
IoFilters that forwards IoHandler events
to the consisting filters and terminal IoHandler sequentially.
Every IoSession has its own IoFilterChain (1-to-1 relationship).-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceRepresents a name-filter pair that anIoFilterChaincontains. -
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.booleanbooleanbooleanvoidfireEvent(FilterEvent event) Fires aIoHandler.event(IoSession, FilterEvent)event.voidfireExceptionCaught(Throwable cause) Fires aIoHandler.exceptionCaught(IoSession, Throwable)event.voidFires aIoSession.closeNow()or aIoSession.closeOnFlush()event.voidfireFilterWrite(WriteRequest writeRequest) Fires aIoSession.write(Object)event.voidFires aIoHandler.inputClosed(IoSession)event.voidfireMessageReceived(Object message) Fires aIoHandler.messageReceived(IoSession, Object)event.voidfireMessageSent(WriteRequest request) Fires aIoHandler.messageSent(IoSession, Object)event.voidFires aIoHandler.sessionClosed(IoSession)event.voidFires aIoHandler.sessionCreated(IoSession)event.voidfireSessionIdle(IdleStatus status) Fires aIoHandler.sessionIdle(IoSession, IdleStatus)event.voidFires aIoHandler.sessionOpened(IoSession)event.Returns theIoFilterwith the specifiedfilterTypein this chain.Returns theIoFilterwith the specifiednamein this chain.getAll()Returns theIoFilterChain.Entrywith the specifiedfilterTypein this chain.Returns theIoFilterChain.Entrywith the specifiednamein this chain.Returns theIoFilterChain.Entrywith the specifiedfilterin this chain.getNextFilter(Class<? extends IoFilter> filterType) Returns theIoFilter.NextFilterof the specifiedfilterTypein this chain.getNextFilter(String name) getNextFilter(IoFilter filter) Returns theIoFilter.NextFilterof the specifiedIoFilterin this chain.Replace the filter of the specified type with the specified new filter.Removes the filter with the specified name from this chain.voidReplace the filter with the specified name with the specified new filter.Replace the filter of the specified type with the specified new filter.Replace the filter with the specified name with the specified new filter.voidReplace the filter with the specified name with the specified new filter.
-
Method Details
-
getSession
IoSession getSession()- Returns:
- the parent
IoSessionof this chain.
-
getEntry
Returns theIoFilterChain.Entrywith the specifiednamein this chain.- Parameters:
name- The filter's name we are looking for- Returns:
nullif there's no such name in this chain
-
getEntry
Returns theIoFilterChain.Entrywith the specifiedfilterin this chain.- Parameters:
filter- The Filter we are looking for- Returns:
nullif there's no such filter in this chain
-
getEntry
Returns theIoFilterChain.Entrywith the specifiedfilterTypein this chain. If there's more than one filter with the specified type, the first match will be chosen.- Parameters:
filterType- The filter class we are looking for- Returns:
nullif there's no such name in this chain
-
get
Returns theIoFilterwith the specifiednamein this chain.- Parameters:
name- the filter's name- Returns:
nullif there's no such name in this chain
-
get
Returns theIoFilterwith the specifiedfilterTypein this chain. If there's more than one filter with the specified type, the first match will be chosen.- Parameters:
filterType- The filter class- Returns:
nullif there's no such name in this chain
-
getNextFilter
- Parameters:
name- The filter's name we want the next filter- Returns:
nullif there's no such name in this chain
-
getNextFilter
Returns theIoFilter.NextFilterof the specifiedIoFilterin this chain.- Parameters:
filter- The filter for which we want the next filter- Returns:
nullif there's no such name in this chain
-
getNextFilter
Returns theIoFilter.NextFilterof the specifiedfilterTypein this chain. If there's more than one filter with the specified type, the first match will be chosen.- Parameters:
filterType- The Filter class for which we want the next filter- Returns:
nullif there's no such name in this chain
-
getAll
List<IoFilterChain.Entry> getAll()- Returns:
- The list of all
IoFilterChain.Entrys this chain contains.
-
getAllReversed
List<IoFilterChain.Entry> getAllReversed()- Returns:
- The reversed list of all
IoFilterChain.Entrys this chain contains.
-
contains
- Parameters:
name- The filter's name we are looking for- Returns:
trueif this chain contains anIoFilterwith the specifiedname.
-
contains
- Parameters:
filter- The filter we are looking for- Returns:
trueif this chain contains the specifiedfilter.
-
contains
- Parameters:
filterType- The filter's class we are looking for- Returns:
trueif this chain contains anIoFilterof the specifiedfilterType.
-
addFirst
Adds the specified filter with the specified name at the beginning of this chain.- Parameters:
name- The filter's namefilter- The filter to add
-
addLast
Adds the specified filter with the specified name at the end of this chain.- Parameters:
name- The filter's namefilter- The filter to add
-
addBefore
Adds the specified filter with the specified name just before the filter whose name isbaseNamein this chain.- Parameters:
baseName- The targeted Filter's namename- The filter's namefilter- The filter to add
-
addAfter
Adds the specified filter with the specified name just after the filter whose name isbaseNamein this chain.- Parameters:
baseName- The targeted Filter's namename- The filter's namefilter- The filter to add
-
replace
Replace the filter with the specified name with the specified new filter.- Parameters:
name- The name of the filter we want to replacenewFilter- The new filter- Returns:
- the old filter
-
replace
Replace the filter with the specified name with the specified new filter.- Parameters:
oldFilter- The filter we want to replacenewFilter- The new filter
-
replace
Replace the filter of the specified type with the specified new filter. If there's more than one filter with the specified type, the first match will be replaced.- Parameters:
oldFilterType- The filter class we want to replacenewFilter- The new filter- Returns:
- The replaced IoFilter
-
remove
Removes the filter with the specified name from this chain.- Parameters:
name- The name of the filter to remove- Returns:
- The removed filter
-
remove
Replace the filter with the specified name with the specified new filter.- Parameters:
filter- The filter to remove
-
remove
Replace the filter of the specified type with the specified new filter. If there's more than one filter with the specified type, the first match will be replaced.- Parameters:
filterType- The filter class to remove- Returns:
- The removed filter
-
clear
Removes all filters added to this chain.- Throws:
Exception- If we weren't able to clear the filters
-
fireSessionCreated
void fireSessionCreated()Fires 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. -
fireSessionOpened
void fireSessionOpened()Fires 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. -
fireSessionClosed
void fireSessionClosed()Fires 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. -
fireSessionIdle
Fires 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.- Parameters:
status- The current status to propagate
-
fireMessageReceived
Fires aIoHandler.messageReceived(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.- Parameters:
message- The received message
-
fireMessageSent
Fires aIoHandler.messageSent(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.- Parameters:
request- The sent request
-
fireExceptionCaught
Fires 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.- Parameters:
cause- The exception cause
-
fireInputClosed
void fireInputClosed()Fires aIoHandler.inputClosed(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. -
fireFilterWrite
Fires 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.- Parameters:
writeRequest- The message to write
-
fireFilterClose
void fireFilterClose()Fires aIoSession.closeNow()or aIoSession.closeOnFlush()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. -
fireEvent
Fires aIoHandler.event(IoSession, FilterEvent)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.- Parameters:
event- The specific event being fired
-