code: static void handleCommand(
        String command, HttpServletRequest request, HttpServletResponse response) {
      response.setContentType("application/json");
      boolean isPost = "POST".equals(request.getMethod());
      JSONObject retValue = null;
      try {
        if (command.equals(LIST_JOBS_PATH) && !isPost) {
          retValue = handleListJobs(request);
        } else if (command.equals(CLEANUP_JOB_PATH) && isPost) {
          retValue = handleCleanupJob(request.getParameter("mapreduce_id"));
        } else if (command.equals(ABORT_JOB_PATH) && isPost) {
          retValue = handleAbortJob(request.getParameter("mapreduce_id"));
        } else if (command.equals(GET_JOB_DETAIL_PATH) && !isPost) {
          retValue = handleGetJobDetail(request.getParameter("mapreduce_id"));
        }
      } catch (Exception t) {
        log.log(Level.SEVERE, "Got exception while running command", t);
        try {
          retValue = new JSONObject();
          retValue.put("error_class", t.getClass().getName());
          retValue.put("error_message",
              "Full stack trace is available in the server logs. Message: "
                  + t.getMessage());
        } catch (JSONException e) {
          throw new RuntimeException("Couldn't create error JSON object", e);
        }
      }
      try {
        if (retValue == null) {
          response.sendError(HttpServletResponse.SC_NOT_FOUND);
        } else {
          retValue.write(response.getWriter());
          response.getWriter().flush();
        }
      } catch (JSONException | IOException e) {
        throw new RuntimeException("Couldn't write command response", e);
      }
    }
docs: Handles all status page commands.