class MyRolesAuthorizationFilter extends RolesAuthorizationFilter {

    @Override
    protected boolean onAccessDenied(ServletRequest request, ServletResponse response) throws IOException {<FILL_FUNCTION_BODY>}

}

        Subject subject = this.getSubject(request, response);
        if (subject.getPrincipal() == null) {
//            this.saveRequestAndRedirectToLogin(request, response);
            WebUtils.toHttp(response).sendError(401);
        } else {
            String unauthorizedUrl = this.getUnauthorizedUrl();
            if (StringUtils.hasText(unauthorizedUrl)) {
                WebUtils.issueRedirect(request, response, unauthorizedUrl);
            } else {
                WebUtils.toHttp(response).sendError(403);
            }
        }
        return false;
    
<methods>public void <init>() ,public boolean isAccessAllowed(javax.servlet.ServletRequest, javax.servlet.ServletResponse, java.lang.Object) throws java.io.IOException<variables>