Java-Filter-FilterChain-FilterConfig源码
public interface Filter {
/**
* Called by the web container to indicate to a filter that it is being placed into
* service. The servlet container calls the init method exactly once after instantiating the
* filter. The init method must complete successfully before the filter is asked to do any
* filtering work. <br><br>
* The web container cannot place the filter into service if the init method either<br>
* 1.Throws a ServletException <br>
* 2.Does not return within a time period defined by the web container
*/
public void init(FilterConfig filterConfig) throws ServletException;
/**
* The <code>doFilter</code> method of the Filter is called by the container
* each time a request/response pair is passed through the chain due
* to a client request for a resource at the end of the chain. The FilterChain passed in to this
* method allows the Filter to pass on the request and response to the next entity in the
* chain.<p>
* A typical implementation of this method would follow the following pattern:- <br>
* 1. Examine the request<br>
* 2. Optionally wrap the request object with a custom implementation to
* filter content or headers for input filtering <br>
* 3. Optionally wrap the response object with a custom implementation to
* filter content or headers for output filtering <br>
* 4. a) <strong>Either</strong> invoke the next entity in the chain using the FilterChain object (<code>chain.doFilter()</code>), <br>
** 4. b) <strong>or</strong> not pass on the request/response pair to the next entity in the filter chain to block the request processing<br>
** 5. Directly set headers on the response after invocation of the next entity in the filter chain.
**/
public void doFilter ( ServletRequest request, ServletResponse response, FilterChain chain ) throws IOException, ServletException;
/**
* Called by the web container to indicate to a filter that it is being taken out of service. This
* method is only called once all threads within the filter's doFilter method have exited or after
* a timeout period has passed. After the web container calls this method, it will not call the
* doFilter method again on this instance of the filter. <br><br>
*
* This method gives the filter an opportunity to clean up any resources that are being held (for
* example, memory, file handles, threads) and make sure that any persistent state is synchronized
* with the filter's current state in memory.
*/
public void destroy();
}
public interface FilterChain {
/**
* Causes the next filter in the chain to be invoked, or if the calling filter is the last filter
* in the chain, causes the resource at the end of the chain to be invoked.
*
* @param request the request to pass along the chain.
* @param response the response to pass along the chain.
*
* @since 2.3
*/
public void doFilter ( ServletRequest request, ServletResponse response ) throws IOException, ServletException;
}
public interface FilterConfig {
/**
* Returns the filter-name of this filter as defined in the deployment descriptor.
*/
public String getFilterName();
/**
* Returns a reference to the {@link ServletContext} in which the caller
* is executing.
*
*
* @return a {@link ServletContext} object, used
* by the caller to interact with its servlet
* container
*
* @see ServletContext
*
*/
public ServletContext getServletContext();
/**
* Returns a <code>String</code> containing the value of the
* named initialization parameter, or <code>null</code> if
* the parameter does not exist.
*
* @param name a <code>String</code> specifying the name
* of the initialization parameter
*
* @return a <code>String</code> containing the value
* of the initialization parameter
*
*/
public String getInitParameter(String name);
/**
* Returns the names of the filter's initialization parameters
* as an <code>Enumeration</code> of <code>String</code> objects,
* or an empty <code>Enumeration</code> if the filter has
* no initialization parameters.
*
* @return an <code>Enumeration</code> of <code>String</code>
* objects containing the names of the filter's
* initialization parameters
*
*
*
*/
public Enumeration getInitParameterNames();
}
Java-Filter-FilterChain-FilterConfig源码的更多相关文章
- 死磕 java集合之CopyOnWriteArraySet源码分析——内含巧妙设计
问题 (1)CopyOnWriteArraySet是用Map实现的吗? (2)CopyOnWriteArraySet是有序的吗? (3)CopyOnWriteArraySet是并发安全的吗? (4)C ...
- Java集合---Array类源码解析
Java集合---Array类源码解析 ---转自:牛奶.不加糖 一.Arrays.sort()数组排序 Java Arrays中提供了对所有类型的排序.其中主要分为Prim ...
- JAVA上百实例源码以及开源项目
简介 笔者当初为了学习JAVA,收集了很多经典源码,源码难易程度分为初级.中级.高级等,详情看源码列表,需要的可以直接下载! 这些源码反映了那时那景笔者对未来的盲目,对代码的热情.执着,对IT的憧憬. ...
- Java IO 之 OutputStream源码
Writer :BYSocket(泥沙砖瓦浆木匠) 微 博:BYSocket 豆 瓣:BYSocket FaceBook:BYSocket Twitter ...
- java线程池ThreadPoolExector源码分析
java线程池ThreadPoolExector源码分析 今天研究了下ThreadPoolExector源码,大致上总结了以下几点跟大家分享下: 一.ThreadPoolExector几个主要变量 先 ...
- 《java.util.concurrent 包源码阅读》 结束语
<java.util.concurrent 包源码阅读>系列文章已经全部写完了.开始的几篇文章是根据自己的读书笔记整理出来的(当时只阅读了部分的源代码),后面的大部分都是一边读源代码,一边 ...
- 《java.util.concurrent 包源码阅读》13 线程池系列之ThreadPoolExecutor 第三部分
这一部分来说说线程池如何进行状态控制,即线程池的开启和关闭. 先来说说线程池的开启,这部分来看ThreadPoolExecutor构造方法: public ThreadPoolExecutor(int ...
- 死磕 java集合之DelayQueue源码分析
问题 (1)DelayQueue是阻塞队列吗? (2)DelayQueue的实现方式? (3)DelayQueue主要用于什么场景? 简介 DelayQueue是java并发包下的延时阻塞队列,常用于 ...
- 死磕 java集合之PriorityBlockingQueue源码分析
问题 (1)PriorityBlockingQueue的实现方式? (2)PriorityBlockingQueue是否需要扩容? (3)PriorityBlockingQueue是怎么控制并发安全的 ...
- 死磕 java集合之PriorityQueue源码分析
问题 (1)什么是优先级队列? (2)怎么实现一个优先级队列? (3)PriorityQueue是线程安全的吗? (4)PriorityQueue就有序的吗? 简介 优先级队列,是0个或多个元素的集合 ...
随机推荐
- ROS机器人程序设计(原书第2版)补充资料 (拾) 第十章 使用MoveIt!
ROS机器人程序设计(原书第2版)补充资料 (拾) 第十章 使用MoveIt! 书中,大部分出现hydro的地方,直接替换为indigo或jade或kinetic,即可在对应版本中使用. MoveIt ...
- ISP(Interface Segregation Principle),接口隔离原则
ISP(Interface Segregation Principle),接口隔离原则 它要求如下: ① 一个类对另一个类的依赖性要建立在最小接口上. ② 使用多个专门的接口比使用单一的总接口要好 ...
- Cocos2D实现RPG队伍菜单任意调整角色顺序的效果
大熊猫猪·侯佩原创或翻译作品.欢迎转载,转载请注明出处. 如果觉得写的不好请多提意见,如果觉得不错请多多支持点赞.谢谢! hopy ;) 前一篇我们实现了队伍实现拖尾效果,但是在实际游戏中我们往往需要 ...
- 套接字输入缓冲装置——InternalInputBuffer
互联网的世界很复杂,信息从一端传向另一端过程也相当复杂,中间可能通过若干个硬件,为了提高发送和接收效率,在发送端及接收端都将引入缓冲区,所以两端的套接字都拥有各自的缓冲区,当然这种缓冲区的引入也带来了 ...
- Git版本控制:Gitlab及Coding.net的使用
http://blog.csdn.net/pipisorry/article/details/50709014 Gitlab介绍 GitLab是利用 Ruby on Rails 一个开源的版本管理系统 ...
- SQL Server性能优化与管理的艺术 附件下载地址
首先感谢读者们对鄙人的支持,购买了<SQL Server性能优化与管理的艺术>,由于之前出版社的一些疏忽,附件没有上传成功,再次本人深表歉意. 请需要下载附件的读者从下面链接下载,谢谢: ...
- UNIX环境高级编程——守护进程列表
amd:自动安装NFS(网络文件系统)守侯进程apmd:高级电源治理Arpwatch:记录日志并构建一个在LAN接口上看到的以太网地址和ip地址对数据库Autofs:自动安装治理进程automount ...
- nginx 详解反向代理负载均衡
什么是反向代理负载均衡 使用代理服务器可以将请求转发给内部的Web服务器,使用这种加速模式显然可以提升静态网页的访问速度.因此也可以考虑使用这种技术,让代理服务器将请求 均匀转发给多台内部Web服务器 ...
- 转换xml格式的短信记录
<?xml version="1.0" encoding="UTF-8"?> <SMSRecord> <SMS> ...
- ROS_Kinetic_10 ROS程序基础Eclipse_C++(一)
ROS_Kinetic_10 ROS程序基础Eclipse_C++(一) 编写简单的消息发布器和订阅器 (C++) http://wiki.ros.org/cn/ROS/Tutorials/Writi ...