spring-mvc 添加controller 请求 200 但是无返回
                                                            生活随笔
收集整理的這篇文章主要介紹了
                                spring-mvc 添加controller 请求 200 但是无返回
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.                        
                                現象?新增加一個Controller,但在js中調用時報請求200,無請求反饋,重啟服務多次,問題依舊。
分析
從問題現象分析:200,無反饋,斷點調試未進入。
200
如果是后臺寫的代碼問題,應該是500,而200說明了服務器正常收到并處理了請求,所以先排除controller代碼問題:
無反饋
無反饋,斷點調試未進入,說明沒有進入當前controller代碼。
綜合以上兩點得到的分析是請求被服務器收到,但是被服務器攔截。
處理
spring-mvc.xml中對controller配置了攔截
<mvc:interceptors><mvc:interceptor><!-- 匹配的是url路徑, 如果不配置或/**,將攔截所有的Controller --><mvc:mapping path="/**" /><mvc:exclude-mapping path="/rest/*"/><mvc:exclude-mapping path="/version/getVersionToWBS/*"/><mvc:exclude-mapping path="/requirement/query/Organization/**"/><bean class="com.cupid.client.interceptor.PermissionFireWall"><property name="whitelistPathMatcher" value="${permFirewall.whitelist.pathMatcher}"></property><property name="authorityPathMatcher" value="${permFirewall.authority.pathMatcher}"></property></bean></mvc:interceptor></mvc:interceptors>添加攔截排除:
<mvc:exclude-mapping path="/rest/*"/><mvc:exclude-mapping path="/version/getVersionToWBS/*"/><mvc:exclude-mapping path="/requirement/query/Organization/**"/>即可。總結
以上是生活随笔為你收集整理的spring-mvc 添加controller 请求 200 但是无返回的全部內容,希望文章能夠幫你解決所遇到的問題。
 
                            
                        - 上一篇: 【软件工程】几种常见的软件开发模型:(瀑
- 下一篇: 妖神记手游沈秀怎么样 沈秀技能属性汇总介
