[jboss-cvs] jboss-seam/src/main/org/jboss/seam/core ...
Gavin King
gavin.king at jboss.com
Fri Nov 17 01:16:00 EST 2006
User: gavin
Date: 06/11/17 01:16:00
Modified: src/main/org/jboss/seam/core Manager.java
Log:
JBSEAM-483
Revision Changes Path
1.117 +52 -8 jboss-seam/src/main/org/jboss/seam/core/Manager.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Manager.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/core/Manager.java,v
retrieving revision 1.116
retrieving revision 1.117
diff -u -b -r1.116 -r1.117
--- Manager.java 17 Nov 2006 02:35:45 -0000 1.116
+++ Manager.java 17 Nov 2006 06:16:00 -0000 1.117
@@ -40,7 +40,7 @@
*
* @author Gavin King
* @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
- * @version $Revision: 1.116 $
+ * @version $Revision: 1.117 $
*/
@Scope(ScopeType.EVENT)
@Name("org.jboss.seam.core.manager")
@@ -66,6 +66,7 @@
private int concurrentRequestTimeout = 1000; //one second
private String conversationIdParameter = "conversationId";
+ private String parentConversationIdParameter = "parentConversationId";
private String conversationIsLongRunningParameter = "conversationIsLongRunning";
public String getCurrentConversationId()
@@ -407,6 +408,7 @@
//First, try to get the conversation id from a request parameter
String storedConversationId = getRequestParameterValue(parameters, conversationIdParameter);
+ String storedParentConversationId = getRequestParameterValue(parameters, parentConversationIdParameter);
Boolean isLongRunningConversation = "true".equals( getRequestParameterValue(parameters, conversationIsLongRunningParameter) );
if ( isMissing(storedConversationId) && Contexts.isPageContextActive() )
@@ -439,7 +441,7 @@
isLongRunningConversation = false;
}
- return restoreAndLockConversation(storedConversationId, isLongRunningConversation)
+ return restoreAndLockConversation(storedConversationId, storedParentConversationId, isLongRunningConversation)
|| "end".equals(propagation);
}
@@ -498,9 +500,15 @@
* Initialize the request conversation context, given the
* conversation id.
*/
- public boolean restoreAndLockConversation(String storedConversationId, boolean isLongRunningConversation) {
- ConversationEntry ce = storedConversationId==null ?
- null : ConversationEntries.instance().getConversationEntry(storedConversationId);
+ public boolean restoreAndLockConversation(String storedConversationId, String storedParentConversationId, boolean isLongRunningConversation) {
+ ConversationEntry ce = null;
+ if (storedConversationId!=null)
+ {
+ ConversationEntries entries = ConversationEntries.instance();
+ ce = entries.getConversationEntry(storedConversationId);
+ if (ce==null) ce = entries.getConversationEntry(storedParentConversationId);
+ }
+
if ( ce!=null && ce.lock() )
{
// do this asap, since there is a window where conversationTimeout() might
@@ -745,10 +753,30 @@
* Add the conversation id to a URL, if necessary
*/
public String encodeConversationId(String url) {
- if ( destroyBeforeRedirect || Seam.isSessionInvalid() )
+ if ( Seam.isSessionInvalid() )
+ {
+ return url;
+ }
+ else if (destroyBeforeRedirect)
+ {
+ if ( isNestedConversation() )
+ {
+ return new StringBuilder( url.length() + conversationIdParameter.length() + 5 )
+ .append(url)
+ .append( url.contains("?") ? '&' : '?' )
+ .append(conversationIdParameter)
+ .append('=')
+ .append( getParentConversationId() )
+ .append('&')
+ .append(conversationIsLongRunningParameter)
+ .append("=true")
+ .toString();
+ }
+ else
{
return url;
}
+ }
else
{
StringBuilder builder = new StringBuilder( url.length() + conversationIdParameter.length() + 5 )
@@ -757,12 +785,18 @@
.append(conversationIdParameter)
.append('=')
.append( getCurrentConversationId() );
+ if ( isNestedConversation() && !isReallyLongRunningConversation() )
+ {
+ builder.append('&')
+ .append(parentConversationIdParameter)
+ .append('=')
+ .append( getParentConversationId() );
+ }
if ( isReallyLongRunningConversation() )
{
builder.append('&')
.append(conversationIsLongRunningParameter)
- .append('=')
- .append("true");
+ .append("=true");
}
return builder.toString();
}
@@ -1036,4 +1070,14 @@
return "Manager(" + currentConversationIdStack + ")";
}
+ protected String getParentConversationIdParameter()
+ {
+ return parentConversationIdParameter;
+ }
+
+ protected void setParentConversationIdParameter(String nestedConversationIdParameter)
+ {
+ this.parentConversationIdParameter = nestedConversationIdParameter;
+ }
+
}
More information about the jboss-cvs-commits
mailing list