zoukankan      html  css  js  c++  java
  • spring:过滤器和拦截器

    过滤器:网络通信模型的会话层控制;

    拦截器:事务处理的aop注入(生命周期监控)。

    Servlet Filter与HandlerInterceptor的对比

    对于Servlet Filter,官方文档中说的很好, 并且给出了常见的应用场景。

    A filter is an object that performs filtering tasks on either the request to a resource (a servlet or static content), or on the response from a resource, or both. Filters perform filtering in the doFilter method. Every Filter has access to a FilterConfig object from which it can obtain its initialization parameters, and a reference to the ServletContext which it can use, for example, to load resources needed for filtering tasks.

    Filters are configured in the deployment descriptor of a web application.

    Examples that have been identified for this design are:

    • Authentication Filters
    • Logging and Auditing Filters
    • Image conversion Filters
    • Data compression Filters
    • Encryption Filters
    • Tokenizing Filters
    • Filters that trigger resource access events
    • XSL/T filters
    • Mime-type chain Filter

    过滤器和拦截器的执行顺序

     https://www.bbsmax.com/A/QW5Y046GJm/

    https://my.oschina.net/zdtdtel/blog/3025880

    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

     

  • 相关阅读:
    FIS
    git笔记 常规使用
    隐藏文字
    清除浮动的几种方法
    chrome livestyle插件
    Vue3中的微任务队列解析
    JavaScript通过父节点ID递归生成JSON树
    JavaScripts调用摄像头【MediaDevices.getUserMedia()】
    JavaScripts之变量作用域提升问题
    Webpack之 webpack-dev-server 中的 contentBase配置及作用
  • 原文地址:https://www.cnblogs.com/UUUz/p/12023550.html
Copyright © 2011-2022 走看看