[jboss-cvs] jboss-seam/src/main/org/jboss/seam/core ...
Gavin King
gavin.king at jboss.com
Thu Mar 8 12:16:16 EST 2007
User: gavin
Date: 07/03/08 12:16:16
Modified: src/main/org/jboss/seam/core Manager.java
Log:
fix broken captcha functionality
fix NPEs in conversation management from ResourceServlet
Revision Changes Path
1.157 +27 -20 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.156
retrieving revision 1.157
diff -u -b -r1.156 -r1.157
--- Manager.java 8 Mar 2007 07:34:14 -0000 1.156
+++ Manager.java 8 Mar 2007 17:16:16 -0000 1.157
@@ -45,7 +45,7 @@
*
* @author Gavin King
* @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
- * @version $Revision: 1.156 $
+ * @version $Revision: 1.157 $
*/
@Scope(ScopeType.EVENT)
@Name("org.jboss.seam.core.manager")
@@ -429,21 +429,26 @@
public boolean restoreConversation(Map parameters)
{
String storedConversationId = null;
+ String storedParentConversationId = null;
+ Boolean isLongRunningConversation = null;
- //First, try to get the conversation id from a request parameter
- if (FacesContext.getCurrentInstance() != null)
+ //First, try to get the conversation id from the request parameter defined for the page
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ if ( facesContext!=null && facesContext.getViewRoot()!=null )
{
- Page page = Pages.instance().getPage(FacesContext.getCurrentInstance().getViewRoot().getViewId());
+ Page page = Pages.instance().getPage( facesContext.getViewRoot().getViewId() );
storedConversationId = page.getConversationIdParameter().getRequestConversationId();
+ isLongRunningConversation = false; //TODO: think about this further...
}
- else
+
+ //Next, try to get the conversation id from the globally defined request parameter
+ if (storedConversationId==null)
{
storedConversationId = getRequestParameterValue(parameters, conversationIdParameter);
+ storedParentConversationId = getRequestParameterValue(parameters, parentConversationIdParameter);
+ isLongRunningConversation = "true".equals( getRequestParameterValue(parameters, conversationIsLongRunningParameter) );
}
- String storedParentConversationId = getRequestParameterValue(parameters, parentConversationIdParameter);
- Boolean isLongRunningConversation = "true".equals( getRequestParameterValue(parameters, conversationIsLongRunningParameter) );
-
if ( isMissing(storedConversationId) )
{
if ( Contexts.isPageContextActive() )
@@ -652,22 +657,24 @@
*/
public void initializeTemporaryConversation()
{
- String id = null;
+ String id = generateInitialConversationId();
+ setCurrentConversationId(id);
+ createCurrentConversationIdStack(id);
+ setLongRunningConversation(false);
+ }
- FacesContext ctx = FacesContext.getCurrentInstance();
- if (ctx != null && ctx.getViewRoot() != null)
+ private String generateInitialConversationId()
+ {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ if ( facesContext!=null && facesContext.getViewRoot()!=null )
{
- Page page = Pages.instance().getPage(ctx.getViewRoot().getViewId());
- id = page.getConversationIdParameter().getInitialConversationId();
+ Page page = Pages.instance().getPage( facesContext.getViewRoot().getViewId() );
+ return page.getConversationIdParameter().getInitialConversationId();
}
else
{
- id = Id.nextId();
+ return Id.nextId();
}
-
- setCurrentConversationId(id);
- createCurrentConversationIdStack(id);
- setLongRunningConversation(false);
}
private ConversationEntry createConversationEntry()
More information about the jboss-cvs-commits
mailing list