Yes, thank you.  Here is my test case.  I apologize for not attaching it in my 
original message.  It is essentially taken directly from the "first resource" 
tutorial yet stripped down to attempt to get it working, so I do not save an 
item or return a truly new identifier.

The text is below and the exact .java file is attached to this post.

I really don't understand what is wrong.  I am following the examples closely, 
the rest of my code runs correctly, GET works correctly, and I recently did a 
fresh install of Windows and Eclipse, and a fresh clean setup for my current 
app in Eclipse with all of the required external JARs.  So I am surprised by 
running into this problem.  I have 10 resources working fine with GET and this 
is the first time I have tried to use POST.  So i know my app is basically 
working otherwise.

I can see from my console trace that the POST request is well formed (and can 
verify that via Firebug too on the sending end).  I know the route to the 
resource is working properly because I tried adding to this resource the code 
for handling GET requests, and that worked perfectly as one would expect.

So I am somewhat at a loss for direction.  Thank you for all advice.
 

public class DiscoveryResource extends Resource {

        public DiscoveryResource(Context context, Request request, Response 
response) {
                super(context, request, response);
                setModifiable(true);
                getVariants().add(new Variant(MediaType.TEXT_PLAIN));
        }
        
        public void acceptRepresentation(Representation entity)
        throws ResourceException {
                Form form = new Form(entity);
                String data = form.getFirstValue("data");
                getResponse().setStatus(Status.SUCCESS_CREATED);
                Representation rep = new StringRepresentation("POST succeeded", 
MediaType.TEXT_PLAIN);
                
rep.setIdentifier(getRequest().getResourceRef().getIdentifier());
                getResponse().setEntity(rep);
        }
}

Attachment: DiscoveryResource.java
Description: Binary data

Reply via email to