I checked prototype1.5.js,it really doesn't urlencode request data!?
Here is source code:
var Ajax = {
getTransport: function() {
return Try.these(
function() {return new ActiveXObject('Msxml2.XMLHTTP')},
function() {return new ActiveXObject('Microsoft.XMLHTTP')},
function() {return new XMLHttpRequest()}
) || false;
},
activeRequestCount: 0
}
Ajax.Request.prototype = Object.extend(new Ajax.Base(), {
initialize: function(url, options) {
this.transport = Ajax.getTransport();
this.setOptions(options);
this.request(url);
},
request: function(url) {
var parameters = this.options.parameters || '';
if (parameters.length > 0) parameters += '&_=';
try {
this.url = url;
if (this.options.method == 'get' && parameters.length > 0)
this.url += (this.url.match(/\?/) ? '&' : '?') + parameters;
Ajax.Responders.dispatch('onCreate', this, this.transport);
this.transport.open(this.options.method, this.url,
this.options.asynchronous);
if (this.options.asynchronous) {
this.transport.onreadystatechange = this.onStateChange.bind(this);
setTimeout((function() {this.respondToReadyState(1)}).bind(this), 10);
}
this.setRequestHeaders();
var body = this.options.postBody ? this.options.postBody : parameters;
//only call transport.send--XMLHTTP original method
this.transport.send(this.options.method == 'post' ? body : null);
} catch (e) {
this.dispatchException(e);
}
},
On Jan 29, 2008 11:37 AM, Rob Heittman <[EMAIL PROTECTED]> wrote:
>
>
> > I think browser should urlencode xml data,but don't do that for
> > plaintext just like my json post data.
>
> It depends on what browser facility you use. Submitting a regular form
> from an HTML page, the content will always be url-encoded. If you use
> XmlHttpRequest and POST, your Javascript is responsible for supplying all
> the entity data, including doing any url-encoding or not.
>
> Restlet's Form abstraction assumes url-encoding (which is the correct
> behavior), so you can't use it if the data is not url-encoded. But you
> don't need to armor your JSON object in a Form, you can skip the Form
> wrapper altogether and just structure your entire entity in JSON, which is
> what most folks do -- then you can leverage the JSON facilities in Restlet
> directly.
>
> - R
>
>
--
cleverpig
Location: Beijing
Address: Room 4018,No.A2 South Avenue Fuxingmen Beijing,P.R.China
Zipcode: 100031
Phone: 010-66415588-1113
MSN: [EMAIL PROTECTED]
QQ: 149291732
Skepe: cleverpigatmatrix
My Facebook ID:cleverpig
My Blog: hihere.sohu.com
My Tags: del.icio.us/cleverpig
My Twitter: twitter.com/cleverpig
My Organization: www.beijing-open-party.org
一些值得关注的唧歪:
http://jiwai.de/t/jmatrix/
http://jiwai.de/t/db4o/
http://jiwai.de/t/matrix-community/