// currently encoded into each url (see ConversationRequestParameterProvider).
// So avoiding creating it here is probably not very important..
//
// Note that ConversationManager.getInstance requires the FrameworkAdapter
// to be initialized.
ConversationManager manager = ConversationManager.getInstance(false);
if (manager != null)
{
// Fetch a context for this request if one already exists, and lock it
// so that concurrent requests that affect this context block until
// this request is complete. Not doing so can cause races for resources
// within the current context, such as beans or PersistenceContexts.
//
// But if the request did not explicitly specify a contextId then we
// do NOT create a new context at this point. Doing so would create
// contexts for things like Weblet resource requests, and that context
// would then just hang around unused until it times out!
//
// Note that a request that does not explicitly specify a contextId
// might have one created for it later in the request, eg when an
// orchestra-scoped bean is accessed. However this is not a race
// condition because nothing else can refer to that newly created
// id until the response for this request has been sent back to the
// client browser.
context = manager.getCurrentRootConversationContext();
if (context != null)
{
try
{
if (log.isDebugEnabled())