You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by we...@apache.org on 2010/07/29 17:05:40 UTC

svn commit: r980464 - in /myfaces/core/trunk: api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Dom.js impl/src/main/java/org/apache/myfaces/context/servlet/PartialViewContextImpl.java

Author: werpu
Date: Thu Jul 29 15:05:40 2010
New Revision: 980464

URL: http://svn.apache.org/viewvc?rev=980464&view=rev
Log:
https://issues.apache.org/jira/browse/MYFACES-2841

adding behavior that a partial iframe request is the same as an ajax request to allow the rest of the codebase
to switch to partial response, fixed a bug in the iframe case detection

Modified:
    myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Dom.js
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/context/servlet/PartialViewContextImpl.java

Modified: myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Dom.js
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Dom.js?rev=980464&r1=980463&r2=980464&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Dom.js (original)
+++ myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Dom.js Thu Jul 29 15:05:40 2010
@@ -1270,7 +1270,7 @@ myfaces._impl.core._Runtime.singletonExt
 
     isMultipartCandidate: function(executes) {
         if(this._Lang.isString(executes)) {
-            executes = this._Lang.strToArray(executes, "\\s+");
+            executes = this._Lang.strToArray(executes, /\s+/);
         }
 
         for(var exec in executes) {

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/context/servlet/PartialViewContextImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/context/servlet/PartialViewContextImpl.java?rev=980464&r1=980463&r2=980464&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/context/servlet/PartialViewContextImpl.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/context/servlet/PartialViewContextImpl.java Thu Jul 29 15:05:40 2010
@@ -64,6 +64,14 @@ public class PartialViewContextImpl exte
     // many times and the result does not change during the life time
     // of this object.
     private Boolean _ajaxRequest = null;
+
+    /**
+     * Internal extension for
+     * https://issues.apache.org/jira/browse/MYFACES-2841
+     * will be changed for 2.1 to the official marker
+     */
+    private Boolean _iframeRequest = null;
+
     private Collection<String> _executeClientIds = null;
     private Collection<String> _renderClientIds = null;
     // Values that need to be saved because exists a setXX method 
@@ -78,13 +86,21 @@ public class PartialViewContextImpl exte
     @Override
     public boolean isAjaxRequest() {
         assertNotReleased();
-
+        /*
+         * Internal extension for
+         * https://issues.apache.org/jira/browse/MYFACES-2841
+         * will be changed for 2.1 to the official marker
+         */
+        if (_iframeRequest == null) {
+            isIFrameRequest();
+        }
         if (_ajaxRequest == null) {
             String requestType = _facesContext.getExternalContext().
                     getRequestHeaderMap().get(FACES_REQUEST);
             _ajaxRequest = (requestType != null && PARTIAL_AJAX.equals(requestType));
         }
-        return _ajaxRequest;
+        //for now we have to treat the partial iframe request also as ajax request
+        return _ajaxRequest || _iframeRequest;
     }
 
     @Override
@@ -111,7 +127,7 @@ public class PartialViewContextImpl exte
                     getRequestHeaderMap().get(FACES_REQUEST);
             _partialRequest = (requestType != null && PARTIAL_PROCESS.equals(requestType));
         }
-        return isAjaxRequest() || isIFrameRequest() || _partialRequest;
+        return isAjaxRequest()  || _partialRequest;
     }
 
     @Override
@@ -143,7 +159,10 @@ public class PartialViewContextImpl exte
      * @return true if the current request is an iframe based ajax request
      */
     public boolean isIFrameRequest() {
-        return _facesContext.getExternalContext().getRequestParameterMap().containsKey(PARTIAL_IFRAME);
+        if(_iframeRequest == null) {
+            _iframeRequest = _facesContext.getExternalContext().getRequestParameterMap().containsKey(PARTIAL_IFRAME);
+        }
+        return _iframeRequest;
     }
 
     @Override