[OpenLayers-Dev] OpenLayers Ajax in trunk

Tim Schaub tschaub at openplans.org
Mon Feb 25 18:46:44 EST 2008


Hey-

Sean Gillies wrote:
> 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
>>
> 
> 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.
> 

The user and password settings are straight from the XMLHttpRequest 
interface.  I can't tell if it is just about the deprecated userinfo of 
the generic URI syntax (http://www.ietf.org/rfc/rfc3986) - 
user:password at host:port - or if it is about more.

In any case, the XMLHttpRequest interface exposes an "open" method with 
five arguments: method, url, async, user, and password.  I'm just 
proposing supporting those same five arguments.

The final docs should be clear on exactly where this is used.

> 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?

Right now, a user can specify their proxy independent of their layer URL 
(OpenLayers.ProxyHost and layer.url).

This makes it handy to share the configuration for a WFS layer (or any 
other with data requested via XMLHttpRequest) in an example.  The path 
to a user's proxy may differ, but the URL for the layer remains the same.

It also makes it easy to demo an application in one place and put it in 
to production in another - changing your OpenLayers.ProxyHost but not 
changing the layer config (or moving any data around).

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

Sounds good to me - particularly because "delete" is a reserved word in 
JavaScript, and some browsers complain about it being used as an 
identifier (I think "get" may be reserved in the future as well).

http://trac.openlayers.org/changeset/6366

I like that better.

Thanks for the feedback.
Tim

> Cheers,
> Sean
> _______________________________________________
> Dev mailing list
> Dev at openlayers.org
> http://openlayers.org/mailman/listinfo/dev
> 
> !DSPAM:4033,47c32563171215409313003!
> 




More information about the Dev mailing list