[OpenLayers-Dev] OpenLayers Ajax in trunk

Sean Gillies sgillies at frii.com
Mon Feb 25 15:30:19 EST 2008


Tim Schaub wrote:
> Hey-
> 
> Eric Lemoine wrote:
>> On Sat, Feb 23, 2008 at 9:49 PM, Sean Gillies <sgillies at frii.com> wrote:
>>> Eric Lemoine wrote:
>>>  > The OpenLayers Ajax code doesn't allow for other HTTP methods than GET and POST!
>>>  >
>>> Is anybody currently relying on this feature of Ajax.js?
>> "Feature" ?? ;-)
>>
>> FYI Tim Schaub has started working on new XHR support in OpenLayers.
> 
> Yeah, I recognize I sound a bit like a broken record, but I want to get 
> out from under this hacked ex-Prototype.js mess.
> 
> I mentioned the POST/GET problem (limit to those verbs) to Chris a bit 
> ago as another reason to ditch the whole thing.  I don't see value in 
> continuing to fix this code (though that one is an easy fix).
> 
> So, I've put together a proposal for what I think is a better solution:
> http://trac.openlayers.org/wiki/Proposal/Request
> 
> (Note that all code on that wiki page and in the sandbox mentioned there 
> was written without testing.  I'm confident that it will all work in the 
> end but will not be surprised if someone points out typos.)
> 
> Basically, I like the XMLHttpRequest interface.  I just think we need a 
> few simple things to capture common patterns in using XMLHttpRequest. 
> For me, this is captured in the "issue" function in my Request.js [1].
> 
> I know others like the loadURL signature.  I don't see the need for 
> onComplete *and* onFailure (since there are many ways "failure" can 
> occur - including failure to parse XML which means your onComplete 
> function still needs "failure" checking code), but they are easy to 
> support as long as we keep loadURL around.
> 
> Interested to hear any feedback.
> 
> Tim
> 
> [1] 
> http://trac.openlayers.org/browser/sandbox/tschaub/request/lib/OpenLayers/Request.js
> 
>> <http://dev.openlayers.org/sandbox/tschaub/request/>
>> <http://dev.openlayers.org/sandbox/tschaub/request/lib/OpenLayers/Request.js>
>> <http://dev.openlayers.org/sandbox/tschaub/request/lib/OpenLayers/Request/XMLHttpRequest.js>
>>
>> That new code will support PUT and DELETE. Good Thing!
>>
>> Cheers,
>> --
>> Eric

Tim,

I like the proposal too, particularly that it makes it easier to set
request headers. A few questions:

Do the user and password parameters in example 8 indicate that you'd
like to implement a layer of abstraction over HTTP authentication
headers? I'd prefer to stay closer to bare HTTP.

Proxying is a non-issue for me right now, but I wonder if OL really
needs to know that it is making a proxy request. Couldn't it be transparent?

Can we shout RFC 2616 at developers and have methods like Request.GET,
POST, PUT, DELETE?

Cheers,
Sean



More information about the Dev mailing list