GenericFilterBean源码详解

本文详细探讨了Spring框架中GenericFilterBean的源码实现,揭示了其在Web过滤器工作流程中的作用,重点在于如何为子类提供过滤操作的基础。
摘要由CSDN通过智能技术生成

package org.springframework.web.filter;

//接口GeneiricFilterBean把doFilter的工作留给了子类

public abstract class GenericFilterBean implements
Filter, BeanNameAware, EnvironmentAware, ServletContextAware, InitializingBean, DisposableBean {
protected final Log logger = LogFactory.getLog(getClass());
/**
* Set of required properties (Strings) that must be supplied as
* config parameters to this filter.
*/
private final Set<String> requiredProperties = new HashSet<String>();


private FilterConfig filterConfig;


private String beanName;


private Environment environment = new StandardServletEnvironment();


private ServletContext servletContext;




/**
* Stores the bean name as defined in the Spring bean factory.
* <p>Only relevant in case of initialization as bean, to have a name as
* fallback to the filter name usually provided by a FilterConfig instance.
* @see org.springframework.beans.factory.BeanNameAware
* @see #getFilterName()
*/
public final void setBeanName(String beanName) {
this.beanName = beanName;
}


/**
* {@inheritDoc}
* <p>Any environment set here overrides the {@link StandardServletEnvironment}
* provided by default.
* <p>This {@code Environment} object is used only for resolving placeholders in
* resource paths passed into init-parameters for this filter. If no init-params are
* used, this {@code Environment} can be essentially ignored.
* @see #init(FilterConfig)
*/
public void setEnvironment(Environment environment) {
this.environment = environment;
}


/**
* Stores the ServletContext that the bean factory runs in.
* <p>Only relevant in case of initialization as bean, to have a ServletContext
* as fallback to the context usually provided by a FilterConfig instance.
* @see org.springframework.web.context.ServletContextAware
* @see #getServletContext()
*/
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值