Embedded Jetty not serving webapp pages, REST calls OK
<p>I have a sample Maven project in Eclipse (Mars) with embedded jetty v9. I have defined a resource handler for static html / javascript files and a servlet handler for REST APIs. I create a single fat jar (shade package) and it does all I want when I run the jar from project homedir. It serves the rest API and web pages. From any other directory, it only serves up REST API. For HTML pages jetty server gives a reason not found.</p>

<p>Handlers are armed this way:</p>

<pre class="lang-java prettyprint-override"><code>    //REST handler context
    ServletContextHandler restHandler = new ServletContextHandler(ServletContextHandler.SESSIONS);
    restHandler.setContextPath("/");

    // Jersey REST handling servlet
    ServletHolder jerseyServlet = restHandler.addServlet(org.glassfish.jersey.servlet.ServletContainer.class, "/*");
    jerseyServlet.setInitOrder(0);

    // Tell Jersey which REST service class to load....
    jerseyServlet.setInitParameter("jersey.config.server.provider.classnames", RestHandler.class.getCanonicalName());

    // Handler that will handle the request for a given html page
    ResourceHandler resourceHandler = new ResourceHandler();

    // Configure page handler with login.html as the initial landing page
    resourceHandler.setDirectoriesListed(true);
    resourceHandler.setWelcomeFiles(new String[]{ "pages/login.html" });
    resourceHandler.setResourceBase("src/main/webapp/");

    //Add all handlers to the server
    Server jettyServer = new Server(8080);
    //ConstraintSecurityHandler authenticationHandler = authenticationService(jettyServer);
    //authenticationHandler.setHandler( resourceHandler );

    HandlerCollection handlerList = new HandlerCollection();
    handlerList.setHandlers(new Handler[] { resourceHandler,, 
                                            restHandler, 
                                            new DefaultHandler(), 
                                            });

    jettyServer.setHandler(handlerList);
</code></pre>

<p>Build clause in POM.xml is like this:</p>

<pre class="lang-xml prettyprint-override"><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
&lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;

&lt;build&gt;
  &lt;resources&gt;
    &lt;resource&gt;
        &lt;directory&gt;${project.basedir}/src/main/webapp&lt;/directory&gt;
    &lt;/resource&gt;
  &lt;/resources&gt;
  &lt;plugins&gt;
    &lt;plugin&gt;
      &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
      &lt;artifactId&gt;maven-shade-plugin&lt;/artifactId&gt;
      &lt;version&gt;1.6&lt;/version&gt;

      &lt;executions&gt;
        &lt;execution&gt;
          &lt;phase&gt;package&lt;/phase&gt;
          &lt;goals&gt;
            &lt;goal&gt;shade&lt;/goal&gt;
          &lt;/goals&gt;
          &lt;configuration&gt;
            &lt;transformers&gt;
              &lt;transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/&gt;
              &lt;transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"&gt;
                &lt;manifestEntries&gt;
                  &lt;Main-Class&gt;com.dastratum.DasConsole.ConsoleMain&lt;/Main-Class&gt;
                &lt;/manifestEntries&gt;
              &lt;/transformer&gt;
            &lt;/transformers&gt;
            &lt;minimizeJar&gt;false&lt;/minimizeJar&gt;
            &lt;createDependencyReducedPom&gt;true&lt;/createDependencyReducedPom&gt;
            &lt;filters&gt;
            &lt;filter&gt;
                &lt;artifact&gt;*:*&lt;/artifact&gt;
                &lt;excludes&gt;
                    &lt;exclude&gt;META-INF/*&lt;/exclude&gt;
                    &lt;exclude&gt;junit:junit&lt;/exclude&gt;
                &lt;/excludes&gt;
            &lt;/filter&gt;
            &lt;/filters&gt;
          &lt;/configuration&gt;
        &lt;/execution&gt;
      &lt;/executions&gt;
    &lt;/plugin&gt;
  &lt;/plugins&gt;
&lt;/build&gt;

&lt;/project&gt;
</code></pre>



<p>Any help appreciated. Thanks.</p>