ソースを参照

区分context-path、servlet-path、static-path,正确配置拦截器的exclude-mapping

huangbo 7 年 前
コミット
9ece25612e

+ 5 - 2
ipu-rest-demo/readme.md

@ -1,10 +1,13 @@
1
启动服务脚本范例:java -Dipu.lic.path=D:/git/rest-guide/ipu-rest-demo/ipu.lic -jar target/ipu-rest-demo.jar  --server.port=8080
1
一、启动服务脚本范例:java -Dipu.lic.path=D:/git/rest-guide/ipu-rest-demo/ipu.lic -jar target/ipu-rest-demo.jar  --server.port=8080
2 2
注意事项:需要增加证书。参数格式[-Dipu.lic.path]
3
二、区分context-path、servlet-path、static-path,正确配置拦截器的exclude-mapping
3 4

5
三、待办事项
4 6
1. Session管理, 支持redis
5 7
2. 数据库连接统一管理
6 8
3. 局部异常和全部异常的处理
7 9
4. ThreadLocal统一管理
8 10
5. 服务节点统计数据
9 11
6. 微服务,服务注册和发现。
10
7. Dubbo
12
7. Dubbo
13


+ 3 - 2
ipu-rest-demo/src/main/resources/dev/application.properties

@ -3,12 +3,13 @@
3 3
server.port=unknown
4 4

5 5
web.root=webapp/
6
#会影响拦截器的配置exclude-mapping
6 7
spring.mvc.static-path-pattern=/**
7 8
#spring.resources.static-locations=file:${web.root}
8 9
spring.resources.static-locations=classpath:/${web.root}
9 10

10
######context-path必须以/开头,默认/
11
server.context-path=/ipu
11
######context-path默认/
12
server.context-path=/
12 13
######注册DispatcherServlet对应path,亦可通过dispatcherRegistration方法配置
13 14
#server.servlet-path=/ipu1
14 15
#使用maven中的变量替换

+ 5 - 0
ipu-rest-demo/src/main/resources/ipu-spring-mvc.xml

@ -41,7 +41,12 @@
41 41
            <mvc:mapping path="/**" />
42 42
            <mvc:exclude-mapping path="/favicon.ico"/>
43 43
            <mvc:exclude-mapping path="/error"/>
44
            <!-- 屏蔽静态资源 -->
44 45
    		<mvc:exclude-mapping path="/static/**" />
46
    		<!-- 屏蔽IPU静态资源 -->
47
    		<mvc:exclude-mapping path="/res/**" />
48
    		<mvc:exclude-mapping path="/template/**" />
49
    		<mvc:exclude-mapping path="/biz/**" />
45 50
            <bean class="com.ai.ipu.restful.interceptor.BasicInterceptor" />
46 51
        </mvc:interceptor>
47 52
        <mvc:interceptor>

+ 4 - 2
ipu-rest-demo/src/main/resources/pro/application.properties

@ -3,10 +3,12 @@
3 3
server.port=unknown
4 4

5 5
web.root=webapp/
6
spring.mvc.static-path-pattern=/static/**
6
#会影响拦截器的配置exclude-mapping
7
spring.mvc.static-path-pattern=/**
8
#spring.resources.static-locations=file:${web.root}
7 9
spring.resources.static-locations=classpath:/${web.root}
8 10

9
######context-path必须以/开头,默认/
11
######context-path默认/
10 12
server.context-path=/
11 13
######注册DispatcherServlet对应path,亦可通过dispatcherRegistration方法配置
12 14
#server.servlet-path=/ipu1

+ 4 - 2
ipu-rest-demo/src/main/resources/test/application.properties

@ -3,10 +3,12 @@
3 3
server.port=unknown
4 4

5 5
web.root=webapp/
6
spring.mvc.static-path-pattern=/static/**
6
#会影响拦截器的配置exclude-mapping
7
spring.mvc.static-path-pattern=/**
8
#spring.resources.static-locations=file:${web.root}
7 9
spring.resources.static-locations=classpath:/${web.root}
8 10

9
######context-path必须以/开头,默认/
11
######context-path默认/
10 12
server.context-path=/
11 13
######注册DispatcherServlet对应path,亦可通过dispatcherRegistration方法配置
12 14
#server.servlet-path=/ipu1