Hello Richard,

It could be either an HTTP header not correctly in the JS part or a 
problem on methods signatures within ServerResource class...

Can you give me the request content of both calls from Java and JS?

- For Java, simply active tracing mode on the ClientResource client 
(http://templth.wordpress.com/2011/05/17/activating-tracing-mode-in-restlet/):

<http://templth.wordpress.com/2011/05/17/activating-tracing-mode-in-restlet/>String
 
url = "(...)";
Context context = new Context();
ClientResource clientResource = new ClientResource(context, url);
Context context = clientResource.getContext();
context.getParameters().add("tracing", "true");

- For JS, you can have access to the content using for example Firebug...

Thanks!
Thierry

> First - thank you for your message and the work that you are doing.
>
> I downloaded the latest .js files and the previously reported error is
> indeed fixed.  But my post() is still not being received on the server side
> when called from Javascript.  From Javascript, I am able to succesfully call
> get and put.  From a Java client, I can successfully call post.  And a
> standard HTML form post works too.
>
> Details on the error... (from Chrome's Javascript console)
> POST http://localhost:8888/commitments/ 415 (Unsupported Media Type)
> Class.lowLevelSendRequestrestlet-browser.js:3681
> Class.sendRequestrestlet-browser.js:3630
> Class.commitrestlet-browser.js:3776
> Class.handlerestlet-browser.js:3812
> Class.handlerestlet-browser.js:3865
> Class.handleNextrestlet-browser.js:4311
> Class.handleRequestrestlet-browser.js:4301
> Class.handlerestlet-browser.js:4293
> Class.postrestlet-browser.js:4232
> (anonymous function)oldTest.html:64
> Test.runqunit.js:102
> Test.queue.badqunit.js:232
> processqunit.js:865
> QUnit.start.config.blocking
>
> Details of my client code....
> asyncTest("Post with resource Commitment (json)", function() {
>    var clientResource = new ClientResource("/commitments/");
>    var commitment = {
>         title: "From automated test",
>         description: "This is from our automated test"
>    }
>    var jsonRepresentation = new JsonRepresentation(commitment);
>    alert(jsonRepresentation.getText());
>    // Result is: {"title":"From automated test","description":"This is from
> our automated test"}
>    clientResource.post(jsonRepresentation, function(representation) {
>      console.log("representation.getText() = "+representation.getText());
>      // Note: commenting or not commenting out all the lines below doesn't
> make a difference
>      //var jsonRepresentation = new JsonRepresentation(representation);
>      //var obj = jsonRepresentation.getObject();
>      //ok(obj.id, "1");
>      //ok(obj.title, "From automated test");
>      //ok(obj.description, "This is from our automated test");
>      start();
>    }, MediaType.APPLICATION_JSON);
> });
>
> You had mentioned that you are still working on the header management
> processing - would that be a likely reason for the 415 error or am I not
> doing something required for Post in particular.
>
> Also, would you still like me to open an issue in GitHub for this problem or
> the previous one?
>
> Thanks so much!
> RB
>
> --
> View this message in context: 
> http://restlet-discuss.1400322.n2.nabble.com/Post-problems-when-using-Restlet-Javascript-Edition-tp7270413p7286087.html
> Sent from the Restlet Discuss mailing list archive at Nabble.com.
>
> ------------------------------------------------------
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2922490

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2922950

Reply via email to