8.4. Requiring a long-running conversation

Certain pages are only relevant in the context of a long-running conversation. One way to restrict access to such a page is to make the existence of a long-running conversation a prerequisite to the page being rendered.
Seam's page descriptor has a conversation-required attribute, which lets you indicate that the current conversation must be long-running (or nested) in order for a page to be rendered, like so:
<page view-id="/book.xhtml" conversation-required="true"/>

Note

At present, you cannot indicate which long-running conversation is required. However, you can build on the basic authorization by checking whether a specific value is also present in the conversation within a page action.
When Seam determines that the page has been requested while no long-running conversation is present, it performs the following actions:
  • raises a contextual event called org.jboss.seam.noConversation
  • registers a warning status message with the bundle key, org.jboss.seam.NoConversation
  • redirects the user to an alternative page, if defined in the no-conversation-view-id attribute, like so:
    <pages no-conversation-view-id="/main.xhtml"/>
    This page will be used across the entire application; at present, multiple alternative pages cannot be defined.