On Thu, Jul 23, 2009 at 9:23 AM, skar <[email protected]> wrote:

> I tried this:
>
> > var vResponse = qx.event.Registration.createEvent(value,
> > qx.io.remote.Response);
> >             alert("Value is:" + value + " and content is:" +
> > vImpl.getResponseContent());
> in line 880 of Exchange.js, the alert line being the only line added and
> it also showed "failed" state, but an empty "null" content as shown below:
>
> > Value is:failed and content is:null
> Firebug shows "Login failed!!!" as the content from rails, which is the
> right content of course. So the content isn't even reaching till line 880.
>

Ok. I'm trying to work this in spare cycles while doing other stuff, so I'm
going to ask you to do the grunt work of testing, to figure this out. Sorry.

Looking deeper, the XmlHttp transport only looks for response text if the
state is "completed" so it needs fixing too. (I wonder what one would expect
to happen if a different transport, e.g. Iframe transport, were in use? It
pulls the content from the Iframe, so if the request didn't succeed, you
wouldn't have any data there. Ok, well let's see if we can fix this for
XmlHttp tranport anyway.)

Please apply this ADDITIONAL patch and let me know if it solves the problem.
This is a bit more invasive, as we're now looking for response text in
states other than "completed" so I may want to review this when I'm not as
harried with other things before actually applying it. I am interested in
your testing results, however.

Derrell
diff --git a/qooxdoo/framework/source/class/qx/io/remote/transport/XmlHttp.js b/qooxdoo/framework/source/class/qx/io/remote/transport/XmlHttp.js
index d912a11..cf57596 100644
--- a/qooxdoo/framework/source/class/qx/io/remote/transport/XmlHttp.js
+++ b/qooxdoo/framework/source/class/qx/io/remote/transport/XmlHttp.js
@@ -628,11 +628,13 @@ qx.Class.define("qx.io.remote.transport.XmlHttp",
       var vStatus = this.getStatusCode();
       var vReadyState = this.getReadyState();
 
-      if (qx.io.remote.Exchange.wasSuccessful(vStatus, vReadyState, this.__localRequest))
+      try
       {
-        try {
-          vResponseText = this.getRequest().responseText;
-        } catch(ex) {}
+        vResponseText = this.getRequest().responseText;
+      }
+      catch(ex)
+      {
+        vResponseText = null;
       }
 
       return vResponseText;
@@ -712,12 +714,13 @@ qx.Class.define("qx.io.remote.transport.XmlHttp",
      */
     getResponseContent : function()
     {
-      if (this.getState() !== "completed")
+      var state = this.getState();
+      if (state !== "completed" && state != "failed")
       {
         if (qx.core.Variant.isSet("qx.debug", "on"))
         {
           if (qx.core.Setting.get("qx.ioRemoteDebug")) {
-            this.warn("Transfer not complete, ignoring content!");
+            this.warn("Transfer not complete or failed, ignoring content!");
           }
         }
 
@@ -733,6 +736,19 @@ qx.Class.define("qx.io.remote.transport.XmlHttp",
 
       var vText = this.getResponseText();
 
+      if (state == "failed")
+      {
+          if (qx.core.Variant.isSet("qx.debug", "on"))
+          {
+            if (qx.core.Setting.get("qx.ioRemoteDebugData"))
+            {
+              this.debug("Failed: " + vText);
+            }
+          }
+
+          return vText;
+      }
+
       switch(this.getResponseType())
       {
         case "text/plain":
------------------------------------------------------------------------------
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to