class UserCheckMidware {

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

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

        final String userName = context.pathVar("userName");
        if (UserExt.NULL_USER_NAME.equals(userName)) {
            context.sendError(404);
            context.abort();
        }

        final JSONObject user = userQueryService.getUserByName(userName);
        if (null == user) {
            context.sendError(404);
            context.abort();
            return;
        }

        if (UserExt.USER_STATUS_C_NOT_VERIFIED == user.optInt(UserExt.USER_STATUS)) {
            context.sendError(404);
            context.abort();
            return;
        }

        if (UserExt.USER_STATUS_C_INVALID == user.optInt(UserExt.USER_STATUS)) {
            context.sendError(404);
            context.abort();
            return;
        }

        context.attr(User.USER, user);
        context.handle();
    
<no_super_class>