9.4. Requiring a long-running conversation
Some pages are relevant only 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 allows you to indicate that the current conversation must be long-running (or nested) for a page to be rendered, as:
<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 when 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-idattribute, as:<pages no-conversation-view-id="/main.xhtml"/>
This page will be used across the entire application; at present, multiple alternative pages cannot be defined.