org.jboss.seam.navigation
Class Pages

java.lang.Object
  extended by org.jboss.seam.navigation.Pages

@Scope(value=APPLICATION)
@BypassInterceptors
@Name(value="org.jboss.seam.navigation.pages")
@Startup
@Install(precedence=0,
         classDependencies="javax.faces.context.FacesContext")
public class Pages
extends Object

Holds metadata for pages defined in pages.xml, including page actions and page descriptions.

Author:
Gavin King

Constructor Summary
Pages()
           
 
Method Summary
 String encodePageParameters(javax.faces.context.FacesContext facesContext, String url, String viewId)
          Encode page parameters into a URL
 String encodePageParameters(javax.faces.context.FacesContext facesContext, String url, String viewId, Set<String> overridden)
          Encode page parameters into a URL
 String encodeScheme(String viewId, javax.faces.context.FacesContext context, String url)
           
 ConversationIdParameter getConversationIdParameter(String conversationName)
           
static String getCurrentViewId()
           
static Map<String,javax.faces.application.FacesMessage.Severity> getFacesMessageValuesMap()
           
 Integer getHttpPort()
           
 Integer getHttpsPort()
           
 String getLoginViewId()
          The global setting for login-viewid.
 String getNoConversationViewId()
          The global setting for no-conversation-viewid.
 String getNoConversationViewId(String viewId)
          Search for a defined no-conversation-view-id, beginning with the most specific view id, then wildcarded view ids, and finally the global setting
 Page getPage(String viewId)
          Get the Page object for the given view id.
protected  List<Page> getPageStack(String viewId)
          Get the stack of Page objects, from least specific to most specific, that match the given view id.
static String getRequestScheme(javax.faces.context.FacesContext facesContext)
           
 List<ResourceBundle> getResourceBundles(String viewId)
          Build a list of page-scoped resource bundles, from most specific view id, to most general.
 String[] getResources()
           
 String getScheme(String viewId)
           
 Map<String,Object> getStringValuesFromModel(javax.faces.context.FacesContext facesContext, String viewId, Set<String> overridden)
          Get the values of any page parameters by evaluating the value bindings against the model and converting to String.
 Map<String,Object> getStringValuesFromPageContext(javax.faces.context.FacesContext facesContext)
          Get the page parameter values that were passed in the original request from the PAGE context
static String getSuffix()
           
 Integer getTimeout(String viewId)
          Search for a defined conversation timeout, beginning with the most specific view id, then wildcarded view ids, and finally the global setting from Manager
static String getViewId(javax.faces.context.FacesContext facesContext)
           
static void handleOutcome(javax.faces.context.FacesContext facesContext, String outcome, String fromAction)
          Call the JSF navigation handler
 void initialize()
           
static Pages instance()
           
static boolean isDebugPage()
           
 boolean isLoginRedirectRequired(javax.faces.context.FacesContext facesContext)
          Check if a login redirect is required for the current FacesContext
 boolean navigate(javax.faces.context.FacesContext context, String actionExpression, String actionOutcomeValue)
          Run any navigation rule defined in pages.xml
protected  void noConversation()
           
protected  void notLoggedIn()
           
 void postRestore(javax.faces.context.FacesContext facesContext)
          Check permissions and validate the existence of a conversation for pages which require a long-running conversation, starting with the most general view id, ending at the most specific.
 boolean preRender(javax.faces.context.FacesContext facesContext)
          Call page actions, check permissions and validate the existence of a conversation for pages which require a long-running conversation, starting with the most general view id, ending at the most specific.
 void redirectToLoginView()
           
 void redirectToNoConversationView()
           
 void setHttpPort(Integer httpPort)
           
 void setHttpsPort(Integer httpsPort)
           
 void setLoginViewId(String loginViewId)
           
 void setNoConversationViewId(String noConversationViewId)
           
 void setResources(String[] resources)
           
static String toString(Object returnValue)
           
 void updateStringValuesInPageContextUsingModel(javax.faces.context.FacesContext facesContext)
          Update the page parameter values stored in the PAGE context with the current values of the mapped attributes of the model
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Pages

public Pages()
Method Detail

initialize

@Create
public void initialize()

navigate

public boolean navigate(javax.faces.context.FacesContext context,
                        String actionExpression,
                        String actionOutcomeValue)
Run any navigation rule defined in pages.xml

Parameters:
actionExpression - the action method binding expression
actionOutcomeValue - the outcome of the action method
Returns:
true if a navigation rule was found

getPage

public Page getPage(String viewId)
Get the Page object for the given view id.

Parameters:
viewId - a JSF view id

getPageStack

