Switched to jersey 2.3.5 due to jakarta being shit
parent
82d5d46fb3
commit
687cd0d4fb
@ -1,33 +1,31 @@
|
|||||||
package twopm.tech.bench.jaxrs;
|
package twopm.tech.bench.jaxrs;
|
||||||
|
|
||||||
import jakarta.ws.rs.GET;
|
import javax.ws.rs.GET;
|
||||||
import jakarta.ws.rs.POST;
|
import javax.ws.rs.POST;
|
||||||
import jakarta.ws.rs.Path;
|
import javax.ws.rs.Path;
|
||||||
import jakarta.ws.rs.PathParam;
|
import javax.ws.rs.PathParam;
|
||||||
import jakarta.ws.rs.Produces;
|
import javax.ws.rs.Produces;
|
||||||
|
import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
|
@Path("/test")
|
||||||
|
|
||||||
@Path("test")
|
|
||||||
public class TestResource {
|
public class TestResource {
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
// @Path("/")
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
@Produces("application/json")
|
|
||||||
public String index() {
|
public String index() {
|
||||||
return "{ \"status\" : \"OK\", \"method\" : \"GET\" }";
|
return "{ \"status\" : \"OK\", \"method\" : \"GET\" }";
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("{id}")
|
@Path("/{id}")
|
||||||
@Produces("application/json")
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
public String get(@PathParam("id") Long id) {
|
public String get(@PathParam("id") Long id) {
|
||||||
return "{ \"status\" : \"OK\", \"method\" : \"GET\", \"test\" : " + String.valueOf(id) + " }";
|
return "{ \"status\" : \"OK\", \"method\" : \"GET\", \"test\" : " + String.valueOf(id) + " }";
|
||||||
}
|
}
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@Path("{id}")
|
@Path("/{id}")
|
||||||
@Produces("application/json")
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
public String post(@PathParam("id") Long id) {
|
public String post(@PathParam("id") Long id) {
|
||||||
return "{ \"status\" : \"OK\", \"method\" : \"POST\", \"test\" : " + String.valueOf(id) + " }";
|
return "{ \"status\" : \"OK\", \"method\" : \"POST\", \"test\" : " + String.valueOf(id) + " }";
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue