简体   繁体   中英

Java Rest Delete error

I am using MongoDb and Morphia. I want to create DELETE method. This is my code:

@Path("deleted/{drinker}")
@DELETE
@Consumes(MediaType.APPLICATION_JSON)
public void deleteOrder(@PathParam("drinker") String drinker) {
    datastore.delete(datastore.createQuery(Order.class).filter("drinker", drinker));
}

And then I have Method Not Allowed Error. What is the reason?

HTTP 405 Method Not Allowed returned by Jersey means you use wrong HTTP method to issue the request.

Please make sure you issue the request with the correct HTTP method which is DELETE in your case.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM