title: Show images that are outside project folder jsf glassfish
body: <p>I want to show some images to users, which  are located here:</p>
  
  <pre><code>C:\Users\advert_images
  </code></pre>
  
  <p>I am using primefaces and showing using servelet:</p>
  
  <pre><code>   @WebServlet("/advert_images/*")
  public class ImagesServlet extends HttpServlet {
  
      @Override
      protected
              void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
          String filename = request.getPathInfo().substring(1);
          File file = new File("C:\\Users\\advert_images\\", filename);
          response.setHeader("Content-Type", getServletContext().getMimeType(filename));
          response.setHeader("Content-Length", String.valueOf(file.length()));
          response.setHeader("Content-Disposition", "inline; filename=\"" + filename + "\"");
          Files.copy(file.toPath(), response.getOutputStream());
      }
  </code></pre>
  
  <p>}</p>
  
  <p>So when I type in browser this:</p>
  
  <pre><code>http://localhost:8080/vas-plus/advert_images/3.jpg
  </code></pre>
  
  <p>I get my image.</p>
  
  <p>But  when I try to write in my xhtml </p>
  
  <pre><code> &lt;img src ="http://localhost:8080/vas-plus/advert_images/3.jpg"/&gt;
  </code></pre>
  
  <p>Or:</p>
  
  <pre><code> &lt;h:graphicImage class="test" value="/advert_images/3.jpg"/&gt;
  </code></pre>
  
  <p>I have no image displayed. And also something this as html output:</p>
  
  <pre><code>&lt;img src="/vas-plus/advert_images/3.jpg" class="test" width="0" height="0" style="display: none !important; visibility: hidden !important; opacity: 0 !important; background-position: 1px 1px;"&gt;
  </code></pre>
  
  <p>When I use Google Chrome developerTools to see resources of html page I see this:
  <img src="https://i.stack.imgur.com/g6lK5.jpg" alt="enter image description here"></p>
  
  <p>So I am a little confused any Ideas?</p>