# HG changeset patch # User Torsten Irländer # Date 1366277795 -7200 # Node ID 39b0b108036f85e968cebfe1990596300fd9375e # Parent 79e1144949d9776526aeaa17aee7e0eaf759df22 Added test RESTService to play around. diff -r 79e1144949d9 -r 39b0b108036f src/main/java/de/intevation/rest/RESTService.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/de/intevation/rest/RESTService.java Thu Apr 18 11:36:35 2013 +0200 @@ -0,0 +1,51 @@ +package de.intevation.rest; + +import javax.enterprise.context.RequestScoped; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; + +@Path("/default") +@RequestScoped +public class RESTService { + + @GET + @Produces("text/xml") + public String listAll() { + return "Dies ist ein Test"; + } +} + +/** + * JAX-RS Example + * + * This class produces a RESTful service to read the contents of the members table. + +@Path("/members") +@RequestScoped +public class MemberResourceRESTService { + @Inject + private EntityManager em; + + @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); + } +} +*/