title: Sending HTML with JS through Java JAX-RS REST Service
body: <p>I am writing a REST service providing 2 things:<br>
  1. Data information (which are read from a database)<br>
  2. A web-application (i.e. a webpage)</p>
  
  <p>So currently I only have an index page and I return this html file in a REST request. My Service class for this looks like that:</p>
  
  <pre><code>@Path("web")
  public class MainPages {
      @GET
      @Produces(MediaType.TEXT_HTML)
      public InputStream getIndex(){
      File index = new File("webapp/pages/index.html");
      try {
          return new FileInputStream(index);
      } catch (FileNotFoundException e) {
          String s = "ERROR";
          return new ByteArrayInputStream(s.getBytes(StandardCharsets.UTF_8));
      }
  }
  </code></pre>
  
  <p>Now in the HTML file I try to include some javascript file which is placed in the same folder as the HTML file.
  The header of the HTML file looks like this:</p>
  
  <pre><code>&lt;html ng-app&gt;
  &lt;head&gt;
      &lt;meta charset="utf8" /&gt;
      &lt;title&gt;Welcome&lt;/title&gt;
      &lt;script type="text/javascript" src="angular.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  </code></pre>
  
  <p>The problem I am facing now is, that the src is not getting the file but instead the REST Service is activated, as you can see in this image:
  <a href="https://i.stack.imgur.com/Ufjv7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ufjv7.png" alt="enter image description here"></a></p>
  
  <p>I think I am missing some important information here.<br>
  But my question is: How can I tell the page to look in the folder and not to request the file from the REST?<br>
  Or do I need to add the corresponding Path to the REST Service and return the javascript file there?</p>