Mercurial > lada > lada-server
comparison src/main/java/de/intevation/rest/LProbeRESTService.java @ 8:1016bcc08bb3
Added stub for REST service for Proben
author | Torsten Irländer <torsten.irlaender@intevation.de> |
---|---|
date | Thu, 18 Apr 2013 13:15:23 +0200 |
parents | |
children | 624611a29348 |
comparison
equal
deleted
inserted
replaced
7:8bffb9e465c9 | 8:1016bcc08bb3 |
---|---|
1 package de.intevation.rest; | |
2 | |
3 import javax.enterprise.context.RequestScoped; | |
4 import javax.inject.Inject; | |
5 import javax.persistence.EntityManager; | |
6 import javax.ws.rs.GET; | |
7 import javax.ws.rs.Path; | |
8 import javax.ws.rs.Produces; | |
9 | |
10 /** | |
11 * JAX-RS Example | |
12 * | |
13 * This class produces a RESTful service to read the contents of the members table. | |
14 */ | |
15 | |
16 @Path("/proben") | |
17 @RequestScoped | |
18 public class LProbeRESTService { | |
19 | |
20 //@Inject | |
21 //private EntityManager em; | |
22 | |
23 @GET | |
24 @Produces("text/plain") | |
25 public String listAllMembers() { | |
26 return "Probenliste"; | |
27 } | |
28 | |
29 @GET | |
30 @Path("/{id:[0-9][0-9]*}") | |
31 @Produces("text/plain") | |
32 public String loadById() { | |
33 return "Eine Probe!"; | |
34 } | |
35 | |
36 //@GET | |
37 //@Produces("text/xml") | |
38 //public List<Member> listAllMembers() { | |
39 // // Use @SupressWarnings to force IDE to ignore warnings about "genericizing" the results of | |
40 // // this query | |
41 // @SuppressWarnings("unchecked") | |
42 // // We recommend centralizing inline queries such as this one into @NamedQuery annotations on | |
43 // // the @Entity class | |
44 // // as described in the named query blueprint: | |
45 // // https://blueprints.dev.java.net/bpcatalog/ee5/persistence/namedquery.html | |
46 // final List<Member> results = em.createQuery("select m from Member m order by m.name").getResultList(); | |
47 // return results; | |
48 //} | |
49 | |
50 //@GET | |
51 //@Path("/{id:[0-9][0-9]*}") | |
52 //@Produces("text/xml") | |
53 //public Member lookupMemberById(@PathParam("id") long id) { | |
54 // return em.find(Member.class, id); | |
55 //} | |
56 } |