修正当启用CAS并会话失效后,ajax调用接口返回404的问题

This commit is contained in:
thinkgem
2019-12-04 10:47:09 +08:00
parent fc84464786
commit 88cc1d85ac

View File

@@ -73,14 +73,15 @@ public class PermissionsAuthorizationFilter extends org.apache.shiro.web.filter.
} }
if (ServletUtils.isAjaxRequest(req)) { if (ServletUtils.isAjaxRequest(req)) {
try { try {
String uri = req.getRequestURI(); // String uri = req.getRequestURI();
if (StringUtils.endsWithIgnoreCase(uri, ".json") // if (StringUtils.endsWithIgnoreCase(uri, ".json")
&& !StringUtils.endsWithIgnoreCase(loginUrl, ".json")){ // && !StringUtils.endsWithIgnoreCase(loginUrl, ".json")){
loginUrl += ".json"; // loginUrl += ".json";
}else if (StringUtils.endsWithIgnoreCase(uri, ".xml") // }else if (StringUtils.endsWithIgnoreCase(uri, ".xml")
&& !StringUtils.endsWithIgnoreCase(loginUrl, ".xml")){ // && !StringUtils.endsWithIgnoreCase(loginUrl, ".xml")){
loginUrl += ".xml"; // loginUrl += ".xml";
} // }
loginUrl = Global.getAdminPath() + "/login";
request.getRequestDispatcher(loginUrl).forward( request.getRequestDispatcher(loginUrl).forward(
new GetHttpServletRequestWrapper(request), response); new GetHttpServletRequestWrapper(request), response);
} catch (ServletException e) { } catch (ServletException e) {