class Result {
        Object data;
        ErrorCode errorCode;

        public Result(ErrorCode errorCode) {
            this.errorCode = errorCode;
        }

        public Result(ErrorCode errorCode, Object data) {
            this.data = data;
            this.errorCode = errorCode;
        }

        public Object getData() {
            return data;
        }

        public ErrorCode getErrorCode() {
            return errorCode;
        }
    }

    protected interface ApiCallback {
        Result onResult(byte[] response);
    }

    public ErrorCode preAction(Request request, Response response) {
        if (getClass().getAnnotation(RequireAuthentication.class) != null) {
            //do authentication
        }

        return ERROR_CODE_SUCCESS;
    }
	public boolean doAction(Request request, Response response) {<FILL_FUNCTION_BODY>

        ErrorCode errorCode = preAction(request, response);
        boolean isSync = true;
        if (errorCode == ErrorCode.ERROR_CODE_SUCCESS) {
            //事务逻辑有缺陷，先注释掉
//            if (isTransactionAction() && !(this instanceof IMAction)) {
//                DBUtil.beginTransaction();
//                try {
//                    action(request, response);
//                    DBUtil.commit();
//                } catch (Exception e) {
//                    e.printStackTrace();
//                    DBUtil.roolback();
//                    throw e;
//                }
//            } else {
            isSync = action(request, response);
//            }
        } else {
            response.setStatus(HttpResponseStatus.OK);
            if (errorCode == null) {
                errorCode = ErrorCode.ERROR_CODE_SUCCESS;
            }

            RestResult result = RestResult.resultOf(errorCode, errorCode.getMsg(), RestResult.resultOf(errorCode));
            response.setContent(gson.toJson(result));
            response.send();
        }

        return isSync;
    
<no_super_class>