这个类也是AdviceFilter的实现类,我们先看看他的preHandle方法
protected boolean preHandle(ServletRequest request, ServletResponse response) throws Exception {
if (this.appliedPaths == null || this.appliedPaths.isEmpty()) {
if (log.isTraceEnabled()) {
log.trace("appliedPaths property is null or empty. This Filter will passthrough immediately.");
}
return true;
}
for (String path : this.appliedPaths.keySet()) {
// If the path does match, then pass on to the subclass implementation for specific checks
//(first match 'wins'):
if (pathsMatch(path, request)) {
log.trace("Current requestURI match

本文探讨了Shiro框架中PathMatchingFilter类的功能和工作原理,它作为AdviceFilter的实现,处理预处理逻辑。重点在于appliedPaths属性及其在匹配访问路径中的作用。虽然PathMatchingFilter在某些场景下提供了便利,但其硬编码的权限配置可能限制了灵活性。文章建议在运行时动态配置权限的情况下避免使用此类,并介绍了其继承类如AccessControlFilter、AnonymousFilter和NoSessionCreationFilter的应用场景。
最低0.47元/天 解锁文章
5849

被折叠的 条评论
为什么被折叠?



