Commit 3108ef50 by 刘宇峰

框架完善

1 parent f6650266
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
*/ */
package com.glsx.plat.common.utils; package com.glsx.plat.common.utils;
import org.springframework.util.AntPathMatcher;
import java.io.*; import java.io.*;
import java.util.*; import java.util.*;
...@@ -145,6 +147,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils { ...@@ -145,6 +147,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
/** /**
* 将null转空字符串 * 将null转空字符串
*
* @param origin * @param origin
* @return * @return
*/ */
...@@ -255,15 +258,41 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils { ...@@ -255,15 +258,41 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
return false; return false;
} }
/**
* 判断当前访问的url是否开头URI是在配置的忽略url列表中
*
* @param url
* @return
*/
public static boolean isMatchedStr(String[] skipAuthUrls, String url) {
if (StringUtils.isEmpty(url)) {
return false;
}
if (Objects.isNull(skipAuthUrls)) {
return false;
}
AntPathMatcher matcher = new AntPathMatcher();
for (String skipAuthUrl : skipAuthUrls) {
if (matcher.match(skipAuthUrl, url)) {
return true;
}
}
return false;
}
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static <T> T cast(Object obj) { public static <T> T cast(Object obj) {
return (T) obj; return (T) obj;
} }
// public static void main(String[] args) throws UnsupportedEncodingException { // public static void main(String[] args) throws UnsupportedEncodingException {
// System.out.println("中文a".getBytes("UTF-8").length); //7 //// System.out.println("中文a".getBytes("UTF-8").length); //7
// System.out.println(getStrLength("中文a")); //7 //// System.out.println(getStrLength("中文a")); //7
// System.out.println("中文a".length()); //3 //// System.out.println("中文a".length()); //3
//
// String[] skipAuthUrls = new String[]{"/login/check", "/api/**", "/**/v3/api-docs", "/open/api/access/queryAccessToken"};
// boolean flag = isMatchedStr(skipAuthUrls, "/platform-shopmall/v3/api-docs");
// System.out.println(flag);
// } // }
} }
...@@ -20,12 +20,6 @@ ...@@ -20,12 +20,6 @@
<dependency> <dependency>
<groupId>com.glsx</groupId> <groupId>com.glsx</groupId>
<artifactId>rest-admin-context</artifactId> <artifactId>rest-admin-context</artifactId>
<exclusions>
<exclusion>
<groupId>com.glsx</groupId>
<artifactId>rest-admin-jwt</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.github.kuhn-he</groupId> <groupId>com.github.kuhn-he</groupId>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!