2.7.0版本getContextPath方法:
protected String getContextPath(URL url) {
String contextPath = url.getPath();
return contextPath.endsWith("/") ? contextPath.substring(0,contextPath.length()-1) : contextPath;
}
无法将方法置入web容器中,退回2.6.5版本的方法:
protected String getContextPath(URL url) {
int pos = url.getPath().lastIndexOf("/");
return pos > 0 ? url.getPath().substring(0, pos) : "";
}
使用正常,两个方法应该不等价的。
2.7.0版本getContextPath方法:
无法将方法置入web容器中,退回2.6.5版本的方法:
使用正常,两个方法应该不等价的。