@Override
    public void execute(RequestContext requestContext) {
        String method = null;
        ProcessResult result = new ProcessResult();
        StringBuilder sBuffer = new StringBuilder();
        long startTime = System.currentTimeMillis();
        try {
            HttpServletRequest req = requestContext.getReq();
            if (this.master.isStopped()) {
                throw new Exception("Server is stopping...");
            }
            MetaDataService defMetaDataService = this.master.getMetaDataService();
            if (!defMetaDataService.isSelfMaster()) {
                throw new StandbyException("Please send your request to the master Node.");
            }
            method = req.getParameter("method");
            String strCallbackFun = req.getParameter("callback");
            if ((TStringUtils.isNotEmpty(strCallbackFun))
                    && (strCallbackFun.length() <= TBaseConstants.META_MAX_CALLBACK_STRING_LENGTH)
                    && (strCallbackFun.matches(TBaseConstants.META_TMP_CALLBACK_STRING_VALUE))) {
                strCallbackFun = strCallbackFun.trim();
            }
            if (method == null) {
                throw new Exception("Please take with method parameter!");
            }
            WebMethodMapper.WebApiRegInfo webApiRegInfo = getWebApiRegInfo(method);
            if (webApiRegInfo == null) {
                throw new Exception("unsupported method!");
            }
            // check master is current node
            if (webApiRegInfo.onlyMasterOp
                    && defMetaDataService.isPrimaryNodeActive()) {
                throw new Exception(
                        "DesignatedPrimary happened...please check if the other member is down");
            }
            // valid operation authorize info
            if (!WebParameterUtils.validReqAuthorizeInfo(req,
                    webApiRegInfo.needAuthToken, master, sBuffer, result)) {
                throw new Exception(result.getErrMsg());
            }
            sBuffer = (StringBuilder) webApiRegInfo.method.invoke(
                    webApiRegInfo.webHandler, req, sBuffer, result);
            // Carry callback information
            if (TStringUtils.isEmpty(strCallbackFun)) {
                requestContext.put("sb", sBuffer.toString());
            } else {
                requestContext.put("sb", strCallbackFun + "(" + sBuffer.toString() + ")");
                requestContext.getResp().addHeader("Content-type", "text/plain");
                requestContext.getResp().addHeader("charset", TBaseConstants.META_DEFAULT_CHARSET_NAME);
            }
        } catch (Throwable e) {
            sBuffer.append("{\"result\":false,\"errCode\":400,\"errMsg\":\"Bad request from client, ")
                    .append(e.getMessage()).append("\"}");
            requestContext.put("sb", sBuffer.toString());
        } finally {
            WebCallStatsHolder.addMethodCall(method, System.currentTimeMillis() - startTime);
        }
    }
Public APIs for master

Encapsulate query and modify logic mainly.
Generate output JSON by concatenating strings, to improve the performance.
inlong-tubemq/tubemq-server/src/main/java/org/apache/inlong/tubemq/server/master/web/action/screen/Webapi.java