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 |
} |