title: How do paths work in a Java deployed REST web service?
body: <p>Under <strong>Tomcat</strong> and <strong>Jersey</strong> libraries I created a REST web service described in this class:</p>
  
  <pre><code>package Servicios;
  
  import javax.ws.rs.core.Context;
  import javax.ws.rs.core.UriInfo;
  import javax.ws.rs.PathParam;
  import javax.ws.rs.Consumes;
  import javax.ws.rs.PUT;
  import javax.ws.rs.Path;
  import javax.ws.rs.GET;
  import javax.ws.rs.Produces;
  
  @Path("service")
  public class ServiceResource {
  
      @Context
      private UriInfo context;
  
      /**
       * Creates a new instance of ServiceResource
       */
      public ServiceResource() {
      }
  
      @GET
      @Produces("text/html")
      public String getHtml() {
  
          return "&lt;h1&gt;Here we are, at the contemplation of the most simple web service&lt;/h1&gt;";
      }
  
      @PUT
      @Consumes("text/html")
      public void putHtml(String content) {
      }
  }
  </code></pre>
  
  <p>So, as I set it before accessing to <code>http://localhost:8080/GetSomeRest</code> makes the default created <code>.jsp</code> file created. </p>
  
  <p>I set in project propierties (using NetBeans) a <em>relative URL</em> as <code>webresources/service</code>, so <code>service</code> part is same defined in <code>@Path("service")</code>. All works ok, going to <code>http://localhost:8080/GetSomeRest/webresources/service</code> makes the web service be consumed.</p>
  
  <p>But what if I want to <em>consume</em> that service right from <code>http://localhost:8080/GetSomeRest/service</code>? I tried to set only <code>service</code> in such relative URL and I got an <code>Error 404</code> message going to <code>http://localhost:8080/GetSomeRest/service</code></p>
  
  <p>How do virtual paths work?</p>
  
  <p>What would it mean to add an alias to a web service?</p>