MCPcopy Create free account
hub / github.com/diyhi/bbs / DisablePath

Class DisablePath

src/main/java/cms/utils/DisablePath.java:20–55  ·  view source on GitHub ↗

禁止路径

Source from the content-addressed store, hash-verified

18 *
19 */
20public class DisablePath {
21 private static final Logger logger = LogManager.getLogger(DisablePath.class);
22
23 private static final Set<String> disablePathSet = new HashSet<String>();//URL禁止路径
24
25 /**
26 * 禁止路径初始化
27 */
28 static{
29 Properties props = new Properties();
30 //取得当前系统使用的目录
31
32 org.springframework.core.io.Resource resource = new ClassPathResource("/disablePath.properties");//读取配置文件
33
34 try (InputStream is = resource.getInputStream()){
35 props.load(is);//得到当前类的类加载器,以流的方式读取配置文件
36
37 Iterator itr = props.entrySet().iterator();
38 while (itr.hasNext()){
39 Entry e = (Entry)itr.next();
40
41 if(e.getKey().toString().startsWith("path")){//path为禁止路径前缀
42 disablePathSet.add(e.getValue().toString().trim().toLowerCase());
43 }
44 }
45 } catch (IOException e) {
46 if (logger.isErrorEnabled()) {
47 logger.error("禁止路径初始化",e);
48 }
49 }
50 }
51
52 public static Set<String> getPath(){
53 return disablePathSet;
54 }
55}

Callers

nothing calls this directly

Calls 7

loadMethod · 0.80
hasNextMethod · 0.80
nextMethod · 0.80
getKeyMethod · 0.80
iteratorMethod · 0.45
toStringMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…