1.需求
项目存在不同的子系统,需要根据不同的登录路径,登录成功后跳转不同的登录页面。
2.总体思路
将点击的路径记录到session中,登录成功后获取路径进行跳转
3.代码
目的是获得登录时的路径,保存到session中
public class CasAuthenticationRedirectextends extends CasAuthenticationEntryPoint { private static final Logger logger = LoggerFactory.getLogger(CasAuthenticationRedirectextends.class); private String serviceUrlBak=null; @Override protected String createServiceUrl(final HttpServletRequest request, final HttpServletResponse response) { if(serviceUrlBak==null){ serviceUrlBak=getServiceProperties().getService(); }else{ String ctx=request.getContextPath(); String requestURI=request.getRequestURI(); requestURI=requestURI.substring(requestURI.indexOf(ctx)+ctx.length(),requestURI.length()); String sessionid = request.getSession().getId(); reques