title: How to deploy a JAX-RS application?
body: <p>The JAX-RS 1.1 specification says on page 6:</p>
  
  <blockquote>
    <p>If no Application subclass is present
    the added servlet MUST be named:</p>
  
  <pre><code>javax.ws.rs.core.Application
  </code></pre>
  </blockquote>
  
  <p>What is the added servlet? Could it be an arbitrary servlet?</p>
  
  <blockquote>
    <p>If an Application subclass is present
    and there is already a servlet defined
    that has a servlet initialization
    parameter named:</p>
  
  <pre><code>javax.ws.rs.Application
  </code></pre>
  </blockquote>
  
  <p>Again, what is "a servlet" here?</p>
  
  <blockquote>
    <p>If an Application subclass is present
    that is not being handled by an
    existing servlet then the servlet
    added by the ContainerInitializer MUST
    be named with the fully qualified name
    of the Application subclass.</p>
  </blockquote>
  
  <p>Does "the servlet added by the ContainerInitializer" mean that the servlets is added automatically? How would a configuration look like?</p>
  
  <p>At the moment I use neither an Application class nor a web.xml and it works (with GlassFish 3.1). Does this deployment mechanism require a full class path scan, which could be slow with big libraries? </p>
  
  <p>How to deploy on a Servlet container? </p>
  
  <p>There is a confusing number of configuration options around in the web. See this <a href="http://architects.dzone.com/articles/putting-java-rest" rel="noreferrer">example with context params in the web.xml</a> (doesn't work for me!). What is the preferred way to deploy a JAX-RS application? </p>