servlet 3.0

This commit is contained in:
shuzheng 2017-07-02 23:27:50 +08:00
parent c0dac50e57
commit 3e457fe06b
5 changed files with 57 additions and 31 deletions

View File

@ -14,7 +14,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* 用户service实现
* UpmsApiService实现
* Created by shuzheng on 2016/01/19.
*/
@Service

View File

@ -33,8 +33,8 @@
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>

View File

@ -0,0 +1,22 @@
package com.zheng.upms.server;
import javax.servlet.DispatcherType;
import javax.servlet.annotation.WebFilter;
import javax.servlet.annotation.WebInitParam;
/**
* 强制进行转码过滤器
* Created by shuzheng on 2017/6/24.
*/
@WebFilter(
filterName = "CharacterEncodingFilter",
urlPatterns = "/*",
dispatcherTypes = {DispatcherType.REQUEST, DispatcherType.FORWARD},
initParams = {
@WebInitParam(name = "encoding", value = "UTF-8")
}
)
public class CharacterEncodingFilter extends org.springframework.web.filter.CharacterEncodingFilter {
}

View File

@ -0,0 +1,20 @@
package com.zheng.upms.server;
import javax.servlet.annotation.WebFilter;
import javax.servlet.annotation.WebInitParam;
/**
* shiroFilter
* Created by shuzheng on 2017/6/24.
*/
@WebFilter(
filterName = "shiroFilter",
urlPatterns = "/*",
initParams = {
@WebInitParam(name = "targetFilterLifecycle", value = "true")
}
)
public class ShiroFilter extends org.springframework.web.filter.DelegatingFilterProxy {
}

View File

@ -4,22 +4,6 @@
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
<!-- 强制进行转码 -->
<filter>
<filter-name>CharacterEncodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>CharacterEncodingFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
<!-- 默认的spring配置文件是在WEB-INF下的applicationContext.xml -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
@ -53,18 +37,18 @@
</servlet-mapping>
<!-- shiroFilter : DelegatingFilterProxy作用是自动到spring容器查找名字为shiroFilterfilter-name的bean并把所有Filter的操作委托给它。然后将shiroFilter配置到spring容器即可 -->
<filter>
<filter-name>shiroFilter</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
<init-param>
<param-name>targetFilterLifecycle</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>shiroFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!--<filter>-->
<!--<filter-name>shiroFilter</filter-name>-->
<!--<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>-->
<!--<init-param>-->
<!--<param-name>targetFilterLifecycle</param-name>-->
<!--<param-value>true</param-value>-->
<!--</init-param>-->
<!--</filter>-->
<!--<filter-mapping>-->
<!--<filter-name>shiroFilter</filter-name>-->
<!--<url-pattern>/*</url-pattern>-->
<!--</filter-mapping>-->
<!-- session配置 -->
<session-config>