Fwd: [webbeans-dev] conversation context lifecycle

Gavin King gavin.king at gmail.com
Sat May 30 16:31:37 EDT 2009


Thoughts?

---------- Forwarded message ----------
From: Gavin King <gavin.king at gmail.com>
Date: Sat, May 30, 2009 at 1:31 PM
Subject: Re: [webbeans-dev] conversation context lifecycle
To: Java Community Process JSR #299 Expert List <JSR-299-EG at jcp.org>


On Sat, May 30, 2009 at 12:43 PM, Gavin King <gavin.king at gmail.com> wrote:

>> Looking at the Conversation public API I don't see any programmatic
>> way to restore a conversation.  Perhaps we should add such an API?
>
> Ugh, I really didn't want to go there in this release, though it
> would, very clearly, be a very useful feature.
>
> If we were going to go there, the way I would do it is to say that the
> conversation context is defined for all servlet requests, but it is by
> default transient. The container would be required to call back to
> Extensions to obtain a conversation id.

Actually, upon reflection, I think we need to do this :-/

Because even in JSF, we want a way to customize the mechanism for
conversation propagation.

So we could say that an Extension may optionally implement this interface:

   public interface ConversationExtension {
       String getConversationId(HttpServletRequest request,
ServletContext context);
   }

And say that before any Filter is called, the container calls all
ConversationExtensions looking for a conversation id, and if it finds
one, restores the conversation.

Alternatively, we could say that the conversation is only restored
*after* all ServletFilters have been called, and say that the
container looks in a specially-named request attribute, for example
"javax.contexts.spi.conversationId". Then we would not need a special
interface, and any servlet filter could do conversation management.
This seems more elegant, but means you don't get a conversation
context in your filters.

WDYT?

--
Gavin King
gavin.king at gmail.com
http://in.relation.to/Bloggers/Gavin
http://hibernate.org
http://seamframework.org



-- 
Gavin King
gavin.king at gmail.com
http://in.relation.to/Bloggers/Gavin
http://hibernate.org
http://seamframework.org




More information about the weld-dev mailing list