From 9352e6b8eb328adcac1c26afbe256d7b7ebfb0a5 Mon Sep 17 00:00:00 2001
From: RuoYi <yzz_ivy@163.com>
Date: 星期二, 22 三月 2022 16:49:22 +0800
Subject: [PATCH] 添加新群号:167385320
---
src/main/java/com/ruoyi/common/utils/ServletUtils.java | 30 ++++++++++++++++++++----------
1 files changed, 20 insertions(+), 10 deletions(-)
diff --git a/src/main/java/com/ruoyi/common/utils/ServletUtils.java b/src/main/java/com/ruoyi/common/utils/ServletUtils.java
index 9e6fd59..d67b246 100644
--- a/src/main/java/com/ruoyi/common/utils/ServletUtils.java
+++ b/src/main/java/com/ruoyi/common/utils/ServletUtils.java
@@ -49,6 +49,22 @@
}
/**
+ * 鑾峰彇Boolean鍙傛暟
+ */
+ public static Boolean getParameterToBool(String name)
+ {
+ return Convert.toBool(getRequest().getParameter(name));
+ }
+
+ /**
+ * 鑾峰彇Boolean鍙傛暟
+ */
+ public static Boolean getParameterToBool(String name, Boolean defaultValue)
+ {
+ return Convert.toBool(getRequest().getParameter(name), defaultValue);
+ }
+
+ /**
* 鑾峰彇request
*/
public static HttpServletRequest getRequest()
@@ -83,9 +99,8 @@
*
* @param response 娓叉煋瀵硅薄
* @param string 寰呮覆鏌撶殑瀛楃涓�
- * @return null
*/
- public static String renderString(HttpServletResponse response, String string)
+ public static void renderString(HttpServletResponse response, String string)
{
try
{
@@ -98,7 +113,6 @@
{
e.printStackTrace();
}
- return null;
}
/**
@@ -109,13 +123,13 @@
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;
}
@@ -127,10 +141,6 @@
}
String ajax = request.getParameter("__ajax");
- if (StringUtils.inStringIgnoreCase(ajax, "json", "xml"))
- {
- return true;
- }
- return false;
+ return StringUtils.inStringIgnoreCase(ajax, "json", "xml");
}
}
--
Gitblit v1.9.3