Last active
February 1, 2016 20:00
-
-
Save ludovicfrin/96b5277820d899145a46 to your computer and use it in GitHub Desktop.
Contrôleur pour service RestFul Jersey
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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