Chapter 4 - SessionPage edited by Emmanuel LécharnyChanges (3)
Full ContentIntroductionThe Session is at the heart of MINA : every time a client connects to the server, a new session is created, and will be kept in memory until the client is disconnected. A session is used to store persistent informations about the connection, plus any kind of information the server might need to use during the request processing, and eventually during the whole session life. Session stateA session has a state, which will evolve during time.
ConfigurationMany different parameters can be set for a specific session :
plus other configuration, depending on the transport type used (see Chapter 6 - Transports) User-defined attributesIt might be necessary to store some data which may be used later. This is done using the dedicated data structure associated which each session. This is a key-value association, which can store any type of data the developer might want to keep remanent. For instance, if you want to track the number of request a user has sent since the session has been created, it's easy to store it into this map: just create a key that will be associated with this value. ... int counterValue = session.getAttribute( "counter" ); session.setAttribute( "counter", counterValue + 1 ); ... Filter chain
and many other useful informations. HandlerLast, not least, a session is attached to a Handler, in charge of dispatching the messages to your application. This handler will also send pack response by using the session, simply by calling the write() method : ... session.write( <your message> ); ...
Change Notification Preferences
View Online
|
View Changes
|
Add Comment
|
- [CONF] Apache MINA > Chapter 4 - Session confluence
- [CONF] Apache MINA > Chapter 4 - Session confluence
- [CONF] Apache MINA > Chapter 4 - Session confluence
- [CONF] Apache MINA > Chapter 4 - Session confluence
- [CONF] Apache MINA > Chapter 4 - Session confluence
- [CONF] Apache MINA > Chapter 4 - Session confluence
- [CONF] Apache MINA > Chapter 4 - Session confluence
- [CONF] Apache MINA > Chapter 4 - Session confluence
- [CONF] Apache MINA > Chapter 4 - Session confluence
- [CONF] Apache MINA > Chapter 4 - Session confluence