Java Reference
In-Depth Information
Figure 12.2. Conversation scope versus session and application
The easiest way to think of a conversation is to look at how users interact with web applic-
ations using the current breed of web browsers. A bidder on ActionBazaar might open two
tabs for viewing two items that they're interested in bidding on. Although they're viewing
two separate items on two tabs, as far as ActionBazaar is concerned there's one session for
this user. As a result, the current item the user is viewing can't be tracked using the user's
session because the session is shared between the browser tabs. Imagine what would hap-
pen if the user were viewing a kayak on one tab and then opened up another tab to view
a five-carat diamond. When the user switched back to the kayak and clicked Place Bid,
there would be panic if the confirmation page showed a bid for the five-carat diamond. The
concept of a conversation addresses this problem.
A bean is marked as belonging to a conversation by adding the @ConversationS-
coped annotation to the bean definition. By default, a conversation is associated with the
current request scope and is terminated when the current request is destroyed. To make a
conversation survive beyond the current request, it must be promoted to a long-running
conversation . The promotion to a long-running conversation is done programmatically. For
 
Search WWH ::




Custom Search