优化对 .json .xml 后缀的URI会话失效后传递支持。
This commit is contained in:
@@ -110,7 +110,8 @@ public class ServletUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String uri = request.getRequestURI();
|
String uri = request.getRequestURI();
|
||||||
if (StringUtils.inStringIgnoreCase(uri, ".json", ".xml")){
|
if (StringUtils.endsWithIgnoreCase(uri, ".json")
|
||||||
|
|| StringUtils.endsWithIgnoreCase(uri, ".xml")){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -73,6 +73,14 @@ public class PermissionsAuthorizationFilter extends org.apache.shiro.web.filter.
|
|||||||
}
|
}
|
||||||
if (ServletUtils.isAjaxRequest(req)) {
|
if (ServletUtils.isAjaxRequest(req)) {
|
||||||
try {
|
try {
|
||||||
|
String uri = req.getRequestURI();
|
||||||
|
if (StringUtils.endsWithIgnoreCase(uri, ".json")
|
||||||
|
&& !StringUtils.endsWithIgnoreCase(loginUrl, ".json")){
|
||||||
|
loginUrl += ".json";
|
||||||
|
}else if (StringUtils.endsWithIgnoreCase(uri, ".xml")
|
||||||
|
&& !StringUtils.endsWithIgnoreCase(loginUrl, ".xml")){
|
||||||
|
loginUrl += ".xml";
|
||||||
|
}
|
||||||
request.getRequestDispatcher(loginUrl).forward(
|
request.getRequestDispatcher(loginUrl).forward(
|
||||||
new GetHttpServletRequestWrapper(request), response);
|
new GetHttpServletRequestWrapper(request), response);
|
||||||
} catch (ServletException e) {
|
} catch (ServletException e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user