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 <stefano.tranquill...@gmail.com> 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 -~----------~----~----~----~------~----~------~--~---