[jboss-cvs] jboss-seam/src/main/org/jboss/seam/core ...
Gavin King
gavin.king at jboss.com
Sat May 19 12:44:52 EDT 2007
User: gavin
Date: 07/05/19 12:44:52
Modified: src/main/org/jboss/seam/core Pages.java
Log:
add restore permission for pages
Revision Changes Path
1.115 +49 -5 jboss-seam/src/main/org/jboss/seam/core/Pages.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Pages.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/core/Pages.java,v
retrieving revision 1.114
retrieving revision 1.115
diff -u -b -r1.114 -r1.115
--- Pages.java 1 May 2007 17:48:56 -0000 1.114
+++ Pages.java 19 May 2007 16:44:52 -0000 1.115
@@ -241,11 +241,13 @@
}
/**
- * Call page actions, 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
+ * 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.
*/
- public boolean enterPage(FacesContext facesContext)
+ public boolean preRenderPage(FacesContext facesContext)
{
boolean result = false;
String viewId = getViewId(facesContext);
@@ -275,7 +277,7 @@
}
else
{
- result = page.enter(facesContext) || result;
+ result = page.preRender(facesContext) || result;
}
}
@@ -285,6 +287,48 @@
return result;
}
+ /**
+ * 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.
+ */
+ public void postRestorePage(FacesContext facesContext)
+ {
+ String viewId = getViewId(facesContext);
+
+ for ( Page page: getPageStack(viewId) )
+ {
+ if ( isNoConversationRedirectRequired(page) )
+ {
+ redirectToNoConversationView();
+ return;
+ }
+ else if ( isLoginRedirectRequired(viewId, page) )
+ {
+ redirectToLoginView();
+ return;
+ }
+ else
+ {
+ //if we are about to proceed to the action
+ //phase, check the permission.
+ if ( !facesContext.getRenderResponse() )
+ {
+ page.postRestore(facesContext);
+ }
+ }
+ }
+
+ //apply page parameters to the model
+ //(after checking permissions)
+ if ( !facesContext.getRenderResponse() )
+ {
+ Pages.instance().applyViewRootValues(facesContext);
+ }
+ Pages.instance().applyRequestParameterValues(facesContext);
+ }
+
private boolean isNoConversationRedirectRequired(Page page)
{
return page.isConversationRequired() &&
More information about the jboss-cvs-commits
mailing list