I've attached a test case that illustrates an unpleasant behavior
between XmlHttpRequest and Restlet success responses with no entities.
 (We use Jetty connector here as usual.)  The server behavior differs
between Restlet 1.0 and 1.1 in how the no-entity responses are sent.

In Firefox 3 and Internet Explorer (possibly others) XmlHttpRequest
gets indigestion and emits a cryptic "no element found" error when
doing a GET or POST to this kind of resource.  This error is difficult
to catch, as it seems to happen outside caller code, after the initial
asynchronous call returns and before the callback fires.  Depending on
the browser environment, the result is somewhere between noisy and
catastrophic -- an embedded IE inside a SWT browser component on
Windows will lock up permanently trying to report the error.

There's a simple server-side workaround: DON'T send no-entity success responses.

But, seems like Restlet could do something about this ... either (a)
maybe we're not quite right with how we're handling no-entity success,
or (b) we could warn on the server side that sending a 200 with no
entity may have deleterious consequences.

Ideas or recommendations, anybody?

---------- Forwarded message ----------
From: Adam Schwartz <[EMAIL PROTECTED]>
Date: Fri, Nov 7, 2008 at 1:42 PM
Subject: no element found test case
To: Rob Heittman <[EMAIL PROTECTED]>

Just need the SimpleRestlet attached at "/postTest" and the
sampleLoginPage.html will hit it on a submit.  The first, then every
other time the Restlet gets a request, it will send back a Success and
voila, the error.
import org.restlet.Context;
import org.restlet.Restlet;
import org.restlet.data.Request;
import org.restlet.data.Response;
import org.restlet.data.Status;


public class SimpleRestlet extends Restlet {

	public SimpleRestlet(Context context) {
		super(context);
	}

	public void handle(Request request, Response response) {
		if( count % 2 == 0 )
			response.setStatus(Status.SUCCESS_OK);
		else
			response.setStatus(Status.CLIENT_ERROR_BAD_REQUEST);
		
		count++;
	}
}
Title: Affiliate Login
Please enter your username and password.

Username:
Password:

Reply via email to