Class CommonEventFilter
java.lang.Object
org.apache.mina.core.filterchain.IoFilterAdapter
org.apache.mina.filter.util.CommonEventFilter
- All Implemented Interfaces:
IoFilter
- Direct Known Subclasses:
MdcInjectionFilter
Extend this class when you want to create a filter that
wraps the same logic around all 11 IoEvents
-
Nested Class Summary
Nested classes/interfaces inherited from interface IoFilter
IoFilter.NextFilter -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidevent(IoFilter.NextFilter nextFilter, IoSession session, FilterEvent event) Propagate an event up to theIoHandlerfinal voidexceptionCaught(IoFilter.NextFilter nextFilter, IoSession session, Throwable cause) FiltersIoHandler.exceptionCaught(IoSession,Throwable)event.protected abstract voidfilter(IoFilterEvent event) final voidfilterClose(IoFilter.NextFilter nextFilter, IoSession session) FiltersIoSession.closeNow()or aIoSession.closeOnFlush()method invocations.final voidfilterWrite(IoFilter.NextFilter nextFilter, IoSession session, WriteRequest writeRequest) FiltersIoSession.write(Object)method invocation.voidinputClosed(IoFilter.NextFilter nextFilter, IoSession session) FiltersIoHandler.inputClosed(IoSession)event.final voidmessageReceived(IoFilter.NextFilter nextFilter, IoSession session, Object message) FiltersIoHandler.messageReceived(IoSession,Object)event.final voidmessageSent(IoFilter.NextFilter nextFilter, IoSession session, WriteRequest writeRequest) FiltersIoHandler.messageSent(IoSession,Object)event.final voidsessionClosed(IoFilter.NextFilter nextFilter, IoSession session) FiltersIoHandler.sessionClosed(IoSession)event.final voidsessionCreated(IoFilter.NextFilter nextFilter, IoSession session) FiltersIoHandler.sessionCreated(IoSession)event.final voidsessionIdle(IoFilter.NextFilter nextFilter, IoSession session, IdleStatus status) FiltersIoHandler.sessionIdle(IoSession,IdleStatus)event.final voidsessionOpened(IoFilter.NextFilter nextFilter, IoSession session) FiltersIoHandler.sessionOpened(IoSession)event.Methods inherited from class IoFilterAdapter
destroy, init, onPostAdd, onPostRemove, onPreAdd, onPreRemove, toString
-
Constructor Details
-
CommonEventFilter
public CommonEventFilter()
-
-
Method Details
-
filter
- Throws:
Exception
-
event
public void event(IoFilter.NextFilter nextFilter, IoSession session, FilterEvent event) throws Exception Propagate an event up to theIoHandler- Specified by:
eventin interfaceIoFilter- Overrides:
eventin classIoFilterAdapter- Parameters:
nextFilter- theIoFilter.NextFilterfor this filter. You can reuse this object until this filter is removed from the chain.session- TheIoSessionwhich has to process this invocationevent- The event to propagate- Throws:
Exception- If an error occurred while processing the event
-
exceptionCaught
public final void exceptionCaught(IoFilter.NextFilter nextFilter, IoSession session, Throwable cause) throws Exception FiltersIoHandler.exceptionCaught(IoSession,Throwable)event.- Specified by:
exceptionCaughtin interfaceIoFilter- Overrides:
exceptionCaughtin classIoFilterAdapter- Parameters:
nextFilter- theIoFilter.NextFilterfor this filter. You can reuse this object until this filter is removed from the chain.session- TheIoSessionwhich has received this eventcause- The exception that cause this event to be received- Throws:
Exception- If an error occurred while processing the event
-
filterClose
FiltersIoSession.closeNow()or aIoSession.closeOnFlush()method invocations.- Specified by:
filterClosein interfaceIoFilter- Overrides:
filterClosein classIoFilterAdapter- Parameters:
nextFilter- theIoFilter.NextFilterfor this filter. You can reuse this object until this filter is removed from the chain.session- TheIoSessionwhich has to process this method invocation- Throws:
Exception- If an error occurred while processing the event
-
filterWrite
public final void filterWrite(IoFilter.NextFilter nextFilter, IoSession session, WriteRequest writeRequest) throws Exception FiltersIoSession.write(Object)method invocation.- Specified by:
filterWritein interfaceIoFilter- Overrides:
filterWritein classIoFilterAdapter- Parameters:
nextFilter- theIoFilter.NextFilterfor this filter. You can reuse this object until this filter is removed from the chain.session- TheIoSessionwhich has to process this invocationwriteRequest- TheWriteRequestto process- Throws:
Exception- If an error occurred while processing the event
-
inputClosed
FiltersIoHandler.inputClosed(IoSession)event.- Specified by:
inputClosedin interfaceIoFilter- Overrides:
inputClosedin classIoFilterAdapter- Parameters:
nextFilter- theIoFilter.NextFilterfor this filter. You can reuse this object until this filter is removed from the chain.session- TheIoSessionwhich has received this event- Throws:
Exception- If an error occurred while processing the event
-
messageReceived
public final void messageReceived(IoFilter.NextFilter nextFilter, IoSession session, Object message) throws Exception FiltersIoHandler.messageReceived(IoSession,Object)event.- Specified by:
messageReceivedin interfaceIoFilter- Overrides:
messageReceivedin classIoFilterAdapter- Parameters:
nextFilter- theIoFilter.NextFilterfor this filter. You can reuse this object until this filter is removed from the chain.session- TheIoSessionwhich has received this eventmessage- The received message- Throws:
Exception- If an error occurred while processing the event
-
messageSent
public final void messageSent(IoFilter.NextFilter nextFilter, IoSession session, WriteRequest writeRequest) throws Exception FiltersIoHandler.messageSent(IoSession,Object)event.- Specified by:
messageSentin interfaceIoFilter- Overrides:
messageSentin classIoFilterAdapter- Parameters:
nextFilter- theIoFilter.NextFilterfor this filter. You can reuse this object until this filter is removed from the chain.session- TheIoSessionwhich has received this eventwriteRequest- TheWriteRequestthat contains the sent message- Throws:
Exception- If an error occurred while processing the event
-
sessionClosed
FiltersIoHandler.sessionClosed(IoSession)event.- Specified by:
sessionClosedin interfaceIoFilter- Overrides:
sessionClosedin classIoFilterAdapter- Parameters:
nextFilter- theIoFilter.NextFilterfor this filter. You can reuse this object until this filter is removed from the chain.session- TheIoSessionwhich has received this event- Throws:
Exception- If an error occurred while processing the event
-
sessionCreated
public final void sessionCreated(IoFilter.NextFilter nextFilter, IoSession session) throws Exception FiltersIoHandler.sessionCreated(IoSession)event.- Specified by:
sessionCreatedin interfaceIoFilter- Overrides:
sessionCreatedin classIoFilterAdapter- Parameters:
nextFilter- theIoFilter.NextFilterfor this filter. You can reuse this object until this filter is removed from the chain.session- TheIoSessionwhich has received this event- Throws:
Exception- If an error occurred while processing the event
-
sessionIdle
public final void sessionIdle(IoFilter.NextFilter nextFilter, IoSession session, IdleStatus status) throws Exception FiltersIoHandler.sessionIdle(IoSession,IdleStatus)event.- Specified by:
sessionIdlein interfaceIoFilter- Overrides:
sessionIdlein classIoFilterAdapter- Parameters:
nextFilter- theIoFilter.NextFilterfor this filter. You can reuse this object until this filter is removed from the chain.session- TheIoSessionwhich has received this eventstatus- TheIdleStatustype- Throws:
Exception- If an error occurred while processing the event
-
sessionOpened
FiltersIoHandler.sessionOpened(IoSession)event.- Specified by:
sessionOpenedin interfaceIoFilter- Overrides:
sessionOpenedin classIoFilterAdapter- Parameters:
nextFilter- theIoFilter.NextFilterfor this filter. You can reuse this object until this filter is removed from the chain.session- TheIoSessionwhich has received this event- Throws:
Exception- If an error occurred while processing the event
-