调整请求拦截器。

This commit is contained in:
2023-01-12 18:16:45 +08:00
parent d995251d7b
commit dcab19a765
6 changed files with 127 additions and 9 deletions

View File

@@ -0,0 +1,37 @@
/*
* @Author: Kane
* @Date: 2023-01-12 15:01:22
* @LastEditors: Kane
* @LastEditTime: 2023-01-12 15:15:59
* @FilePath: \AdminSys\src\main\java\com\cpic\xim\web\filters\token\TokenFilter.java
* @Description: 用于检查token的过滤器
*
* Copyright (c) ${2022} by Kane, All Rights Reserved.
*/
package com.cpic.xim.web.filters.token;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@SuppressWarnings( "unused")
public class TokenFilter implements Filter
{
@Override
public void doFilter( ServletRequest req, ServletResponse resp, FilterChain chain )
throws ServletException, IOException
{
HttpServletRequest request = (HttpServletRequest) req;
HttpServletResponse response = (HttpServletResponse) resp;
String URI = request.getRequestURI();
chain.doFilter( request, response );
}
}

View File

@@ -1,4 +1,7 @@
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1">
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<display-name>Archetype Created Web Application</display-name>
<servlet>
@@ -24,6 +27,15 @@
<url-pattern>*.do</url-pattern>
</filter-mapping>
<filter>
<filter-name>token-filter</filter-name>
<filter-class>com.cpic.xim.web.filters.token.TokenFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>token-filter</filter-name>
<url-pattern>*.do</url-pattern>
</filter-mapping>
<!-- 配置文件路径参数 -->
<context-param>
<param-name>config_file_location</param-name>