4 Replies Latest reply on Mar 13, 2013 4:06 AM by Mark Paluch

    Simple JAX-RS

    klind Newbie

      Hi, I am trying to create a simple JAX-RS.

       

       

      <web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
        
                <listener>
                          <listener-class>
                                    org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap
                          </listener-class>
                </listener>
        
                <!-- Servlets -->
                <servlet>
                          <servlet-name>Resteasy</servlet-name>
                          <servlet-class>
                                    org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher
                          </servlet-class>
                </servlet>
        
                <servlet-mapping>
                          <servlet-name>Resteasy</servlet-name>
                          <url-pattern>/profitmock/*</url-pattern>
                </servlet-mapping>
      
                <!-- Default page to serve -->
                <welcome-file-list>
                          <welcome-file>test.html</welcome-file>
                </welcome-file-list>
        </web-app>
      
      

       

       

      @Path("api")
      @Produces(MediaType.APPLICATION_JSON)
      public class ProfitMock  {
          
                @GET
                @Path("list")
                @Produces(MediaType.APPLICATION_JSON)
          public String list() {
              return "Hello World, I still need some work to be useful!";
          }
        }
      
      

       

       

       

      From the jboss console... 
      
      Registering web context: /profitMock-3.30.2-SNAPSHOT
      

       

      I use SoapUI to test, but I get this response :

       

      HTTP Status 404 - Could not find resource for relative : /profitmock/api/list of full path: http://localhost:8080/profitMock-3.30.2-SNAPSHOT/profitmock/api/list

       

      The

       

      http://localhost:8080/profitMock-3.30.2-SNAPSHOT/

      return the test html page.