package dk.thoerup.webservice; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; @Path("/Rest") public class RestSimpleJerseyTest { public static class TestResponse { public int id; public String name; public TestResponse(int i, String n) { this.id = i; this.name = n; } } @Path("/Simple") @GET @Produces(MediaType.TEXT_PLAIN) public String getIt() { return "Got it!"; } @Path("/Object") @GET @Produces({"application/xml", "application/json"}) public TestResponse getObj() { return new TestResponse(1, "Hej"); } }