From ee2f74dc5e8495e82dd2a3c27e1ac37849c8c455 Mon Sep 17 00:00:00 2001 From: 疯狂的狮子li <15040126243@163.com> Date: 星期一, 14 二月 2022 14:27:13 +0800 Subject: [PATCH] Merge branch 'master' of https://gitee.com/y_project/RuoYi-Vue into dev --- ruoyi-common/src/main/java/com/ruoyi/common/utils/ServletUtils.java | 13 ++++--------- 1 files changed, 4 insertions(+), 9 deletions(-) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/ServletUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/ServletUtils.java index 5babaeb..6408c89 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/ServletUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/ServletUtils.java @@ -97,9 +97,8 @@ * * @param response 娓叉煋瀵硅薄 * @param string 寰呮覆鏌撶殑瀛楃涓� - * @return null */ - public static String renderString(HttpServletResponse response, String string) { + public static void renderString(HttpServletResponse response, String string) { try { response.setStatus(HttpStatus.HTTP_OK); response.setContentType(MediaType.APPLICATION_JSON_VALUE); @@ -108,7 +107,6 @@ } catch (IOException e) { e.printStackTrace(); } - return null; } /** @@ -119,12 +117,12 @@ public static boolean isAjaxRequest(HttpServletRequest request) { String accept = request.getHeader("accept"); - if (accept != null && accept.indexOf("application/json") != -1) { + if (accept != null && accept.contains("application/json")) { return true; } String xRequestedWith = request.getHeader("X-Requested-With"); - if (xRequestedWith != null && xRequestedWith.indexOf("XMLHttpRequest") != -1) { + if (xRequestedWith != null && xRequestedWith.contains("XMLHttpRequest")) { return true; } @@ -134,10 +132,7 @@ } String ajax = request.getParameter("__ajax"); - if (StringUtils.equalsAnyIgnoreCase(ajax, "json", "xml")) { - return true; - } - return false; + return StringUtils.equalsAnyIgnoreCase(ajax, "json", "xml"); } public static String getClientIP() { -- Gitblit v1.9.3