Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Contrôleur pour service RestFul Jersey
package fr.frin.jersey;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import fr.frin.phonesync.webapp.entity.Sms;
/**
* Controleur
*
* @author Ludovic FRIN
*/
@Path("/entity")
public class Controller {
@GET
@Produces({ MediaType.APPLICATION_JSON })
public List<Entity> read() {
...
}
@GET @Path("{id}")
@Produces({ MediaType.APPLICATION_JSON })
public Entity read(@PathParam("id") Long id) {
...
}
@POST @Path("{id}")
@Consumes({MediaType.APPLICATION_JSON})
@Produces({ MediaType.APPLICATION_JSON })
public Entity create (Entity entity) {
...
}
@DELETE @Path("{id}")
@Produces({ MediaType.APPLICATION_JSON })
public Response delete (@PathParam("id") Long id) {
...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.