zoukankan      html  css  js  c++  java
  • FilterDispatcher处理流程

    org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter

    前身是:org.apache.struts2.dispatcher.FilterDispatcher

    请求被web.xml中定义的过滤器拦截。

    3层过滤器处理:ActionContextCleanUp,其他过滤器(Other Filters, SiteMesh),FilterDispatcher

    ——FilterDispatcher中首先询问ActionMapper是否需要调用某个Action

    ——如果调用,把请求交给ActionProxy

    ——ActionProxy通过struts.xml找到Action类。

    ——ActionProxy创建一个ActionInvocation实例。并调用Action。调用之前ActionInvocation会加载Action的所有拦截器。

    执行完ActionInvocation负责根据struts.xml中的配置找到相应的返回结果result

    ==========================================================================

    Servlet中过滤器概念】【StrutsPrepareAndExecuteFilter 

    过滤器API包括3个简单的接口:FilterFilterChainFilterConfig

    Filter接口:

    ——init():容器实例化过滤器的时候调用。容器为这个方法传入FilterConfig,配置信息。

    ——doFilter():处理请求和响应请求。接受3个参数:ServletRequest,ServletResponse,FilterChain

            调用FilterChaindoFilter()方法。

    设置ValueStack。获取ActionMapping

    ——destroy()方法。

     

  • 相关阅读:
    为cocos2d-x实现安卓输入框。非全屏,无dialog,绑定到lua
    自己动手,丰衣足食。普通键盘实现键盘宏(Windows和Mac版)
    go语言使用protobuf
    go语言使用redis —— redigo
    go语言实现线程池
    go语言实现的目录共享程序
    ss
    BST
    堆排序—最大优先级队列
    STL_Vector
  • 原文地址:https://www.cnblogs.com/lsx1993/p/4841520.html
Copyright © 2011-2022 走看看