class LoginFailureHandler implements AuthenticationFailureHandler {

    protected final Logger logger = LoggerFactory.getLogger(this.getClass());

    @Override
    public void onAuthenticationFailure(HttpServletRequest request,
                                        HttpServletResponse response, AuthenticationException exception)
                                        throws ServletException, IOException {<FILL_FUNCTION_BODY>}

}


        logger.info("Login failed. " + request.getRequestURL() +
                " username: " + request.getParameter("username") +
                " password: " + request.getParameter("password") );

        response.setContentType(MediaType.APPLICATION_JSON_VALUE);
        response.getWriter().write("{\"code\":1, \"message\":\"Login failed.\"}");
    
<no_super_class>