springmvc的拦截器,怎么设置不拦截的url
展开全部
这是我的拦截器
<mvc:interceptors>
<mvc:interceptor>
<mvc:mapping path="/*/*.do" />
<bean class="com.cdxt.card.interceptor.SessionTimeoutInterceptor">
<property name="allowUrls">
<list>
<value>/yhxx/login.do</value>
<value>/yhxx/toLogin.do</value>
<value>/yhxx/sessionTimeOut.do</value>
</list>
</property>
</bean>
</mvc:interceptor>
</mvc:interceptors>
其中allowUrls就是不拦截的
在拦截器中
private List<String> allowUrls;
public List<String> getAllowUrls() {
return allowUrls;
}
public void setAllowUrls(List<String> allowUrls) {
this.allowUrls = allowUrls;
}
public boolean preHandle(HttpServletRequest request,
HttpServletResponse response, Object handler) throws Exception {
String requestUri = request.getRequestURI();
for (String url : allowUrls) {
if (requestUri.endsWith(url)) {
return true;
}
}
<mvc:interceptors>
<mvc:interceptor>
<mvc:mapping path="/*/*.do" />
<bean class="com.cdxt.card.interceptor.SessionTimeoutInterceptor">
<property name="allowUrls">
<list>
<value>/yhxx/login.do</value>
<value>/yhxx/toLogin.do</value>
<value>/yhxx/sessionTimeOut.do</value>
</list>
</property>
</bean>
</mvc:interceptor>
</mvc:interceptors>
其中allowUrls就是不拦截的
在拦截器中
private List<String> allowUrls;
public List<String> getAllowUrls() {
return allowUrls;
}
public void setAllowUrls(List<String> allowUrls) {
this.allowUrls = allowUrls;
}
public boolean preHandle(HttpServletRequest request,
HttpServletResponse response, Object handler) throws Exception {
String requestUri = request.getRequestURI();
for (String url : allowUrls) {
if (requestUri.endsWith(url)) {
return true;
}
}
Storm代理
2023-07-25 广告
2023-07-25 广告
StormProxies是一家提供动态代理服务器服务的企业,旨在帮助用户更好地管理网络访问和安全。以下是一些关于StormProxies的IP动态代理服务的特点:1. 高匿名性:StormProxies的动态代理服务器具有高匿名性,可以有效...
点击进入详情页
本回答由Storm代理提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询