You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by st...@apache.org on 2010/11/25 22:29:19 UTC
svn commit: r1039189 - in
/myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main:
java/org/apache/myfaces/extensions/cdi/jsf2/impl/windowhandler/WindowHandlerPhaseListener.java
resources/static/windowhandler.html
Author: struberg
Date: Thu Nov 25 21:29:19 2010
New Revision: 1039189
URL: http://svn.apache.org/viewvc?rev=1039189&view=rev
Log:
EXTCDI-79 this commit fixes problems with timed-out windowIds.
Any pre-existing window.name which does not correlate with an
active WindowContext on the server will now lead to creating
a new WindowContext and propagating it's new windowId to the
window.name on the client again.
Modified:
myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/windowhandler/WindowHandlerPhaseListener.java
myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/resources/static/windowhandler.html
Modified: myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/windowhandler/WindowHandlerPhaseListener.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/windowhandler/WindowHandlerPhaseListener.java?rev=1039189&r1=1039188&r2=1039189&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/windowhandler/WindowHandlerPhaseListener.java (original)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/windowhandler/WindowHandlerPhaseListener.java Thu Nov 25 21:29:19 2010
@@ -18,9 +18,9 @@
*/
package org.apache.myfaces.extensions.cdi.jsf2.impl.windowhandler;
-import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.WindowContext;
import org.apache.myfaces.extensions.cdi.core.impl.util.CodiUtils;
import org.apache.myfaces.extensions.cdi.jsf.api.listener.phase.JsfPhaseListener;
+import org.apache.myfaces.extensions.cdi.jsf.impl.scope.conversation.spi.EditableWindowContext;
import org.apache.myfaces.extensions.cdi.jsf.impl.scope.conversation.spi.EditableWindowContextManager;
import javax.faces.application.ResourceHandler;
@@ -112,18 +112,31 @@ public class WindowHandlerPhaseListener
sendWindowHandler(httpRequest, httpResponse, clientInfo, null);
facesContext.responseComplete();
}
- else if ("automatedEntryPoint".equals(windowId))
- {
- WindowContext windowContext = windowContextManager.getCurrentWindowContext();
- windowId = windowContext.getId();
-
- // GET request with NEW windowId - send windowhandlerfilter.html
- sendWindowHandler(httpRequest, httpResponse, clientInfo, windowId);
- facesContext.responseComplete();
- }
else
{
- httpRequest.setAttribute("windowId", windowId);
+ boolean windowIdAlive = false;
+ for (EditableWindowContext wc : windowContextManager.getWindowContexts())
+ {
+ if (windowId.equals(wc.getId()))
+ {
+ windowIdAlive = true;
+ break;
+ }
+ }
+
+
+ if ("automatedEntryPoint".equals(windowId) || !windowIdAlive)
+ {
+ windowId = windowContextManager.getCurrentWindowContext().getId();
+
+ // GET request with NEW windowId - send windowhandlerfilter.html
+ sendWindowHandler(httpRequest, httpResponse, clientInfo, windowId);
+ facesContext.responseComplete();
+ }
+ else
+ {
+ httpRequest.setAttribute("windowId", windowId);
+ }
}
}
}
@@ -154,7 +167,7 @@ public class WindowHandlerPhaseListener
if (windowId != null)
{
// we send the _real_ windowId
- windowHandlerHtml = windowHandlerHtml.replace("automatedEntryPoint", windowId);
+ windowHandlerHtml = windowHandlerHtml.replace("uninitializedWindowId", windowId);
}
OutputStream os = resp.getOutputStream();
Modified: myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/resources/static/windowhandler.html
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/resources/static/windowhandler.html?rev=1039189&r1=1039188&r2=1039189&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/resources/static/windowhandler.html (original)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/resources/static/windowhandler.html Thu Nov 25 21:29:19 2010
@@ -21,22 +21,23 @@
-->
<html>
<head>
- <meta name="author" content="Mark Struberg">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="pragma" content="no-cache">
<script type="text/javascript" >
window.onload=function(){
- var origUrl = window.location.href;
- var windowId = window.name
- if (!windowId || windowId.length < 3 || windowId == ('automated' + 'EntryPoint')) {
+ var windowId = 'uninitializedWindowId';
+ if (windowId == ('uninitialized' + 'WindowId')) {
+ windowId = window.name
+ }
+ if (!windowId || windowId.length < 3) {
// this will be replaced in the servletfilter
windowId ='automatedEntryPoint';
}
window.name=windowId;
- // 3 seconds expiry time
+ // 2 seconds expiry time
var expdt = new Date();
- expdt.setTime(expdt.getTime()+(3*1000));
+ expdt.setTime(expdt.getTime()+(2*1000));
var expires = "; expires="+expdt.toGMTString();
document.cookie = 'codiWindowId=' + windowId + expires;