4 Replies Latest reply on Nov 7, 2011 1:57 PM by Mark Paluch

    resteasy in jboss

    nimo stephan Master

      I am using jboss as 6 m5 where resteasy is included and already configured for use.

       

      I use something like this in a pojo:

       

      @Path("/resources")
      public class Resources implements Serializable{


          @GET
          @Path("/hello")
          @Produces("text/plain")
          public String getHello()
          {
              return "Hello Restful WebService!";
          }


      }

       

       

      and want to access it with:

       

      http://localhost:8080/mywebapp/resources/hello

       

      but I get  HTTP Status 404.

       

       

      I also tried to access a resource from a stateless-sessionbean:

      @Path("/helloworld")
      @Stateless
      public class MyEJB implements MyEJBLocal{

      @GET
      @Produces("text/plain")
      public String getHello()
      {
      return "Hello Restful WebService!";
      }

      }


      and want to access it via
      http://localhost:8080/mywebapp/helloworld. It does not work.

       

       

      Should I define a servlet-mapping in my web.xml, something like this:

       

       

      <servlet-mapping>
         <servlet-name>Resteasy</servlet-name>
         <url-pattern>/resteasy/*</url-pattern>
      </servlet-mapping>

      and access it via http://localhost:8080/mywebapp/resteasy/resources/hello

      ?



      Note: I write this thread here as writing threads in the resteasy-section is actually disabled!