简体   繁体   English

Java Rest删除错误

[英]Java Rest Delete error

I am using MongoDb and Morphia. 我正在使用MongoDb和Morphia。 I want to create DELETE method. 我想创建DELETE方法。 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. Jersey返回的HTTP 405 Method Not Allowed ,表示您使用错误的HTTP方法来发出请求。

Please make sure you issue the request with the correct HTTP method which is DELETE in your case. 请确保使用正确的HTTP方法(在您的情况下为DELETE发出请求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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