protected List<Page> getPageStack(String viewId)
Get the stack of Page objects, from least specific to most specific, that match the given view id.

Parameters:
viewId - a JSF view id

preRender

public boolean preRender(javax.faces.context.FacesContext facesContext)
Call page actions, check permissions and validate the existence of a conversation for pages which require a long-running conversation, starting with the most general view id, ending at the most specific. Also perform redirection to the required scheme if necessary.


postRestore

public void postRestore(javax.faces.context.FacesContext facesContext)
Check permissions and validate the existence of a conversation for pages which require a long-running conversation, starting with the most general view id, ending at the most specific. Finally apply page parameters to the model.


isLoginRedirectRequired

public boolean isLoginRedirectRequired(javax.faces.context.FacesContext facesContext)
Check if a login redirect is required for the current FacesContext

Parameters:
facesContext - The faces context containing the view ID
Returns:
boolean Returns true if a login redirect is required

getRequestScheme

public static String getRequestScheme(javax.faces.context.FacesContext facesContext)

encodeScheme

public String encodeScheme(String viewId,
                           javax.faces.context.FacesContext context,
                           String url)

redirectToLoginView

public void redirectToLoginView()

redirectToNoConversationView

public void redirectToNoConversationView()

getScheme

public String getScheme(String viewId)

noConversation

protected void noConversation()

notLoggedIn

protected void notLoggedIn()

toString

public static String toString(Object returnValue)

handleOutcome

public static void handleOutcome(javax.faces.context.FacesContext facesContext,
                                 String outcome,
                                 String fromAction)
Call the JSF navigation handler


instance

public static Pages instance()

getResourceBundles

public List<ResourceBundle> getResourceBundles(String viewId)
Build a list of page-scoped resource bundles, from most specific view id, to most general.


getStringValuesFromModel

public Map<String,Object> getStringValuesFromModel(javax.faces.context.FacesContext facesContext,
                                                   String viewId,
                                                   Set<String> overridden)
Get the values of any page parameters by evaluating the value bindings against the model and converting to String.

Parameters:
viewId - the JSF view id
overridden - excluded parameters
Returns:
a map of page parameter name to String value

getStringValuesFromPageContext

public Map<String,Object> getStringValuesFromPageContext(javax.faces.context.FacesContext facesContext)
Get the page parameter values that were passed in the original request from the PAGE context


updateStringValuesInPageContextUsingModel

public void updateStringValuesInPageContextUsingModel(javax.faces.context.FacesContext facesContext)
Update the page parameter values stored in the PAGE context with the current values of the mapped attributes of the model


encodePageParameters

public String encodePageParameters(javax.faces.context.FacesContext facesContext,
                                   String url,
                                   String viewId)
Encode page parameters into a URL

Parameters:
url - the base URL
viewId - the JSF view id of the page
Returns:
the URL with parameters appended

encodePageParameters

public String encodePageParameters(javax.faces.context.FacesContext facesContext,
                                   String url,
                                   String viewId,
                                   Set<String> overridden)
Encode page parameters into a URL

Parameters:
url - the base URL
viewId - the JSF view id of the page
overridden - excluded parameters
Returns:
the URL with parameters appended

getNoConversationViewId

public String getNoConversationViewId(String viewId)
Search for a defined no-conversation-view-id, beginning with the most specific view id, then wildcarded view ids, and finally the global setting


getTimeout

public Integer getTimeout(String viewId)
Search for a defined conversation timeout, beginning with the most specific view id, then wildcarded view ids, and finally the global setting from Manager


getSuffix

public static String getSuffix()

getConversationIdParameter

public ConversationIdParameter getConversationIdParameter(String conversationName)

getFacesMessageValuesMap

public static Map<String,javax.faces.application.FacesMessage.Severity> getFacesMessageValuesMap()

getNoConversationViewId

public String getNoConversationViewId()
The global setting for no-conversation-viewid.

Returns:
a JSF view id

setNoConversationViewId

public void setNoConversationViewId(String noConversationViewId)

getLoginViewId

public String getLoginViewId()
The global setting for login-viewid.

Returns:
a JSF view id

setLoginViewId

public void setLoginViewId(String loginViewId)

getCurrentViewId

public static String getCurrentViewId()

getViewId

public static String getViewId(javax.faces.context.FacesContext facesContext)

getHttpPort

public Integer getHttpPort()

setHttpPort

public void setHttpPort(Integer httpPort)

getHttpsPort

public Integer getHttpsPort()

setHttpsPort

public void setHttpsPort(Integer httpsPort)

getResources

public String[] getResources()

setResources

public void setResources(String[] resources)

isDebugPage

public static boolean isDebugPage()