mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
WebStatFilter support exclustions
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.alibaba.druid.util;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
public class DruidWebUtils {
|
||||
@@ -18,4 +19,26 @@ public class DruidWebUtils {
|
||||
|
||||
return ip;
|
||||
}
|
||||
|
||||
private static String getContextPath_2_5(ServletContext context) {
|
||||
String contextPath = context.getContextPath();
|
||||
|
||||
if (contextPath == null || contextPath.length() == 0) {
|
||||
contextPath = "/";
|
||||
}
|
||||
|
||||
return contextPath;
|
||||
}
|
||||
|
||||
public static String getContextPath(ServletContext context) {
|
||||
if (context.getMajorVersion() == 2 && context.getMinorVersion() < 5) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
return getContextPath_2_5(context);
|
||||
} catch (NoSuchMethodError error) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user