[Proto-Scripty] Re: How to PUT a JSON object

2009-09-08 Thread Stefano Tranquillini
thanks, now it's works fine!
greats trick!



On Tue, Sep 8, 2009 at 16:59, Jim Higson  wrote:

>
> On Tuesday 08 September 2009 13:54:37 Stefano Tranquillini wrote:
> > > This is a variant of this issue:
> > >
> > > http://tinyurl.com/klmh4j
> > >
> > > Prototype can't make requests other than GET and POST. Anything else is
> > > sent
> > > as a POST with the _method variable set.
> > >
> > > Personally, I just modify Prototype as needed to include HEAD requests
> > > (see the patch, actually very simple) because I don't know enough to
> > > properly submit to the project.
> >
> > hi.
> > thanks.
> > i'm not able to update the prototype (what i've to modify?),
>
> It is actually pretty easy in a worksforme kind of way.
>
> On line 1393, change ['get', 'post'] to ['get', 'post', 'put']
>
> That should be all.
>
> > anyway i'll
> > use the POST method (is not the right way, but is the simplest).
> > the problem will fix in the next release of Prototype?
>
> --
> Jim
> my wiki ajaxification thing: http://wikizzle.org
> my blog: http://jimhigson.blogspot.com/
>
> >
>


-- 
Stefano

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: How to PUT a JSON object

2009-09-08 Thread Jim Higson

On Tuesday 08 September 2009 13:54:37 Stefano Tranquillini wrote:
> > This is a variant of this issue:
> >
> > http://tinyurl.com/klmh4j
> >
> > Prototype can't make requests other than GET and POST. Anything else is
> > sent
> > as a POST with the _method variable set.
> >
> > Personally, I just modify Prototype as needed to include HEAD requests
> > (see the patch, actually very simple) because I don't know enough to
> > properly submit to the project.
>
> hi.
> thanks.
> i'm not able to update the prototype (what i've to modify?),

It is actually pretty easy in a worksforme kind of way.

On line 1393, change ['get', 'post'] to ['get', 'post', 'put']

That should be all.

> anyway i'll
> use the POST method (is not the right way, but is the simplest).
> the problem will fix in the next release of Prototype?

-- 
Jim
my wiki ajaxification thing: http://wikizzle.org
my blog: http://jimhigson.blogspot.com/

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: How to PUT a JSON object

2009-09-08 Thread Stefano Tranquillini
>
> This is a variant of this issue:
>
> http://tinyurl.com/klmh4j
>
> Prototype can't make requests other than GET and POST. Anything else is
> sent
> as a POST with the _method variable set.
>
> Personally, I just modify Prototype as needed to include HEAD requests (see
> the patch, actually very simple) because I don't know enough to properly
> submit to the project.
>
>
hi.
thanks.
i'm not able to update the prototype (what i've to modify?), anyway i'll use
the POST method (is not the right way, but is the simplest).
the problem will fix in the next release of Prototype?

-- 
Stefano

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: How to PUT a JSON object

2009-09-08 Thread Jim Higson

On Tuesday 08 September 2009 09:27:50 Stefano T wrote:

> finally: the JS doesn't work, the curl calls works. why? where's the
> problem?

This is a variant of this issue:

http://tinyurl.com/klmh4j

Prototype can't make requests other than GET and POST. Anything else is sent 
as a POST with the _method variable set.

Personally, I just modify Prototype as needed to include HEAD requests (see 
the patch, actually very simple) because I don't know enough to properly 
submit to the project.

-- 
Jim
my wiki ajaxification thing: http://wikizzle.org
my blog: http://jimhigson.blogspot.com/

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: How to PUT a JSON object

2009-09-08 Thread Stefano T

but,
if the problem is the conf the curl -X PUT -d "field={name: 'field1',
value: 'ciaooo'}" http://localhost:8080/Rest/resources/UIRest/stefano
will not works, but it WORKS!
anyway i'll take a look at your hint.
thanks

On Sep 8, 1:14 pm, david  wrote:
> Hi Stefano T,
>
> I think there a server parameter that permit to block some specific
> request.
> Look 
> at:http://www.askapache.com/htaccess/mod_rewrite-tips-and-tricks.html#on...
>
> --
> david
>
> On 8 sep, 11:51, Stefano T  wrote:
>
> > Hi
> > i found a problema, the put invocations invoke a POST and not the PUT
> > method.
>
> > this is the code of the rest test server:
>
> >     @PUT
> >     @Consumes("*/*")
> >     @Path("{name}")
> >     public void put(@PathParam("name") String name)  {
> >         System.out.println("PUT");
>
> >     }
>
> >     @POST
> >     @Consumes("*/*")
> >     @Path("{name}")
> >     public void post(@PathParam("name") String name) {
> >         System.out.println("POST");
>
> >     }
>
> > the invocation is done in this way:
>
> >   var url='http://localhost:8080/Rest/resources/UIRest/stefano';
> >                 new Ajax.Request(url, {
> >                     method:'put',
> >                     onSuccess: function(transport) {
> >                         alert("send");
>
> >                     }
>
> >                 });
>
> > the server always respond POST.
>
> > i want to know why (but i think i'll use the post method instead the
> > put)
> > On Sep 8, 10:27 am, Stefano T  wrote:
>
> > > Hi all.i've a problem.
>
> > > i'd this piece of code:
>
> > > function put(){
> > >                 var string = {name: 'field1', value: 'ciaooo'};
> > >                 var pars = "field="+string;
> > >                 alert(pars);
> > >                 var url='http://localhost:8080/Rest/resources/UIRest/
> > > stefano';
>
> > >                 new Ajax.Request(url, {
> > >                     method: 'put',
> > >                     parameters: pars,
> > >                     onSuccess: function(transport) {
> > >                         alert("send");
>
> > >                     }
>
> > >                 });
> > >             };
>
> > > that aims to send a JSON object to a rest service. but the result is a
> > > 405 (request not allowed). i tried to put Object.toJSON(string) before
> > > the request but nothing gets better.
>
> > > the strange thing is the fact that this request:
>
> > > curl -X PUT -d "field={name: 'field1', value: 
> > > 'ciaooo'}"http://localhost:8080/Rest/resources/UIRest/stefano
>
> > > works fine.
>
> > > finally: the JS doesn't work, the curl calls works. why? where's the
> > > problem?
>
> > > thanks in advance.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: How to PUT a JSON object

