博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
The Struts2 Servlet Filter
阅读量:6153 次
发布时间:2019-06-21

本文共 2170 字,大约阅读时间需要 7 分钟。

When requests are received at the servlet container, they are forwarded to either a servlet or a filter that will handle processing the request. In Struts2, a filter is used, and the class for handling the request is the FilterDispatcher class. 

The filter and a Dispatcher class (to which many of the tasks are delegated) are the heart of the Struts2 framework. Together, they provide access to the infrastructure that will be needed to process the request. Upon startup, implementations of configurable elements in the framework, including ConfigurationManager, ActionMapper, and ObjectFactory, are loaded. With respect to processing the request, the Struts2 filter performs the following:

Serves static content: Dojo content, JavaScript, and user configurable files can be served from the Struts2 or the web application’s JAR file, allowing all the elements for a web application to be packaged together.

Determines the action configuration: The filter uses the ConfigurationManager and the ActionMapper implementations to determine which action maps to the URL from the incoming request; by default, actions are determined by looking for a .action extension.

Creates the action context: Because actions are generic and not specific to HTTP ,  the information contained in the web request needs to be converted to a protocol-independent format for the actions to use; this includes extracting data from the HttpServletRequest and the HttpSession objects.

Creates the action proxy: There is an additional layer of indirection in the processing in the form of an ActionProxy class. This class contains all the configuration and context information to process the request and will contain the execution results after the request has been processed.

Performs cleanup: To ensure that no memory leaks occur, the filter automatically performs cleanup of the ActionContext object.

When the ActionProxy class instance is created and configured, the execute() method is invoked. This signals that the preparation of the action is complete, and the real processing of the action is about to start.

 

转载于:https://www.cnblogs.com/MagicLetters/archive/2013/04/26/3444277.html

你可能感兴趣的文章
scanf
查看>>
Socket编程注意接收缓冲区大小
查看>>
SpringMVC初写(五)拦截器
查看>>
检测oracle数据库坏块的方法
查看>>
SQL server 安装教程
查看>>
Linux下ftp和ssh详解
查看>>
跨站脚本功攻击,xss,一个简单的例子让你知道什么是xss攻击
查看>>
js时间和时间戳之间如何转换(汇总)
查看>>
js插件---图片懒加载echo.js结合 Amaze UI ScrollSpy 使用
查看>>
java中string和int的相互转换
查看>>
P1666 前缀单词
查看>>
HTML.2文本
查看>>
Ubuntu unity安装Indicator-Multiload
查看>>
解决Eclipse中新建jsp文件ISO8859-1 编码问题
查看>>
7.对象创建型模式-总结
查看>>
【论文阅读】Classification of breast cancer histology images using transfer learning
查看>>
移动端处理图片懒加载
查看>>
jQuery.on() 函数详解
查看>>
谈缓存和Redis
查看>>
【转】百度地图api,根据多点注标坐标范围计算地图缩放级别zoom自适应地图
查看>>