2 Replies Latest reply on Jan 17, 2009 6:23 PM by mvlach

    REST service with Seam 2.1.1GA

    mvlach

      Hi, I'm trying to develop application that uses the REST. I create sample component



      @Path("/testurl")
      @Name("testUrl")
      public class RemoteTest implements RemoteTestLocal {
           @WebRemote
           @GET
           @ProduceMime("text/plain")
           @Path("/customerId")
           public String testIt(@PathParam("customerId")int id) {
                System.out.println("Asdfasdfas: " + id);
                return "aaa";
           }
      }





      with interface


      @Local
      @Path("/testurl") 
      public interface RemoteTestLocal {
           @WebRemote
           public String  testIt(@PathParam("customerId")int id);
      }



      and put all libraries to WEB-INF lib (resteasy, ...)


      But when I go to the page a get the 404 (The requested resource () is not available.)


      I'm using non EJB version, packaged as WAR file. Is this function only for EBJ or not ?


      Know somebody how to develop REST ?


      So the SOAP version (@WebService is only for EJB version, or not ??


      Thanks Mila

        • 1. Re: REST service with Seam 2.1.1GA
          jharting

          You should use @Path(/{customerId}) instead of the one you have on testIt method, and then access it on .../yourapp/seam/resource/testurl/1 for instance

          • 2. Re: REST service with Seam 2.1.1GA
            mvlach

            Hi,


            now the proof work. There are some problems:


            1. interface annotated by @Path - can't have constructor - IndexOutOfBoundsException
            2. the class wasn't visible (in hotdeploy /WEB-INF/dev folder)
            3. the path is case sensitive testurl vs. testUrl
            4. old version of seam (now I'm using 2.1.1GA)


            Now all works good.


            Thanks Mila