class CommentAddValidationMidware {

    public void handle(final RequestContext context) {<FILL_FUNCTION_BODY>}
}

        final Request request = context.getRequest();
        final JSONObject requestJSONObject = context.requestJSON();
        request.setAttribute(Keys.REQUEST, requestJSONObject);
        final BeanManager beanManager = BeanManager.getInstance();
        final LangPropsService langPropsService = beanManager.getReference(LangPropsService.class);
        final OptionQueryService optionQueryService = beanManager.getReference(OptionQueryService.class);
        final ArticleQueryService articleQueryService = beanManager.getReference(ArticleQueryService.class);
        final CommentQueryService commentQueryService = beanManager.getReference(CommentQueryService.class);

        final JSONObject exception = new JSONObject();
        exception.put(Keys.CODE, StatusCodes.ERR);

        final String commentContent = StringUtils.trim(requestJSONObject.optString(Comment.COMMENT_CONTENT));
        if (StringUtils.isBlank(commentContent) || commentContent.length() > Comment.MAX_COMMENT_CONTENT_LENGTH) {
            context.renderJSON(exception.put(Keys.MSG, langPropsService.get("commentErrorLabel")));
            context.abort();
            return;
        }

        if (optionQueryService.containReservedWord(commentContent)) {
            context.renderJSON(exception.put(Keys.MSG, langPropsService.get("contentContainReservedWordLabel")));
            context.abort();
            return;
        }

        final String articleId = requestJSONObject.optString(Article.ARTICLE_T_ID);
        if (StringUtils.isBlank(articleId)) {
            context.renderJSON(exception.put(Keys.MSG, langPropsService.get("commentArticleErrorLabel")));
            context.abort();
            return;
        }

        final JSONObject article = articleQueryService.getArticleById(articleId);
        if (null == article) {
            context.renderJSON(exception.put(Keys.MSG, langPropsService.get("commentArticleErrorLabel")));
            context.abort();
            return;
        }

        if (!article.optBoolean(Article.ARTICLE_COMMENTABLE)) {
            context.renderJSON(exception.put(Keys.MSG, langPropsService.get("notAllowCmtLabel")));
            context.abort();
            return;
        }

        final String originalCommentId = requestJSONObject.optString(Comment.COMMENT_ORIGINAL_COMMENT_ID);
        if (StringUtils.isNotBlank(originalCommentId)) {
            final JSONObject originalCmt = commentQueryService.getComment(originalCommentId);
            if (null == originalCmt) {
                context.renderJSON(exception.put(Keys.MSG, langPropsService.get("commentArticleErrorLabel")));
                context.abort();
                return;
            }
        }

        context.handle();
    
<no_super_class>