@Override
  protected void doGet(HttpServletRequest req, HttpServletResponse resp)
    throws ServletException, IOException {
    try {
      URL indexResource = getServletContext().getResource("/index.html");
      String content = IOUtils.toString(indexResource, StandardCharsets.UTF_8);
      // read original content from resource
      if (bodyAddon != null) {
        if (content.contains(TAG_BODY_CLOSING)) {
          content = content.replace(TAG_BODY_CLOSING, bodyAddon + TAG_BODY_CLOSING);
        } else if (content.contains(TAG_HTML_CLOSING)) {
          content = content.replace(TAG_HTML_CLOSING, bodyAddon + TAG_HTML_CLOSING);
        } else {
          content = content + bodyAddon;
        }
      }
      // process head addon
      if (headAddon != null) {
        if (content.contains(TAG_HEAD_CLOSING)) {
          content = content.replace(TAG_HEAD_CLOSING, headAddon + TAG_HEAD_CLOSING);
        } else if (content.contains(TAG_BODY_OPENING)) {
          content = content.replace(TAG_BODY_OPENING, headAddon + TAG_BODY_OPENING);
        } else {
          LOGGER.error(
            "Unable to process Head html addon. Could not find proper anchor in index.html.");
        }
      }
      resp.setContentType("text/html");
      resp.setStatus(HttpServletResponse.SC_OK);
      resp.getWriter().append(content);
    } catch (IOException e) {
      LOGGER.error("Error rendering index.html.", e);
    }
  }
@Test
    @Disabled("ignored due to zeppelin-web-angular not build for core tests")
    void testZeppelinWebAngularHtmlAddon() throws IOException, ServletException {
      ZeppelinConfiguration zConf = mock(ZeppelinConfiguration.class);
      when(zConf.getHtmlBodyAddon()).thenReturn(TEST_BODY_ADDON);
      when(zConf.getHtmlHeadAddon()).thenReturn(TEST_HEAD_ADDON);

      ServletConfig sc = mock(ServletConfig.class);
      ServletContext ctx = mock(ServletContext.class);
      when(ctx.getResource("/index.html"))
        .thenReturn(new URL("file:" + FILE_PATH_INDEX_HTML_ZEPPELIN_WEB_ANGULAR));
      when(sc.getServletContext()).thenReturn(ctx);

      IndexHtmlServlet servlet = new IndexHtmlServlet(zConf);
      servlet.init(sc);

      HttpServletResponse mockResponse = mock(HttpServletResponse.class);
      HttpServletRequest mockRequest = mock(HttpServletRequest.class);
      ByteArrayOutputStream out = new ByteArrayOutputStream();
      PrintWriter writer = new PrintWriter(out);
      when(mockResponse.getWriter()).thenReturn(writer);

      servlet.doGet(mockRequest, mockResponse);
      writer.flush();
      // Get Content
      String content = new String(out.toString());

      assertThat(content, containsString(TEST_BODY_ADDON));
      assertThat(content, containsString(TEST_HEAD_ADDON));

    }