I have an old seam application that i need to migrate.
My application uses a lot of conservations and i'm a bit dissappointed with CDI conservations (not as powerful as seam ones).
I need to pass (parameters, entities, ...) from one conversation to the old or to the new one.
Query Page (Conversation 1) => Choose Element => Edit Page (Conversation 2 retrieve entity parameter and merge with current persistent context)
In seam, the pseudo algorithm was :
// Get Parameters From current context
Entity entity1 = ...;
// Pass parameters to the new conversation
How can i do that in CDI ? I have no access to the old conversation.
I try to do in a jsf action:
String contextId = FacesContext.getCurrentInstance().getExternalContext().getInitParameter(Container.CONTEXT_ID_KEY);
LazyHttpConversationContextImpl httpConversationContext = (LazyHttpConversationContextImpl) Container.instance(contextId).deploymentManager().instance().select(Context.class).select(HttpConversationContext.class).get();
String newConversationId = conversation.getId();
I manage to get rid of warnings :
WELD-000335: Conversation context is already active, most likely it was not cleaned up properly during previous request processing: HttpServletRequestImpl [ POST /xxxx/conversation1.xhtml ]
I can retrieve for basic properties the value used in the previous conversation, but i have got a lot of warnings and i'm not sure that's a good solution at the end.
Maybe should i need to create a custom CDI scope ?
Thanks for sharing your own experience