title: HowTo configure the ErrorPageErrorHandler in embedded Jetty?
body: <p>Is it possible to configure the ErrorPageErrorHandler in way that it redirects to a static Page if no content/service is found?</p>
  
  <p>Here is my Code:</p>
  
  <pre><code>server = new Server(port);
  
      Resource webRoot = Resource.newResource(webContent);
      if (!webRoot.exists()) {
          logger.warn("Unable to find root resource:" + webRoot.getName());
      } else {
          logger.info("Root resource is " + webRoot.getName());
      }
  
      ResourceHandler res = new ResourceHandler();
      res.setBaseResource(webRoot);
      res.setDirAllowed(false);
  
      //servlet handler
      ServletContextHandler servletCtx = new ServletContextHandler(ServletContextHandler.SESSIONS);
      servletCtx.setContextPath("/service");
      servletCtx.addServlet(new ServletHolder("sample", new MyServletSample()), "/sample");
  
      ErrorPageErrorHandler errorHandler = new ErrorPageErrorHandler();
      errorHandler.addErrorPage(404, "index.html");
      servletCtx.setErrorHandler(errorHandler);
  
      // static file handler
      ContextHandler staticCtx = new ContextHandler("/");
      staticCtx.setBaseResource(webRoot);
      staticCtx.setHandler(res);
  
  
      // add handlers
      HandlerList handlerList = new HandlerList();
      handlerList.addHandler(servletCtx);
      handlerList.addHandler(staticCtx);
  
      // add handerList to server
      server.setHandler(handlerList);
  </code></pre>
  
  <p>This code show me index.html on localhost:8080 and I can access the sample service <a href="http://localhost:8080/service/sample" rel="nofollow noreferrer">http://localhost:8080/service/sample</a>. However, I want to show a static error page (i.e. documentation) to show up if an error like "404 Not Found" occured. </p>
  
  <p>With this code, the Error handler logs: </p>
  
  <blockquote>
    <p>"WARN  o.e.j.server.handler.ErrorHandler - No error page found
    index.html"</p>
  </blockquote>
  
  <p>. What is correct way/syntax to define the URI?</p>
  
  <p>Thanks in advance!</p>