Spring MVC拦截器使用

  1. 前端接口拦截器(列出分析)
    <!-- 前端接口拦截器 --> <mvc:interceptors> <mvc:interceptor> <!-- 匹配路径所有路径 --> <mvc:mapping path="/**"/> <!-- 登录接口不验证 --> <mvc:exclude-mapping path="/api/user/*"/><!-- 用户登录地址 --> <mvc:exclude-mapping path="/api/index.htm"/><!-- API注解访问地址--> <mvc:exclude-mapping path="/**/**/**/*.css.htm"/><!-- swagger静态资源--> <mvc:exclude-mapping path="/**/**/**/*.js.htm"/><!-- swagger静态资源--> <mvc:exclude-mapping path="/api.htm"/><!-- 请求所有api的接口--> <mvc:exclude-mapping path="/api/scene/dataReport.htm"/><!--数据上报不拦截--> <mvc:exclude-mapping path="/api/upload/fileUpload.htm"/><!--文件上传接口--> <!-- 拦截器类 --> <bean class="com.xxx.interceptor.RequestInterceptor"></bean> </mvc:interceptor> </mvc:interceptors>
    拦截器很明显在com.xxx.interceptor.RequestInterceptor
    访问接口时想要某接口不走拦截器,/api/upload/fileUpload.htm,将ip:端口后的URL复制,该接口exclude-mapping就不匹配,相当于直接返回了个true。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值