/[projects]/miscJava/Test4Simple/src/main/java/dk/thoerup/webservice/RestSimpleJerseyTest.java
ViewVC logotype

Contents of /miscJava/Test4Simple/src/main/java/dk/thoerup/webservice/RestSimpleJerseyTest.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2517 - (show annotations) (download)
Tue Apr 28 05:54:46 2015 UTC (9 years ago) by torben
File size: 729 byte(s)
Finally - jersey + moxy works :)
1 package dk.thoerup.webservice;
2
3 import java.io.Serializable;
4
5 import javax.ws.rs.GET;
6 import javax.ws.rs.Path;
7 import javax.ws.rs.Produces;
8 import javax.ws.rs.core.MediaType;
9 import javax.xml.bind.annotation.XmlRootElement;
10
11 @Path("/samples")
12 public class RestSimpleJerseyTest {
13
14
15 @Path("/simple")
16 @GET
17 @Produces(MediaType.TEXT_PLAIN)
18 public String getIt() {
19 return "Got it!";
20 }
21
22 @Path("/json")
23 @GET
24 @Produces(MediaType.APPLICATION_JSON)
25 public TestResponse getJSON() {
26 return new TestResponse(1, "Hej");
27 }
28
29 @Path("/xml")
30 @GET
31 @Produces(MediaType.APPLICATION_XML)
32 public TestResponse getXML() {
33 return new TestResponse(1, "Hej");
34 }
35
36
37
38
39
40 }

  ViewVC Help
Powered by ViewVC 1.1.20