xinyb
2024-09-13 3118f76b8168019c91106d4d38d2ce1a2a74c494
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
<?xml version="1.0" encoding="utf-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0" >
 
<display-name>eCoworks</display-name>
 
<!--如果不定义webAppRootKey参数,那么webAppRootKey就是缺省的"webapp.root"-->
<context-param>
    <param-name>webAppRootKey</param-name>
    <param-value>RootPath</param-value>
</context-param>
 
<!--由Sprng载入的Log4j配置文件位置-->
<context-param>
    <param-name>log4jConfigLocation</param-name>
    <param-value>classpath:log4j.xml</param-value>
</context-param>
 
<!--Spring默认刷新Log4j配置文件的间隔,单位为毫秒-->
<context-param>
    <param-name>log4jRefreshInterval</param-name>
    <param-value>60000</param-value>
</context-param>
<!--Spring log4j Config loader-->
<!-- 监听器 -->
<listener>
    <listener-class>org.apache.logging.log4j.web.Log4jServletContextListener</listener-class>
</listener>
 
<!-- 指定Spring Bean的配置文件所在目录。默认配置在WEB-INF目录下 -->
<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath*:/applicationContext*.xml,classpath:dataSource/*.xml</param-value>
</context-param>
<!-- 监听器 -->
<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- 监听器 -->
<listener>
    <listener-class>com.yc.listener.SessionListener</listener-class>
</listener>
    <listener>
        <display-name>ImageIO service provider loader/unloader</display-name>
        <listener-class>com.twelvemonkeys.servlet.image.IIOProviderContextListener</listener-class>
    </listener>
 
    <servlet>
    <servlet-name>initBean</servlet-name>
    <servlet-class>com.yc.factory.InitBean</servlet-class>
    <load-on-startup>1</load-on-startup>
    <async-supported>true</async-supported>
</servlet>
    
<!-- spring MVC核心 -->
<servlet>
    <servlet-name>annomvc</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <!-- 默认为WEB-INF目录下,名称为[<servlet-name>]-servlet.xml,如annomvc-servlet.xml -->
    <load-on-startup>2</load-on-startup>
    <async-supported>true</async-supported>
</servlet>
<servlet-mapping>
    <servlet-name>annomvc</servlet-name>
    <url-pattern>*.do</url-pattern>
</servlet-mapping>
<servlet-mapping>
    <!--APP更新调用接口-->
    <servlet-name>annomvc</servlet-name>
    <url-pattern>/v</url-pattern>
</servlet-mapping>    
<servlet-mapping>
    <!--websocket-->
    <servlet-name>annomvc</servlet-name>
    <url-pattern>/websocket</url-pattern>
</servlet-mapping>
 
<servlet>
    <servlet-name>jsp</servlet-name>
    <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
    <async-supported>true</async-supported>
    <init-param>
        <param-name>fork</param-name>
        <param-value>false</param-value>
    </init-param>
    <init-param>
        <param-name>xpoweredBy</param-name>
        <param-value>false</param-value>
    </init-param>
    <init-param>
        <param-name>mappedfile</param-name>
        <param-value>false</param-value>
    </init-param>
    <load-on-startup>3</load-on-startup>
</servlet>
    
<!--在向servlet或JSP页面制定初始化参数或定制URL时,必须首先命名servlet或JSP页面。Servlet元素就是用来完成此项任务的--> 
<!-- 验证码servlet -->
<servlet>
    <servlet-name>imageCode</servlet-name>
    <servlet-class>com.yc.utils.ImageCode</servlet-class>
    <async-supported>true</async-supported>
</servlet>    
<!--服务器一般为servlet提供一个缺省的URL:http://host/webAppPrefix/servlet/ServletName。
但是,常常会更改这个URL,以便servlet可以访问初始化参数或更容易地处理相对URL。
在更改缺省URL时,使用servlet-mapping元素-->
<servlet-mapping>
    <servlet-name>imageCode</servlet-name>
    <url-pattern>/imageCode</url-pattern>
</servlet-mapping>
 
<servlet>
    <servlet-name>FileUpload</servlet-name>
    <servlet-class>com.yc.servlet.FileUpload</servlet-class>
    <async-supported>true</async-supported>
</servlet>
<servlet-mapping>
    <servlet-name>FileUpload</servlet-name>
    <url-pattern>/FileUpload</url-pattern>
</servlet-mapping>
 
<!-- Character Encoding filter -->
<!--过滤器元素将一个名字与一个实现javax.servlet.Filter接口的类相关联-->
<filter>
    <filter-name>encodingFilter</filter-name>
    <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
    <async-supported>true</async-supported>
    <init-param>
        <param-name>encoding</param-name>
        <param-value>utf-8</param-value>
    </init-param>
    <init-param>
        <param-name>forceEncoding</param-name>
        <param-value>true</param-value>
    </init-param>
 
</filter>
<!--一旦命名了一个过滤器,就要利用filter-mapping元素把它与一个或多个servlet或JSP页面相关联-->
<filter-mapping>
    <filter-name>encodingFilter</filter-name>
    <url-pattern>/*</url-pattern>
<dispatcher>ASYNC</dispatcher>
</filter-mapping>
 
<filter>
    <filter-name>openFilter</filter-name>
    <filter-class>com.yc.filter.ApiSignFilter</filter-class>
    <async-supported>true</async-supported>
</filter>
<filter-mapping>
    <filter-name>openFilter</filter-name>
    <url-pattern>/open/*</url-pattern>
</filter-mapping>
 
<filter>
    <filter-name>loginFilter</filter-name>
    <filter-class>com.yc.filter.LoginFilter</filter-class>
    <async-supported>true</async-supported>
</filter>
<filter-mapping>
    <filter-name>loginFilter</filter-name>
    <url-pattern>*.jsp</url-pattern>
</filter-mapping>
<filter-mapping>
    <filter-name>loginFilter</filter-name>
    <url-pattern>*.do</url-pattern>
</filter-mapping>
 
<filter>
    <filter-name>requestParamDecodeFilter</filter-name>
    <filter-class>com.yc.filter.RequestParamDecodeFilter</filter-class>
    <async-supported>true</async-supported>
</filter>
<filter-mapping>
    <filter-name>requestParamDecodeFilter</filter-name>
    <url-pattern>*.jsp</url-pattern>
</filter-mapping>
<filter-mapping>
    <filter-name>requestParamDecodeFilter</filter-name>
    <url-pattern>*.do</url-pattern>
</filter-mapping>
    
<filter>
    <filter-name>imageFilter</filter-name>
    <filter-class>com.yc.sdk.shopping.filter.ImageFilter</filter-class>
    <async-supported>true</async-supported>
</filter>    
<filter-mapping>
    <filter-name>imageFilter</filter-name>
    <url-pattern>/uploads/shopping/*</url-pattern>
</filter-mapping>
<filter-mapping>
    <filter-name>imageFilter</filter-name>
    <url-pattern>/uploads/attachment/*</url-pattern>
</filter-mapping>
 
<filter>
    <filter-name>formidFilter</filter-name>
    <filter-class>com.yc.action.build.FormidFilter</filter-class>
    <async-supported>true</async-supported>
</filter>    
 
<filter>
    <filter-name>taskFilter</filter-name>
    <filter-class>com.yc.sdk.shopping.filter.TaskFilter</filter-class>
    <async-supported>true</async-supported>
</filter>
 
<!--在返回特定HTTP状态代码时,或者特定类型的异常被抛出时,能够制定将要显示的页面-->
<error-page>
    <error-code>404</error-code>
    <location>/404.jsp</location>
</error-page>
 
<error-page>
    <error-code>500</error-code>
    <location>/500.jsp</location>
</error-page> 
 
<!--如果某个会话在一定时间内未被访问,服务器可以抛弃它以节省内存。可通过使用HttpSession的setMaxInactiveInterval方法明确设置单个会话对象的超时值,
或者可利用session-config元素制定缺省超时值-->
<session-config>
    <session-timeout>120</session-timeout>
</session-config>
 
<!--指示服务器在收到引用一个目录名而不是文件名的URL时,使用哪个文件-->
<welcome-file-list>
    <welcome-file>default.jsp</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>home.jsp</welcome-file>
</welcome-file-list>
 
<!-- 是指定该站台是否可分布式处理 -->
<distributable/>
 
</web-app>