So I have asked this question with the return type .
Now i try to make a PUT
method like this:
@PUT
@Path("deleteAbsence")
@Produces("text/html")
public Response deleteAbsence(@QueryParam("id") String absenceID) {
String data = null;
return Response.ok("asda {"+absenceID+"}").build();
}
And my absenceID
is null
. What do I have to change to receive the parameter?
here is the answer i receive from the server with error 415: response
将PUT请求发送到http://example.com/deleteAbsence/?id=42
使用正确的查询参数调用资源:
PUT http://example.com/deleteAbsence/?id=42
in the content i had to put:
"<"absenceIDString >2 "<"/absenceIDString>
and the method looks like this:
@Consumes("application/xml")
@PUT
@Path("deleteAbsence")
@Produces("text/html")
public Response deleteAbsence( String absenceIDString) {
String data = null;
return Response.ok("asda {"+absenceIDString+"}").build();
}
It is something to do with your Rest Web Service Explorer configuration in MyEclipse. The screenshot shows your variable name as absenseIdString
while it should be id
. Make sure that you have configured the Param Type as QueryParam
. In myeclispe config screen, default value is PathParam.
Check this tutorial
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.