cn.dreampie.common.web.handler.SkipHandler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jfinal-dreampie Show documentation
Show all versions of jfinal-dreampie Show documentation
jfinal shiro-freemarker plugins
package cn.dreampie.common.web.handler;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Created by wangrenhui on 2014/6/24.
*/
public class SkipHandler extends FakeStaticHandler {
/**
* 跳过的url
*/
private String[] skipUrls;
public SkipHandler(String... skipUrls) {
this.skipUrls = skipUrls;
}
@Override
public void handle(String target, HttpServletRequest request, HttpServletResponse response, boolean[] isHandled) {
if (checkSkip(target)) {
return;
}
nextHandler.handle(target, request, response, isHandled);
}
public boolean checkSkip(String skipUrl) {
if (skipUrls != null && skipUrls.length > 0) {
for (String url : skipUrls) {
if (antPathMatcher.match(url, skipUrl)) {
return true;
}
}
}
return false;
}
}