67,549
社区成员




- public class SessionFilter implements Filter {
-
- public void init(FilterConfig config) throws ServletException {
- }
- public void doFilter(ServletRequest request, ServletResponse response,
- FilterChain chain) throws IOException, ServletException {
- HttpServletRequest req = (HttpServletRequest) request;
- System.out.println("进入了filter: " + req.getRequestURI());
- chain.doFilter(request, response);
- }
- public void destroy() {
- }
- }
- <?xml version="1.0" encoding="UTF-8"?>
- <web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
-
- <!-- session过滤器 -->
- <filter>
- <filter-name>SessionFilter</filter-name>
- <filter-class>com.maphao.web.listener.SessionFilter</filter-class>
- </filter>
- <filter-mapping>
- <filter-name>SessionFilter</filter-name>
- <url-pattern>/*</url-pattern>
- </filter-mapping>
-
- <welcome-file-list>
- <welcome-file>index.html</welcome-file>
- </welcome-file-list>
- </web-app>