class ChatMsgAddValidationMidware {

    /**
     * Language service.
     */
    @Inject
    private LangPropsService langPropsService;

    /**
     * Option query service.
     */
    @Inject
    private OptionQueryService optionQueryService;

    /**
     * User query service.
     */
    @Inject
    private UserQueryService userQueryService;

    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 JSONObject currentUser = Sessions.getUser();
        if (System.currentTimeMillis() - currentUser.optLong(UserExt.USER_LATEST_CMT_TIME) < Symphonys.MIN_STEP_CHAT_TIME
                && !Role.ROLE_ID_C_ADMIN.equals(currentUser.optString(User.USER_ROLE))) {
            context.renderJSON(new JSONObject().put(Keys.MSG, langPropsService.get("tooFrequentCmtLabel")));
            context.abort();
            return;
        }

        String content = requestJSONObject.optString(Common.CONTENT);
        content = StringUtils.trim(content);
        if (StringUtils.isBlank(content) || content.length() > 4096) {
            context.renderJSON(new JSONObject().put(Keys.MSG, langPropsService.get("commentErrorLabel")));
            context.abort();
            return;
        }

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

        requestJSONObject.put(Common.CONTENT, content);
        context.handle();
    
<no_super_class>