code: @Override
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
      JsonGenerator jg = null;
      String jsonpcb = null;
      PrintWriter writer = null;
      try {
  
        writer = response.getWriter();
  
        // "callback" parameter implies JSONP output
        jsonpcb = request.getParameter(CALLBACK_PARAM);
        if (jsonpcb != null) {
          response.setContentType("application/javascript; charset=utf8");
          writer.write(jsonpcb + "(");
        } else {
          response.setContentType("application/json; charset=utf8");
        }
  
        jg = jsonFactory.createJsonGenerator(writer);
        jg.disable(JsonGenerator.Feature.AUTO_CLOSE_TARGET);
        jg.useDefaultPrettyPrinter();
  
        int statusCode = renderMBeans(jg, request.getParameterValues("qry"));
        response.setStatus(statusCode);
  
      } catch (IOException e) {
        writeException(jg, e);
        response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
      } catch (MalformedObjectNameException e) {
        writeException(jg, e);
        response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
      } finally {
        if (jg != null) {
          jg.close();
        }
        if (jsonpcb != null) {
          writer.write(");");
        }
        if (writer != null) {
          writer.close();
        }
      }
  
    }
docs: Process a GET request for the specified resource.
  
  @param request
  The servlet request we are processing
  @param response
  The servlet response we are creating