class LoginSuccessHandler implements AuthenticationSuccessHandler {

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

    @Override
    public void onAuthenticationSuccess(HttpServletRequest request,
                                        HttpServletResponse response, Authentication authentication)
                                        throws ServletException, IOException {<FILL_FUNCTION_BODY>}
}


        logger.info("USER " + authentication.getName()+ " LOGIN SUCCESS.");

        SavedRequest savedRequest = new HttpSessionRequestCache().getRequest(request, response);
        String originUrl = "";
        try {
            originUrl = savedRequest.getRedirectUrl();
        } catch (Exception e) {
            logger.debug(e.toString());
        }

        if (savedRequest != null) {
            logger.info("Original url is: " + originUrl);
        }

        Map<String, String> content = new HashMap<>();
        content.put("code", "0");
        content.put("message", "Login success");
        content.put("redirectUrl", originUrl);
        // 直接进行sendRedirect到登录前的url，会重定向失败。具体原因可google ajax and sendRedirect
        response.setContentType(MediaType.APPLICATION_JSON_VALUE);
        response.getWriter().write(JSON.toJSONString(content));
    
<no_super_class>