dispatcher-servlet.xml
5.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context"
xmlns:oxm="http://www.springframework.org/schema/oxm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/oxm
http://www.springframework.org/schema/oxm/spring-oxm-3.2.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd">
<!-- 开启controller注解支持 -->
<context:component-scan base-package="com.bjivt.showtime.api.controller">
<context:include-filter type="annotation"
expression="org.springframework.stereotype.Controller" />
</context:component-scan>
<mvc:annotation-driven
content-negotiation-manager="contentManager">
<mvc:message-converters>
<ref bean="fastJsonConverter" />
<ref bean="xstreamConverter" />
</mvc:message-converters>
</mvc:annotation-driven>
<!-- 配置拦截器 -->
<!-- mvc:interceptors>
<bean class="com.bjivt.api.interceptor.SpringMVCInterceptor"/>
</mvc:interceptors-->
<mvc:interceptors>
<mvc:interceptor>
<mvc:mapping path="/**"/>
<bean class="com.bjivt.showtime.api.interceptor.LogInterceptor">
</bean>
</mvc:interceptor>
<mvc:interceptor>
<mvc:mapping path="/**"/>
<bean class="com.bjivt.showtime.api.interceptor.BaseInterceptor">
<property name="excludeUrls">
<list>
<value>/user/sendsms.json</value>
<value>/user/login.json</value>
<value>/user/thridpartLogin.json</value>
<value>/requestAppInfo.json</value>
<value>/getAdvertisement.json</value>
<value>/getLoopBannerList.json</value>
<value>/live/share.json</value>
<value>/shareLive</value>
<value>/user/boundingThirdPartAccount.json</value>
<value>/user/userRechargeLog.json</value>
</list>
</property>
</bean>
</mvc:interceptor>
</mvc:interceptors>
<!-- <mvc:default-servlet-handler/> -->
<mvc:resources mapping="css/**" location="/css/" />
<mvc:resources mapping="js/**" location="/js/" />
<mvc:resources mapping="images/**" location="/images/" />
<mvc:resources mapping="upload/**" location="/upload/" />
<mvc:resources mapping="html/**" location="/html/" />
<mvc:resources mapping="assets/**" location="/assets/" />
<mvc:resources mapping="img/**" location="/img/" />
<bean id="contentManager"
class="org.springframework.web.accept.ContentNegotiationManagerFactoryBean">
<property name="favorPathExtension" value="true" />
<property name="ignoreAcceptHeader" value="true" />
<property name="defaultContentType" value="application/json" />
<property name="mediaTypes">
<map>
<entry key="json" value="application/json" />
<entry key="xml" value="application/xml" />
<entry key="html" value="text/html" />
</map>
</property>
</bean>
<bean id="xmlMarshaller" class="org.springframework.oxm.xstream.XStreamMarshaller">
<property name="streamDriver">
<bean class="com.thoughtworks.xstream.io.xml.StaxDriver" />
</property>
<property name="autodetectAnnotations" value="true" />
</bean>
<bean id="xstreamConverter"
class="org.springframework.http.converter.xml.MarshallingHttpMessageConverter">
<property name="marshaller" ref="xmlMarshaller" />
<property name="unmarshaller" ref="xmlMarshaller" />
<property name="supportedMediaTypes" value="application/xml" />
</bean>
<bean id="fastJsonConverter"
class="com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter">
<property name="supportedMediaTypes" value="application/json" />
</bean>
<bean id="jspViewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/" />
<property name="suffix" value=".jsp" />
</bean>
<!-- 定时器 这个是定时器要调用方法的类 -->
<bean id="SpringQtzJob" class="com.bjivt.showtime.api.job.LiveHeartbeatJob"/>
<!--
<bean id="SpringQtzJobMethod" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject">
<ref bean="SpringQtzJob"/>
</property>
<property name="targetMethod"> 要执行的方法名称
<value>doit</value>
</property>
</bean>
<bean id="cronTrigger"
class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="jobDetail" ref="SpringQtzJobMethod" />
<property name="cronExpression" value="*/5 * * * * ?" />
</bean>
<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean"
autowire="no">
<property name="triggers">
<list>
<ref bean="cronTrigger" />
</list>
</property>
</bean>
-->
<bean id="multipartResolver"
class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<!-- 设置上传文件的最大尺寸为1MB -->
<property name="maxUploadSize">
<value>70048576</value>
</property>
<property name="uploadTempDir">
<value>upload/temp</value>
</property>
</bean>
</beans>