Chi*_*lax 2 java rest web-services jax-rs jersey
我试图使用以下@DELETE方法从"Contacts"表中删除"Contact"(使用Jersey Framework(JAX-RS实现))
@DELETE
@Path("/delete/{contact}")
public String deleteContact(@PathParam("contact") String name) throws ClassNotFoundException, SQLException {
String response = DAOaccess.deleteContact(name);
return response;
}
Run Code Online (Sandbox Code Playgroud)
以下url用于从浏览器调用webservice:
/联系人/删除/ CONTACTNAME
但是这样做会引发HTTP状态405 - 不允许的方法.
可能是什么原因?我该如何克服这个问题?
URL = / contacts/delete/contactname
405因为
似乎删除总是表现为submit (Post method)
,你试图像get从方法一样调用URL.
This is not possible to call the post method as like get.如果你真的想从浏览器调用这个Web服务进行测试,只需下载一个Mozilla plugin (Poster)可以帮助你在所有方法类型中提交web服务.