You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bo...@apache.org on 2011/07/08 11:19:04 UTC

svn commit: r1144204 - /myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js

Author: bommel
Date: Fri Jul  8 09:19:04 2011
New Revision: 1144204

URL: http://svn.apache.org/viewvc?rev=1144204&view=rev
Log:
(TOBAGO-1014) fixed 304 response code handling for ajax

Modified:
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js?rev=1144204&r1=1144203&r2=1144204&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js Fri Jul  8 09:19:04 2011
@@ -1605,7 +1605,7 @@ var Tobago = {
       return undefined;
     }
     if (! (arg === undefined)) { // @DEV_ONLY
-      LOG.error('arg is unknown: ' + typeof arg + ' : ' + arg); // @DEV_ONLY
+      LOG.debug('arg is unknown: ' + typeof arg + ' : ' + arg); // @DEV_ONLY
     } // @DEV_ONLY
     return undefined;
   },
@@ -2169,7 +2169,7 @@ Tobago.Transport.DojoTransport = {
           return;
         } else if (ioArgs.xhr.status === 304) {
           requestOptions.textStatus = 'notmodified';
-          Tobago.Updater.onError(requestOptions);
+          Tobago.Updater.onSuccess(requestOptions);
           return;
         }
 
@@ -2195,7 +2195,7 @@ Tobago.Transport.DojoTransport = {
     requestOptions.xhr = ioArgs.xhr;
     if (ioArgs.xhr.status == 304) {
       requestOptions.textStatus = 'notmodified';
-      Tobago.Updater.onError(requestOptions);
+      Tobago.Updater.onSuccess(requestOptions);
     } else {
       requestOptions.textStatus = 'error';
       Tobago.Updater.onError(requestOptions);
@@ -2358,7 +2358,10 @@ Tobago.Updater = {
 
   onSuccess: function(requestOptions) {
     LOG.debug('Tobago.Updater.onSuccess()'); // @DEV_ONLY
-    if (!requestOptions.resultData || !requestOptions.resultData.tobagoAjaxResponse) {
+    if (requestOptions.textStatus === 'notmodified') {
+      Tobago.Updater.handle304Response(Tobago.parsePartialIds(requestOptions.ajaxComponentIds));
+      return;
+    } else if (!requestOptions.resultData || !requestOptions.resultData.tobagoAjaxResponse) {
       // unknown response do full page reload
       LOG.warn('initiating full reload'); // @DEV_ONLY
       if (Tobago.Updater.WAIT_ON_ERROR) {
@@ -2430,11 +2433,11 @@ Tobago.Updater = {
 
   onError: function(requestObject) {
 
-    LOG.warn('Request failed : ' + requestObject.statusText); // @DEV_ONLY
+    LOG.warn('Request failed : ' + requestObject.textStatus); // @DEV_ONLY
 
-    if (requestObject.statusText === 'timeout') {
+    if (requestObject.textStatus === 'timeout') {
       Tobago.Updater.doErrorUpdate(Tobago.parsePartialIds(requestObject.ajaxComponentIds));
-    } else if (requestObject.statusText === 'notmodified') {
+    } else if (requestObject.textStatus === 'notmodified') {
       Tobago.Updater.handle304Response(Tobago.parsePartialIds(requestObject.ajaxComponentIds));
     } else {
       Tobago.Updater.doErrorUpdate(Tobago.parsePartialIds(requestObject.ajaxComponentIds));