public static boolean isAjaxRequest(HttpServletRequest request) {
        String ajaxHeader = request.getHeader("X-Requested-With");
        return StringUtils.isNotBlank(ajaxHeader) && "XMLHttpRequest".equalsIgnoreCase(ajaxHeader);
    }
public static boolean isAjaxRequest ( HttpServletRequest request ) { String ajaxHeader = request . getHeader ( "X-Requested-With" ) ; return StringUtils . isNotBlank ( ajaxHeader ) && "XMLHttpRequest" . equalsIgnoreCase ( ajaxHeader ) ; }
判断一个请求是否是Ajax请求

@param request Http请求
@return 是Ajax请求返回true, 否则返回false