Java Doc for IoFilter.java in  » Net » mina-2.0.0-M1 » org » apache » mina » common » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Net » mina 2.0.0 M1 » org.apache.mina.common 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.apache.mina.common.IoFilter

All known Subclasses:   org.apache.mina.common.IoFilterAdapter,  org.apache.mina.filter.util.ReferenceCountingFilter,
IoFilter
public interface IoFilter (Code)
A filter which intercepts IoHandler events like Servlet filters. Filters can be used for these purposes:
  • Event logging,
  • Performance measurement,
  • Authorization,
  • Overload control,
  • Message transformation (e.g. encryption and decryption, ...),
  • and many more.

Please NEVER implement your filters to wrap IoSession s. Users can cache the reference to the session, which might malfunction if any filters are added or removed later.

The Life Cycle

IoFilter s are activated only when they are inside IoFilterChain .

When you add an IoFilter to an IoFilterChain :

  1. IoFilter.init() is invoked by ReferenceCountingFilter if the filter is added at the first time.
  2. IoFilter.onPreAdd(IoFilterChain,String,NextFilter) is invoked to notify that the filter will be added to the chain.
  3. The filter is added to the chain, and all events and I/O requests pass through the filter from now.
  4. IoFilter.onPostAdd(IoFilterChain,String,NextFilter) is invoked to notify that the filter is added to the chain.
  5. The filter is removed from the chain if IoFilter.onPostAdd(IoFilterChain,String,org.apache.mina.common.IoFilter.NextFilter) threw an exception. IoFilter.destroy() is also invoked by ReferenceCountingFilter if the filter is the last filter which was added to IoFilterChain s.

When you remove an IoFilter from an IoFilterChain :

  1. IoFilter.onPreRemove(IoFilterChain,String,NextFilter) is invoked to notify that the filter will be removed from the chain.
  2. The filter is removed from the chain, and any events and I/O requests don't pass through the filter from now.
  3. IoFilter.onPostRemove(IoFilterChain,String,NextFilter) is invoked to notify that the filter is removed from the chain.
  4. IoFilter.destroy() is invoked by ReferenceCountingFilter if the removed filter was the last one.

author:
   The Apache MINA Project (dev@mina.apache.org)
version:
   $Rev: 591770 $, $Date: 2007-11-04 05:22:44 -0700 (Sun, 04 Nov 2007) $
See Also:   IoFilterAdapter

Inner Class :public interface NextFilter



Method Summary
 voiddestroy()
     Invoked by ReferenceCountingFilter when this filter is not used by any IoFilterChain anymore, so you can destroy shared resources.
 voidexceptionCaught(NextFilter nextFilter, IoSession session, Throwable cause)
     Filters IoHandler.exceptionCaught(IoSessionThrowable) event.
 voidfilterClose(NextFilter nextFilter, IoSession session)
     Filters IoSession.close method invocation.
 voidfilterSetTrafficMask(NextFilter nextFilter, IoSession session, TrafficMask trafficMask)
     Filters IoSession.setTrafficMask(TrafficMask) method invocation.
 voidfilterWrite(NextFilter nextFilter, IoSession session, WriteRequest writeRequest)
     Filters IoSession.write(Object) method invocation.
 voidinit()
     Invoked by ReferenceCountingFilter when this filter is added to a IoFilterChain at the first time, so you can initialize shared resources.
 voidmessageReceived(NextFilter nextFilter, IoSession session, Object message)
     Filters IoHandler.messageReceived(IoSessionObject) event.
 voidmessageSent(NextFilter nextFilter, IoSession session, WriteRequest writeRequest)
     Filters IoHandler.messageSent(IoSessionObject) event.
 voidonPostAdd(IoFilterChain parent, String name, NextFilter nextFilter)
     Invoked 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.
 voidonPostRemove(IoFilterChain parent, String name, NextFilter nextFilter)
     Invoked 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 before IoFilter.destroy() is invoked.
Parameters:
  parent - the parent who called this method
Parameters:
  name - the name assigned to this filter
Parameters:
  nextFilter - the NextFilter for this filter.
 voidonPreAdd(IoFilterChain parent, String name, NextFilter nextFilter)
     Invoked 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.
 voidonPreRemove(IoFilterChain parent, String name, NextFilter nextFilter)
     Invoked 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 before IoFilter.destroy() is invoked.
Parameters:
  parent - the parent who called this method
Parameters:
  name - the name assigned to this filter
