Hi, i'm using Restlet 1.1.6 and I am new to both Java and Restlet, but have
mostly had success so far over the past two months. My basic app was using
only GET before, and now I wish to extend it to accept POST requests.
Unfortunately I have not met with success yet.
The Resource i am working on extends Resource, and I made sure to
super(context, request, response). Again, GET is working properly on this
resource already.
I ovveride public boolean allowPost() { return true; }. In my Resource
constructor I also setModifiable(true);.
I have public void acceptRepresentation(Representation entity) ...} in which I
simply get the entity as form, read the data from it and echo it to java
console. I also set the response status to Status.SUCCESS_CREATED or
SUCCESS_ACCEPTED.
Unfortunately, still no success with this technique. I see (with the help of
Firebug) the POST request is made correctly, and in Java console I can see that
it arrived at the app and was routed to the proper resource. But the Restlet
engine returns the following error:
The method specified in the request is not allowed for the resource identified
by the request URI
So, I don't know what to do at this point. I have been searching this list and
the API and Googling for more information but all I have found is
recommendations to use the above techniques. I also located the alternative
technique of overriding handlePost(); is that an old method from version 1.0
that is no longer recommended? It did not work either.
I wonder if possibly my problem has something to do with a single resource
accepting both POST and GET. My resource does getVariants().add(new
Variant(MediaType.TEXT_PLAIN) and is able to respond to GET requests properly.
I have also tried commenting out the GET functionality but the POST ability
still did not work -- the same error persists.
Many thanks in advance for all help.
- Eric
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2418331