3.2.1.1. ConversationState and ConversationRegistry

The ConversationState can be stored

One or the other, or both methods can be used to set/retrieve the state at runtime. The most important thing is that they should be complementary, i.e. make sure that the conversation state is set before you try to use it.

Local Thread Variable: Storing the ConversationState in a static local thread variable makes it possible to represent it as a context (current user's state).

ConversationState.setCurrent(conversationState);

....
ConversationState.getCurrent();

Key-Value way

If you store the ConversationState inside the ConversationRegistry component as a set of key-value pairs, the session key is an arbitrary String (user name, ticket id, httpSessionId etc).

conversationRegistry.register("key", conversationState); 

...
conversationRegistry.getState("key");

ConversationRegistry The ConversationRegistry is a mandatory component deployed into eXo Container as following:


<component>
    <type>org.exoplatform.services.security.ConversationRegistry</type>
</component>
Copyright ©2012. All rights reserved. eXo Platform SAS