Parameters:
  nextFilter - the NextFilter for this filter.
 voidsessionClosed(NextFilter nextFilter, IoSession session)
     Filters IoHandler.sessionClosed(IoSession) event.
 voidsessionCreated(NextFilter nextFilter, IoSession session)
     Filters IoHandler.sessionCreated(IoSession) event.
 voidsessionIdle(NextFilter nextFilter, IoSession session, IdleStatus status)
     Filters IoHandler.sessionIdle(IoSessionIdleStatus) event.
 voidsessionOpened(NextFilter nextFilter, IoSession session)
     Filters IoHandler.sessionOpened(IoSession) event.



Method Detail
destroy
void destroy() throws Exception(Code)
Invoked by ReferenceCountingFilter when this filter is not used by any IoFilterChain anymore, so you can destroy shared resources. Please note that this method is never called if you don't wrap a filter with ReferenceCountingFilter .



exceptionCaught
void exceptionCaught(NextFilter nextFilter, IoSession session, Throwable cause) throws Exception(Code)
Filters IoHandler.exceptionCaught(IoSessionThrowable) event.



filterClose
void filterClose(NextFilter nextFilter, IoSession session) throws Exception(Code)
Filters IoSession.close method invocation.



filterSetTrafficMask
void filterSetTrafficMask(NextFilter nextFilter, IoSession session, TrafficMask trafficMask) throws Exception(Code)
Filters IoSession.setTrafficMask(TrafficMask) method invocation.



filterWrite
void filterWrite(NextFilter nextFilter, IoSession session, WriteRequest writeRequest) throws Exception(Code)
Filters IoSession.write(Object) method invocation.



init
void init() throws Exception(Code)
Invoked by ReferenceCountingFilter when this filter is added to a IoFilterChain at the first time, so you can initialize shared resources. Please note that this method is never called if you don't wrap a filter with ReferenceCountingFilter .



messageReceived
void messageReceived(NextFilter nextFilter, IoSession session, Object message) throws Exception(Code)
Filters IoHandler.messageReceived(IoSessionObject) event.



messageSent
void messageSent(NextFilter nextFilter, IoSession session, WriteRequest writeRequest) throws Exception(Code)
Filters IoHandler.messageSent(IoSessionObject) event.



onPostAdd
void onPostAdd(IoFilterChain parent, String name, NextFilter nextFilter) throws Exception(Code)
Invoked 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 before IoFilter.init() is invoked.
Parameters:
  parent - the parent who called this method
Parameters:
  name - the name assigned to this filter
Parameters:
  nextFilter - the NextFilter for this filter. You can reusethis object until this filter is removed from the chain.



onPostRemove
void onPostRemove(IoFilterChain parent, String name, NextFilter nextFilter) throws Exception(Code)
Invoked 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 before IoFilter.destroy() is invoked.
Parameters:
  parent - the parent who called this method
Parameters:
  name - the name assigned to this filter
Parameters:
  nextFilter - the NextFilter for this filter. You can reusethis object until this filter is removed from the chain.



onPreAdd
void onPreAdd(IoFilterChain parent, String name, NextFilter nextFilter) throws Exception(Code)
Invoked 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 before IoFilter.init() is invoked.
Parameters:
  parent - the parent who called this method
Parameters:
  name - the name assigned to this filter
Parameters:
  nextFilter - the NextFilter for this filter. You can reusethis object until this filter is removed from the chain.



onPreRemove
void onPreRemove(IoFilterChain parent, String name, NextFilter nextFilter) throws Exception(Code)
Invoked 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 before IoFilter.destroy() is invoked.
Parameters:
  parent - the parent who called this method
Parameters:
  name - the name assigned to this filter
Parameters:
  nextFilter - the NextFilter for this filter. You can reusethis object until this filter is removed from the chain.



sessionClosed
void sessionClosed(NextFilter nextFilter, IoSession session) throws Exception(Code)
Filters IoHandler.sessionClosed(IoSession) event.



sessionCreated
void sessionCreated(NextFilter nextFilter, IoSession session) throws Exception(Code)
Filters IoHandler.sessionCreated(IoSession) event.



sessionIdle
void sessionIdle(NextFilter nextFilter, IoSession session, IdleStatus status) throws Exception(Code)
Filters IoHandler.sessionIdle(IoSessionIdleStatus) event.



sessionOpened
void sessionOpened(NextFilter nextFilter, IoSession session) throws Exception(Code)
Filters IoHandler.sessionOpened(IoSession) event.



www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.