# HG changeset patch # User Torsten Irländer # Date 1366283723 -7200 # Node ID 1016bcc08bb39366823911dbf0ccf4494704148a # Parent 8bffb9e465c9f5cd4b7472052f82cca2a33b39f0 Added stub for REST service for Proben diff -r 8bffb9e465c9 -r 1016bcc08bb3 src/main/java/de/intevation/rest/LProbeRESTService.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/de/intevation/rest/LProbeRESTService.java Thu Apr 18 13:15:23 2013 +0200 @@ -0,0 +1,56 @@ +package de.intevation.rest; + +import javax.enterprise.context.RequestScoped; +import javax.inject.Inject; +import javax.persistence.EntityManager; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; + +/** + * JAX-RS Example + * + * This class produces a RESTful service to read the contents of the members table. +*/ + +@Path("/proben") +@RequestScoped +public class LProbeRESTService { + + //@Inject + //private EntityManager em; + + @GET + @Produces("text/plain") + public String listAllMembers() { + return "Probenliste"; + } + + @GET + @Path("/{id:[0-9][0-9]*}") + @Produces("text/plain") + public String loadById() { + return "Eine Probe!"; + } + + //@GET + //@Produces("text/xml") + //public List listAllMembers() { + // // Use @SupressWarnings to force IDE to ignore warnings about "genericizing" the results of + // // this query + // @SuppressWarnings("unchecked") + // // We recommend centralizing inline queries such as this one into @NamedQuery annotations on + // // the @Entity class + // // as described in the named query blueprint: + // // https://blueprints.dev.java.net/bpcatalog/ee5/persistence/namedquery.html + // final List results = em.createQuery("select m from Member m order by m.name").getResultList(); + // return results; + //} + + //@GET + //@Path("/{id:[0-9][0-9]*}") + //@Produces("text/xml") + //public Member lookupMemberById(@PathParam("id") long id) { + // return em.find(Member.class, id); + //} +}