|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.mina.common.IoFilterAdapter
org.apache.mina.filter.util.WriteRequestFilter
org.apache.mina.filter.reqres.RequestResponseFilter
public class RequestResponseFilter
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.apache.mina.common.IoFilter |
---|
IoFilter.NextFilter |
Constructor Summary | |
---|---|
RequestResponseFilter(ResponseInspectorFactory responseInspectorFactory,
ScheduledExecutorService timeoutScheduler)
|
|
RequestResponseFilter(ResponseInspector responseInspector,
ScheduledExecutorService timeoutScheduler)
|
Method Summary | |
---|---|
protected Map<Object,Request> |
createRequestStore(IoSession session)
Returns a Map which stores messageId -Request
pairs whose Response s are not received yet. |
protected Set<Request> |
createUnrespondedRequestStore(IoSession session)
Returns a Set which stores Request whose
Response s are not received yet. |
protected void |
destroyRequestStore(Map<Object,Request> requestStore)
Releases any resources related with the Map created by
createRequestStore(IoSession) . |
protected void |
destroyUnrespondedRequestStore(Set<Request> unrespondedRequestStore)
Releases any resources related with the Set created by
createUnrespondedRequestStore(IoSession) . |
protected Object |
doFilterWrite(IoFilter.NextFilter nextFilter,
IoSession session,
WriteRequest writeRequest)
|
void |
messageReceived(IoFilter.NextFilter nextFilter,
IoSession session,
Object message)
Filters IoHandler.messageReceived(IoSession,Object)
event. |
void |
onPostRemove(IoFilterChain parent,
String name,
IoFilter.NextFilter nextFilter)
Invoked after this filter is removed from the specified parent. |
void |
onPreAdd(IoFilterChain parent,
String name,
IoFilter.NextFilter nextFilter)
Invoked before this filter is added to the specified parent. |
void |
sessionClosed(IoFilter.NextFilter nextFilter,
IoSession session)
Filters IoHandler.sessionClosed(IoSession) event. |
Methods inherited from class org.apache.mina.filter.util.WriteRequestFilter |
---|
exceptionCaught, filterWrite, messageSent |
Methods inherited from class org.apache.mina.common.IoFilterAdapter |
---|
destroy, filterClose, filterSetTrafficMask, init, onPostAdd, onPreRemove, sessionCreated, sessionIdle, sessionOpened |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RequestResponseFilter(ResponseInspector responseInspector, ScheduledExecutorService timeoutScheduler)
public RequestResponseFilter(ResponseInspectorFactory responseInspectorFactory, ScheduledExecutorService timeoutScheduler)
Method Detail |
---|
public void onPreAdd(IoFilterChain parent, String name, IoFilter.NextFilter nextFilter) throws Exception
IoFilter
IoFilter.init()
is invoked.
onPreAdd
in interface IoFilter
onPreAdd
in class IoFilterAdapter
parent
- the parent who called this methodname
- the name assigned to this filternextFilter
- the IoFilter.NextFilter
for this filter. You can reuse
this object until this filter is removed from the chain.
Exception
public void onPostRemove(IoFilterChain parent, String name, IoFilter.NextFilter nextFilter) throws Exception
IoFilter
IoFilter.destroy()
is invoked.
onPostRemove
in interface IoFilter
onPostRemove
in class IoFilterAdapter
parent
- the parent who called this methodname
- the name assigned to this filternextFilter
- the IoFilter.NextFilter
for this filter. You can reuse
this object until this filter is removed from the chain.
Exception
public void messageReceived(IoFilter.NextFilter nextFilter, IoSession session, Object message) throws Exception
IoFilter
IoHandler.messageReceived(IoSession,Object)
event.
messageReceived
in interface IoFilter
messageReceived
in class IoFilterAdapter
Exception
protected Object doFilterWrite(IoFilter.NextFilter nextFilter, IoSession session, WriteRequest writeRequest) throws Exception
doFilterWrite
in class WriteRequestFilter
Exception
public void sessionClosed(IoFilter.NextFilter nextFilter, IoSession session) throws Exception
IoFilter
IoHandler.sessionClosed(IoSession)
event.
sessionClosed
in interface IoFilter
sessionClosed
in class IoFilterAdapter
Exception
protected Map<Object,Request> createRequestStore(IoSession session)
Map
which stores messageId
-Request
pairs whose Response
s are not received yet. Please override
this method if you need to use other Map
implementation
than the default one (HashMap
).
protected Set<Request> createUnrespondedRequestStore(IoSession session)
Set
which stores Request
whose
Response
s are not received yet. Please override
this method if you need to use other Set
implementation
than the default one (LinkedHashSet
). Please note that
the Iterator
of the returned Set
have to iterate
its elements in the insertion order to ensure that
RequestTimeoutException
s are thrown in the order which
Request
s were written. If you don't need to guarantee
the order of thrown exceptions, any Set
implementation
can be used.
protected void destroyRequestStore(Map<Object,Request> requestStore)
Map
created by
createRequestStore(IoSession)
. This method is useful
if you override createRequestStore(IoSession)
.
requestStore
- what you returned in createRequestStore(IoSession)
protected void destroyUnrespondedRequestStore(Set<Request> unrespondedRequestStore)
Set
created by
createUnrespondedRequestStore(IoSession)
. This method is
useful if you override createUnrespondedRequestStore(IoSession)
.
unrespondedRequestStore
- what you returned in createUnrespondedRequestStore(IoSession)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |