类 ResourceUrlEncodingFilter
- java.lang.Object
- org.springframework.web.filter.GenericFilterBean
- org.springframework.web.servlet.resource.ResourceUrlEncodingFilter
- 所有已实现的接口:
Filter
,Aware
,BeanNameAware
,DisposableBean
,InitializingBean
,EnvironmentAware
,EnvironmentCapable
,ServletContextAware
public class ResourceUrlEncodingFilter extends GenericFilterBean
A filter that wraps theHttpServletResponse
and overrides itsencodeURL
method in order to translate internal resource request URLs into public URL paths for external use.- 从以下版本开始:
- 4.1
- 作者:
- Jeremy Grelle, Rossen Stoyanchev, Sam Brannen, Brian Clozel
构造器概要
构造器 构造器 说明 ResourceUrlEncodingFilter()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 void
doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain)
ThedoFilter
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.从类继承的方法 org.springframework.web.filter.GenericFilterBean
addRequiredProperty, afterPropertiesSet, createEnvironment, destroy, getEnvironment, getFilterConfig, getFilterName, getServletContext, init, initBeanWrapper, initFilterBean, setBeanName, setEnvironment, setServletContext
构造器详细资料
ResourceUrlEncodingFilter
public ResourceUrlEncodingFilter()
方法详细资料
doFilter
public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws ServletException, IOException
从接口复制的说明:javax.servlet.Filter
ThedoFilter
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.A typical implementation of this method would follow the following pattern:
- Examine the request
- Optionally wrap the request object with a custom implementation to filter content or headers for input filtering
- Optionally wrap the response object with a custom implementation to filter content or headers for output filtering
- Either invoke the next entity in the chain using the FilterChain object (
chain.doFilter()
), - or not pass on the request/response pair to the next entity in the filter chain to block the request processing
- Either invoke the next entity in the chain using the FilterChain object (
- Directly set headers on the response after invocation of the next entity in the filter chain.
- 参数:
request
- theServletRequest
object contains the client's requestresponse
- theServletResponse
object contains the filter's responsefilterChain
- theFilterChain
for invoking the next filter or the resource- 抛出:
ServletException
- if an exception occurs that interferes with the filter's normal operationIOException
- if an I/O related error has occurred during the processing- 另请参阅:
UnavailableException