Spring Boot 或者Spring MVC 判断请求类型是否为Ajax请求
具体如下:
public static boolean isAjaxRequest(HttpServletRequest request) {
String requestedWith = request.getHeader("x-requested-with");
if (requestedWith != null && requestedWith.equalsIgnoreCase("XMLHttpRequest")) {
return true;
} else {
return false;
}
}
原创文章,作者:6024010,如若转载,请注明出处:https://blog.ytso.com/243653.html