@Path("v2/test”)
Class Test{
@Path(“{id}/{version}”)
@GET
@Produces(MediaType.APPLICATION_JSON)
public Response getvalue(@PathParam(“id”)
String id, @PathParam(“version”)
String version) {
//do some thing
}
@DELETE
@Path(“{testPath: .+}")
@Produces(MediaType.APPLICATION_JSON)
public Response deleteValue(@PathParam("testPath")
String testPath) throws Exception {
//do something
}
}
GET : http://localhost:8080/v2/test/testId/1.0 - works
DELETE : http://localhost:8080/v2/test/testId - works
DELETE : http://localhost:8080/v2/test/testId/1.0 - 405 method not allowed error
When I add two Delete paths I get 415 error (the same curl works with no version)
@Path("v2/test”)
Class Test{
@Path(“{id}/{version}”)
@GET
@Produces(MediaType.APPLICATION_JSON)
public Response getvalue(@PathParam(“id”)
String id, @PathParam(“version”)
String version) {
//do some thing
}
@DELETE
@Path(“{id}")
@Produces(MediaType.APPLICATION_JSON)
public Response deleteValue(@PathParam("id")
String id) throws Exception {
//do something
}
@DELETE
@Path(“{id}/{version}")
@Produces(MediaType.APPLICATION_JSON)
public Response deleteValue(@PathParam(“id”)
String id, @PathParam(“version”)
String version) throws Exception {
//do something
}
}
curl -X DELETE --header 'Content-Type: application/json' http://localhost:8080/v2/test/testId/1.0 - gives me error 'Error 415--Unsupported Media Type'
curl -X DELETE --header 'Content-Type: application/json' http://localhost:8080/v2/test/testId - works fine(even without contentType works fine)
But If I remove Get method DELETE Operation with id and version works
@Path("v2/test”)
Class Test{
@DELETE
@Path(“{testPath: .+}")
@Produces(MediaType.APPLICATION_JSON)
public Response deleteValue(@PathParam("testPath")
String testPath) throws Exception {
//do something }
}
DELETE : http://localhost:8080/v2/test/testId - works
DELETE : http://localhost:8080/v2/test/testId/1.0 - works
Could some one please help on how can I fix this ? I want get and delete methods in above mentioned format how can I achieve this ?
Jdk : 1.6 Jersey : 1.10 Server : weblogic
Create another DELETE-method with the same parameters as
getValue: