[seam-commits] Seam SVN: r9544 - in trunk/src/main/org/jboss/seam: faces and 1 other directories.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Tue Nov 11 00:15:41 EST 2008
Author: shane.bryzak at jboss.com
Date: 2008-11-11 00:15:41 -0500 (Tue, 11 Nov 2008)
New Revision: 9544
Modified:
trunk/src/main/org/jboss/seam/faces/FacesManager.java
trunk/src/main/org/jboss/seam/faces/Navigator.java
trunk/src/main/org/jboss/seam/faces/Redirect.java
trunk/src/main/org/jboss/seam/navigation/Pages.java
trunk/src/main/org/jboss/seam/navigation/RedirectNavigationHandler.java
trunk/src/main/org/jboss/seam/pages-2.1.xsd
Log:
JBSEAM-3609
Modified: trunk/src/main/org/jboss/seam/faces/FacesManager.java
===================================================================
--- trunk/src/main/org/jboss/seam/faces/FacesManager.java 2008-11-11 03:05:05 UTC (rev 9543)
+++ trunk/src/main/org/jboss/seam/faces/FacesManager.java 2008-11-11 05:15:41 UTC (rev 9544)
@@ -93,22 +93,10 @@
}
url = url.substring(0, loc);
}
- redirect(url, parameters, true);
+ redirect(url, parameters, true, true);
}
- /**
- * Redirect to the given view id, encoding the conversation id
- * into the request URL.
- *
- * @param viewId the JSF view id
- */
@Override
- public void redirect(String viewId)
- {
- redirect(viewId, null, true);
- }
-
- @Override
protected void storeConversationToViewRootIfNecessary()
{
FacesContext facesContext = FacesContext.getCurrentInstance();
@@ -144,6 +132,18 @@
}
/**
+ * Redirect to the given view id, encoding the conversation id
+ * into the request URL.
+ *
+ * @param viewId the JSF view id
+ */
+ @Override
+ public void redirect(String viewId)
+ {
+ redirect(viewId, null, true, true);
+ }
+
+ /**
* Redirect to the given view id, after encoding parameters and conversation
* id into the request URL.
*
@@ -152,12 +152,8 @@
* @param includeConversationId determines if the conversation id is to be encoded
*/
public void redirect(String viewId, Map<String, Object> parameters,
- boolean includeConversationId)
+ boolean includeConversationId, boolean includePageParams)
{
- /*if ( Lifecycle.getPhaseId()==PhaseId.RENDER_RESPONSE )
- {
- throw new IllegalStateException("attempted to redirect during RENDER_RESPONSE phase");
- }*/
if (viewId == null)
{
throw new RedirectException("cannot redirect to a null viewId");
@@ -168,12 +164,13 @@
{
url = encodeParameters(url, parameters);
}
- url = Pages.instance().encodePageParameters(
- FacesContext.getCurrentInstance(),
- url,
- viewId,
- parameters==null ? Collections.EMPTY_SET : parameters.keySet()
- );
+
+ if (includePageParams)
+ {
+ url = Pages.instance().encodePageParameters(FacesContext.getCurrentInstance(),
+ url, viewId, parameters==null ? Collections.EMPTY_SET : parameters.keySet());
+ }
+
if (includeConversationId)
{
beforeRedirect(viewId);
Modified: trunk/src/main/org/jboss/seam/faces/Navigator.java
===================================================================
--- trunk/src/main/org/jboss/seam/faces/Navigator.java 2008-11-11 03:05:05 UTC (rev 9543)
+++ trunk/src/main/org/jboss/seam/faces/Navigator.java 2008-11-11 05:15:41 UTC (rev 9544)
@@ -37,17 +37,22 @@
FacesManager.instance().redirectToExternalURL(url);
}
+ protected void redirect(String viewId, Map<String, Object> parameters)
+ {
+ redirect(viewId, parameters, true);
+ }
+
/**
* Redirect to the view id.
*/
- protected void redirect(String viewId, Map<String, Object> parameters)
+ protected void redirect(String viewId, Map<String, Object> parameters, boolean includePageParams)
{
if ( Strings.isEmpty(viewId) )
{
viewId = Pages.getCurrentViewId();
}
if ( log.isDebugEnabled() ) log.debug("redirecting to: " + viewId);
- FacesManager.instance().redirect(viewId, parameters, true);
+ FacesManager.instance().redirect(viewId, parameters, true, includePageParams);
}
/**
Modified: trunk/src/main/org/jboss/seam/faces/Redirect.java
===================================================================
--- trunk/src/main/org/jboss/seam/faces/Redirect.java 2008-11-11 03:05:05 UTC (rev 9543)
+++ trunk/src/main/org/jboss/seam/faces/Redirect.java 2008-11-11 05:15:41 UTC (rev 9544)
@@ -146,7 +146,7 @@
*/
public void execute()
{
- FacesManager.instance().redirect(viewId, parameters, conversationPropagationEnabled);
+ FacesManager.instance().redirect(viewId, parameters, conversationPropagationEnabled, true);
}
/**
Modified: trunk/src/main/org/jboss/seam/navigation/Pages.java
===================================================================
--- trunk/src/main/org/jboss/seam/navigation/Pages.java 2008-11-11 03:05:05 UTC (rev 9543)
+++ trunk/src/main/org/jboss/seam/navigation/Pages.java 2008-11-11 05:15:41 UTC (rev 9544)
@@ -1571,6 +1571,8 @@
}
final String viewId = redirect.attributeValue("view-id");
final String url = redirect.attributeValue("url");
+ final String includePageParamsAttr = redirect.attributeValue("include-page-params");
+ final boolean includePageParams = includePageParamsAttr == null ? true : Boolean.getBoolean(includePageParamsAttr);
Element messageElement = redirect.element("message");
String control = messageElement==null ? null : messageElement.attributeValue("for");
@@ -1580,8 +1582,7 @@
FacesMessage.SEVERITY_INFO :
getFacesMessageValuesMap().get( severityName.toUpperCase() );
rule.addNavigationHandler(new RedirectNavigationHandler(stringValueExpressionFor(viewId),
- stringValueExpressionFor(url),
- params, message, severity, control) );
+ stringValueExpressionFor(url), params, message, severity, control, includePageParams) );
}
List<Element> childElements = element.elements("out");
Modified: trunk/src/main/org/jboss/seam/navigation/RedirectNavigationHandler.java
===================================================================
--- trunk/src/main/org/jboss/seam/navigation/RedirectNavigationHandler.java 2008-11-11 03:05:05 UTC (rev 9543)
+++ trunk/src/main/org/jboss/seam/navigation/RedirectNavigationHandler.java 2008-11-11 05:15:41 UTC (rev 9544)
@@ -23,9 +23,10 @@
private final String message;
private final Severity severity;
private final String control;
+ private final boolean includePageParams;
- public RedirectNavigationHandler(ValueExpression<String> viewId, ValueExpression<String> url,
- List<Param> params, String message, Severity severity, String control)
+ public RedirectNavigationHandler(ValueExpression<String> viewId, ValueExpression<String> url, List<Param> params,
+ String message, Severity severity, String control, boolean includePageParams)
{
this.viewId = viewId;
this.url = url;
@@ -33,6 +34,7 @@
this.message = message;
this.severity = severity;
this.control = control;
+ this.includePageParams = includePageParams;
}
@Override
@@ -56,7 +58,7 @@
if (url != null) {
redirectExternal(url.getValue());
} else {
- redirect(viewId == null ? null : viewId.getValue(), parameters);
+ redirect(viewId == null ? null : viewId.getValue(), parameters, includePageParams);
}
return true;
Modified: trunk/src/main/org/jboss/seam/pages-2.1.xsd
===================================================================
--- trunk/src/main/org/jboss/seam/pages-2.1.xsd 2008-11-11 03:05:05 UTC (rev 9543)
+++ trunk/src/main/org/jboss/seam/pages-2.1.xsd 2008-11-11 05:15:41 UTC (rev 9544)
@@ -287,7 +287,7 @@
</xs:complexType>
</xs:element>
<xs:attributeGroup name="attlist.end-conversation">
- <xs:attribute name="before-redirect" default="false" type="pages:tf-boolean"/>
+ <xs:attribute name="before-redirect" default="false" type="pages:tf-boolean"/>
<xs:attribute name="root" default="false" type="pages:tf-boolean"/>
<xs:attribute name="if" type="pages:boolean-value-expression" />
</xs:attributeGroup>
@@ -416,6 +416,7 @@
<xs:attributeGroup name="attlist.redirect">
<xs:attribute name="view-id" type="pages:view-id" />
<xs:attribute name="url" type="pages:url" />
+ <xs:attribute name="include-page-params" type="pages:tf-boolean" />
</xs:attributeGroup>
<xs:element name="http-error">
More information about the seam-commits
mailing list