2009-09-08 Thread david

Hi Stefano T,

I think there a server parameter that permit to block some specific
request.
Look at: 
http://www.askapache.com/htaccess/mod_rewrite-tips-and-tricks.html#only-allow-get-and-put-requests

--
david

On 8 sep, 11:51, Stefano T  wrote:
> Hi
> i found a problema, the put invocations invoke a POST and not the PUT
> method.
>
> this is the code of the rest test server:
>
>     @PUT
>     @Consumes("*/*")
>     @Path("{name}")
>     public void put(@PathParam("name") String name)  {
>         System.out.println("PUT");
>
>     }
>
>     @POST
>     @Consumes("*/*")
>     @Path("{name}")
>     public void post(@PathParam("name") String name) {
>         System.out.println("POST");
>
>     }
>
> the invocation is done in this way:
>
>   var url='http://localhost:8080/Rest/resources/UIRest/stefano';
>                 new Ajax.Request(url, {
>                     method:'put',
>                     onSuccess: function(transport) {
>                         alert("send");
>
>                     }
>
>                 });
>
> the server always respond POST.
>
> i want to know why (but i think i'll use the post method instead the
> put)
> On Sep 8, 10:27 am, Stefano T  wrote:
>
> > Hi all.i've a problem.
>
> > i'd this piece of code:
>
> > function put(){
> >                 var string = {name: 'field1', value: 'ciaooo'};
> >                 var pars = "field="+string;
> >                 alert(pars);
> >                 var url='http://localhost:8080/Rest/resources/UIRest/
> > stefano';
>
> >                 new Ajax.Request(url, {
> >                     method: 'put',
> >                     parameters: pars,
> >                     onSuccess: function(transport) {
> >                         alert("send");
>
> >                     }
>
> >                 });
> >             };
>
> > that aims to send a JSON object to a rest service. but the result is a
> > 405 (request not allowed). i tried to put Object.toJSON(string) before
> > the request but nothing gets better.
>
> > the strange thing is the fact that this request:
>
> > curl -X PUT -d "field={name: 'field1', value: 
> > 'ciaooo'}"http://localhost:8080/Rest/resources/UIRest/stefano
>
> > works fine.
>
> > finally: the JS doesn't work, the curl calls works. why? where's the
> > problem?
>
> > thanks in advance.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: How to PUT a JSON object

2009-09-08 Thread Stefano T

Hi
i found a problema, the put invocations invoke a POST and not the PUT
method.

this is the code of the rest test server:

@PUT
@Consumes("*/*")
@Path("{name}")
public void put(@PathParam("name") String name)  {
System.out.println("PUT");

}

@POST
@Consumes("*/*")
@Path("{name}")
public void post(@PathParam("name") String name) {
System.out.println("POST");

}


the invocation is done in this way:

  var url='http://localhost:8080/Rest/resources/UIRest/stefano';
new Ajax.Request(url, {
method:'put',
onSuccess: function(transport) {
alert("send");

}

});

the server always respond POST.

i want to know why (but i think i'll use the post method instead the
put)
On Sep 8, 10:27 am, Stefano T  wrote:
> Hi all.i've a problem.
>
> i'd this piece of code:
>
> function put(){
>                 var string = {name: 'field1', value: 'ciaooo'};
>                 var pars = "field="+string;
>                 alert(pars);
>                 var url='http://localhost:8080/Rest/resources/UIRest/
> stefano';
>
>                 new Ajax.Request(url, {
>                     method: 'put',
>                     parameters: pars,
>                     onSuccess: function(transport) {
>                         alert("send");
>
>                     }
>
>                 });
>             };
>
> that aims to send a JSON object to a rest service. but the result is a
> 405 (request not allowed). i tried to put Object.toJSON(string) before
> the request but nothing gets better.
>
> the strange thing is the fact that this request:
>
> curl -X PUT -d "field={name: 'field1', value: 
> 'ciaooo'}"http://localhost:8080/Rest/resources/UIRest/stefano
>
> works fine.
>
> finally: the JS doesn't work, the curl calls works. why? where's the
> problem?
>
> thanks in advance.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---