Message contexts and Spring Webflow conversation scope

Brent Putman putmanb at georgetown.edu
Thu Feb 28 12:47:25 EST 2013


On 2/27/13 9:34 PM, Brent Putman wrote:
>
> I think it was something like that that originally triggered the alarm
> when I looked at this a long time ago.  The "generally" there is a
> little vague to an uninformed reader, but I think it's basically
> consistent with what Scott said earlier: it's really actually a function
> of what the container impl does with HttpSession.

> Yeah, there's only 1 of each.  SessionBindingConversationManager
> implements ConversationManager, and ContainedConversation implements
> Conversation.
>
> The latter is just a container for the attributes and implements
> Serializable (implying that any attributes you store must also
> implement), 
>


Just for the record: In thinking about this more, I realized that I
think that Webflow's default requirement for Serializable is a little
stronger than what I wound up saying.  All the stuff re: how in general
HttpSession not necessarily requiring Serializable per the servlet spec
is true.  However, the thing that actually wraps the scope attributes in
Webflow is the ContainedConversation.  And it *does* implement
java.io.Serializable.  So in order for it to be able to uphold that
contract, anything added to it would have to also be Serializable (it
has no writeObject/readObject and no allowance for custom external
serialization, etc).

Of course, that behavioral contract only gets "enforced" if something
(e.g. servlet container) actually tries to serialize a given instance. 
It's a philosophical question I guess as to whether stuffing
non-serializable members into a Serializable container/collection class
is right or wrong.  As in: "Did I really break the law if no one was
around to arrest me?".   Personally I say it probably is wrong. 




More information about the dev mailing list