package twopm.tech.bench.jaxrs;

import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;

@Path("/test")
public class TestResource {

    @GET
    @Path("/")
    @Produces("application/json")
    public String index() {
        return "{ \"status\" : \"OK\", \"method\" : \"GET\" }";
    }

    @GET
    @Path("{id}")
    @Produces("application/json")
    public String get(@PathParam("id") Long id) {
        return "{ \"status\" : \"OK\", \"method\" : \"GET\", \"test\" : " + String.valueOf(id) + " }";
    }

    @POST
    @Path("{id}")
    @Produces("application/json")
    public String post(@PathParam("id") Long id) {
        return "{ \"status\" : \"OK\", \"method\" : \"POST\", \"test\" : " + String.valueOf(id) + " }";
    }
}