[jboss-cvs] jboss-seam/src/main/org/jboss/seam/core ...
Gavin King
gavin.king at jboss.com
Wed Feb 7 12:12:31 EST 2007
User: gavin
Date: 07/02/07 12:12:31
Modified: src/main/org/jboss/seam/core Pages.java Redirect.java
Log:
JBSEAM-773 login redirects
Revision Changes Path
1.80 +22 -0 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.79
retrieving revision 1.80
diff -u -b -r1.79 -r1.80
--- Pages.java 5 Feb 2007 06:45:37 -0000 1.79
+++ Pages.java 7 Feb 2007 17:12:31 -0000 1.80
@@ -397,6 +397,7 @@
}
return parameters;
}
+
/**
* Get the current value of a page parameter, looking in the page context
* if there is no value binding
@@ -413,6 +414,7 @@
return pageParameter.getValueFromModel(facesContext);
}
}
+
/**
* Apply any page parameters passed as parameter values to the model.
*/
@@ -441,6 +443,7 @@
}
}
}
+
/**
* Apply any page parameters passed as view root attributes to the model.
*/
@@ -463,6 +466,25 @@
}
}
}
+
+ public Map<String, Object> getViewRootValues(FacesContext facesContext)
+ {
+ Map<String, Object> parameters = new HashMap<String, Object>();
+ String viewId = facesContext.getViewRoot().getViewId();
+ for ( Page page: getPageStack(viewId) )
+ {
+ for ( Param pageParameter: page.getParameters() )
+ {
+ Object object = Contexts.getPageContext().get( pageParameter.getName() );
+ if (object!=null)
+ {
+ parameters.put( pageParameter.getName(), object );
+ }
+ }
+ }
+ return parameters;
+ }
+
/**
* The global setting for no-conversation-viewid.
*
1.11 +21 -0 jboss-seam/src/main/org/jboss/seam/core/Redirect.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Redirect.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/core/Redirect.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- Redirect.java 21 Dec 2006 02:38:26 -0000 1.10
+++ Redirect.java 7 Feb 2007 17:12:31 -0000 1.11
@@ -82,6 +82,19 @@
}
/**
+ * Capture the view id and page parameters from the
+ * current request and squirrel them away so we can
+ * return here later in the conversation.
+ */
+ public void captureCurrentView()
+ {
+ FacesContext context = FacesContext.getCurrentInstance();
+ parameters = Pages.instance().getViewRootValues(context);
+ viewId = context.getViewRoot().getViewId();
+ setDirty();
+ }
+
+ /**
* Should the conversation be propagated across the redirect?
* @return true by default
*/
@@ -106,6 +119,14 @@
Manager.instance().redirect(viewId, parameters, conversationPropagationEnabled);
}
+ public void ifInitializedExecute()
+ {
+ if (viewId!=null)
+ {
+ execute();
+ }
+ }
+
public static Redirect instance()
{
if ( !Contexts.isConversationContextActive() )
More information about the jboss-cvs-commits
mailing list