Article From:https://segmentfault.com/q/1010000011711097
Question:
<?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" xmlns:mvc="http://www.springframework.org/schema/mvc"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
                      http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
         metadata-complete="true" version="3.0">


    <!-- Context ConfigLocation -->
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath*:spring.xml,classpath:spring-mybatis.xml</param-value>
    </context-param>

    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

    <filter>
        <filter-name>encodingFilter</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>
        <init-param>
            <param-name>forceEncoding</param-name>
            <param-value>true</param-value>
        </init-param>
    </filter>
    <filter-mapping>

        <filter-name>encodingFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>



    <!--CORSCross domain request filtering -->< filter>< filter-name> CORSFilter< /filter-name>&lT; filter-class> com.lqb.web.filter.CORSFilter< /filter-class>< init-param>< param-name> allowDomain< /param-name>< param-value> null, file://< /param-value>< /init-param>< /filter>< filter-mapping>< filter-name> CORSFilter< /filter-name>< url-pattern> /*< /url-pattern>< /filter-mapping><! - login check -->< filter>< filter-name> checkLoginFilter< /filter-name>< filter-class> com.lqb.web.filter.CheckLoginFiLter< /filter-class>< /filter>< filter-mapping>< filter-name> checkLoginFilter< /filter-name>< url-pattern> /remind/*< /url-pattern>≪ /filter-mapping>< filter-mapping>< filter-name> checkLoginFilter< /fiLter-name>< url-pattern> /authority/*< /url-pattern>< /filter-mapping>< filter-mapping>< filter-name> checkLoginFilter< /filter-name>< url-pattern> /buildingmanagement/*< /url-pattern>< /filter-mapping>< fiLter-mapping>< filter-name> checkLoginFilter< /filter-name>< url-patTern> /resource/*< /url-pattern>< /filter-mapping>< filter-mapping>< filter-name> checkLoginFilter< /filter-name>< url-pattern> /homepage.html< /url-pattern>< /filter-mapping><! --< filter-mapping> -->< --< filter-name> checkLoginFilter< /filter-name> --><! --< url-pattern>/app/contract/*< /url-pattern> --><! --< /filter-mapping> --><! --< fiLter-mapping> --><! --< filter-name> checkLoginFilter< /filter-name> --><! --< url-pattern> /app/data/*< /url-pattern> --><! --< /filter-mappiNg> --><! --< filter-mapping> --><! --< filter-name> checkLoginFilTer< /filter-name> --><! --< url-pattern> /app/mansion/*< /url-pattern> -><! --< /filter-mapping> --><! --< filter-mapping> --><! --< filter-name> checkLoginFilter< /filter-name> --><! --< url-pattern> /apP/permission/*< /url-pattern> --><! --< /filter-mapping> --><! --< filTer-mapping> --><! --< filter-name> checkLoginFilter< /filter-name> --><! --< url-pattern> /app/remind/*< /url-pattern> --><! --< /filter-mappIng> --><! --< filter-mapping> --><! --< filter-name> checkLoginFiLter< /filter-name> --><! --< url-pattern> /app/source/*< /url-pattern> -><! --< /filter-mapping> --><! --< filter-mapping> --><!--< filter-name> checkLoginFilter< /filter-name> --><! --< url-pattern> /aPp/system/*< /url-pattern> --><! --< /filter-mapping> --><! --< filter-mapping> --><! --< filter-name> checkLoginFilter< /filter-name> --><! --< url-pattern> /app/upload/*< /url-pattern> --><! --< /filter-mapping> --><! --< filter-mapping> --><! --< filter-name> checkLoginFilteR< /filter-name> --><! --< url-pattern> /app/user/loginOut< /url-pattern>--><! --< /filter-mapping> --><! --< filter-mapping> --><--< filter-name> checkLoginFilter< /filter-name> --><! --< url-pattern> /App/user/getUserInfo< /url-pattern> --><! --< /filter-mapping> --><! -Lt; filter-mapping> --><! --< filter-name> checkLoginFilter< /filter-name> -><! --< url-pattern> /app/user/updateUse< /url-pattern> --><! --</filter-mapping> -->< servlet>< servlet-name> springServlet< /servlet-name>< servlet-class> org.springframework.web.servlet.DispatcherServlet< /servlet-class>< init-param>< param-name> contextConfigLocation< /param-Name>< param-value> classpath*: /spring*.xml< /param-value>< /iniT-param>< load-on-startup> 1< /load-on-startup>< /servlet>< sErvlet-mapping>< servlet-name> springServlet< /servlet-name>< url-paTtern> /< /url-pattern>< /servlet-mapping><! --< servlet> --><! --< servlet-name> log4jconfigfile< /servlet-name> --><! --< servlet-cLass> Log4jInitServlet< /servlet-class> --><! --< init-param> --><! --< param-name> configfile< /param-name> --><! --< param-value> classpath*: /log4j.properties< /param-value> --><! --< /init-param> --><! --< load-on-startup> 1< /load-on-startup> --><! --< /servlet> -><! --< servlet-mapping> --><! --< servlet-name> log4jconfigfile</servlet-name> --><! --< url-pattern> /app/< /url-pattern> --><! --< /servlet-mapping> -->< welcome-file-list>< welcome-file> index.htmL< /welcome-file>< /welcome-file-list>< session-config>< sessioN-timeout> 3000< /session-timeout>< /session-config>< /web-app>

Answer 0:

There’s no such configuration in Web.Xml, and guess it’s the last session – config configuration here that invalidates the session and validates the jump to the landing page

Answer 1:

web.xmlSession time can be configured, and it can be seen from the posted code that session is not expired.
so It should be a regular jump at the front end. For example:

    var  time;  //Set a global variableVar n = 3 * 1000; / / time settings (3 seconds)Time = setTimeout (function () {Location.hRef= "https://www.baidu.com";}, n);Window.top.document.onmousemove = function () {ClearTimeout (time);Time = setTimeout (function () {Location.href= "HTTPS//www.baidu.com: "}, n);}Window.top.document.onkeydown = function () {ClearTimeout (time);Time = setTimeout (function () {Location.href= "https://wwW.baidu.com ";}, n);}

Answer 2:

First consider the home page Jump caused by session timeout.

  1. tomcatThe conf/web.xml can be configured, < session-config> tags, usually 30 minutes.
  2. You can configure & lt; session-config & gt in the web.xml of the project; tag, you give it 3000 units in minutes
  3. javaThe code can configure the session timeout through session.setMaxInactiveInterval.
  4. The code in the project has the relevant filter interception, and you have a checkLoginFilter here to see if there is any judgment in it.
    Priority is 4> 3> 2> 1

Leave a Reply

Your email address will not be published. Required fields are marked *