@Override
  protected void doGet(final HttpServletRequest request, final HttpServletResponse response)
      throws ServletException, IOException {

    final RpcInfo rpc = JsonServerSyslog.getCurrentRpcInfo();
    rpc.setId(("" + Math.random()).substring(2));
    rpc.setIp(JsonServerServlet.getIpAddress(request, config));
    rpc.setMethod("GET");
    logHeaders(request);

    String path = request.getPathInfo();

    if (path == null) { // e.g. /docs
      handle404(request, response);
      return;
    }
    if (path.endsWith("/")) { // e.g. /docs/
      path = path + "index.html";
    }
    // the path is already normalized by the framework, so no need to
    // normalize here
    path = docsLoc + path;
    final InputStream is = getClass().getResourceAsStream(path);
    if (is == null) {
      handle404(request, response);
      return;
    }
    try {
      final byte[] page = IOUtils.toByteArray(is);
      response.getOutputStream().write(page);
    } catch (IOException ioe) {
      logger.logErr(request.getRequestURI() + " 500 " + request.getHeader(USER_AGENT));
      logger.logErr(ioe);
      response.sendError(500);
      return;
    }
    logger.logInfo(request.getRequestURI() + " 200 " + request.getHeader(USER_AGENT));
  }
 private void handle404(final HttpServletRequest request, final HttpServletResponse response)
     throws IOException {
   logger.logErr(request.getRequestURI() + " 404 " + request.getHeader(USER_AGENT));
   response.sendError(404);
 }