com.jdon.util
类 SetCharacterEncodingFilter

java.lang.Object
  继承者 com.jdon.util.SetCharacterEncodingFilter
所有已实现的接口:
javax.servlet.Filter

public class SetCharacterEncodingFilter
extends Object
implements javax.servlet.Filter

Filter that sets the character encoding to be used in parsing the incoming request, either unconditionally or only if the client did not specify a character encoding. Configuration of this filter is based on the following initialization parameters:

Although this filter can be used unchanged, it is also easy to subclass it and make the selectEncoding() method more intelligent about what encoding to choose, based on characteristics of the incoming request (such as the values of the Accept-Language and User-Agent headers, or a value stashed in the current user's session.

版本:
$Id: SetCharacterEncodingFilter.java,v 1.1.1.1 2004/12/26 09:07:46 jdon Exp $
作者:
John Wong

字段摘要
protected  String encoding
          The default character encoding to set for requests that pass through this filter.
protected  javax.servlet.FilterConfig filterConfig
          The filter configuration object we are associated with.
protected  boolean ignore
          Should a character encoding specified by the client be ignored?
 
构造方法摘要
SetCharacterEncodingFilter()
           
 
方法摘要
 void destroy()
          Take this filter out of service.
 void doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain)
          Select and set (if specified) the character encoding to be used to interpret request parameters for this request.
 void init(javax.servlet.FilterConfig filterConfig)
          Place this filter into service.
protected  String selectEncoding(javax.servlet.ServletRequest request)
          Select an appropriate character encoding to be used, based on the characteristics of the current request and/or filter initialization parameters.
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

encoding

protected String encoding
The default character encoding to set for requests that pass through this filter.


filterConfig

protected javax.servlet.FilterConfig filterConfig
The filter configuration object we are associated with. If this value is null, this filter instance is not currently configured.


ignore

protected boolean ignore
Should a character encoding specified by the client be ignored?

构造方法详细信息

SetCharacterEncodingFilter

public SetCharacterEncodingFilter()
方法详细信息

destroy

public void destroy()
Take this filter out of service.

指定者:
接口 javax.servlet.Filter 中的 destroy

doFilter

public void doFilter(javax.servlet.ServletRequest request,
                     javax.servlet.ServletResponse response,
                     javax.servlet.FilterChain chain)
              throws IOException,
                     javax.servlet.ServletException
Select and set (if specified) the character encoding to be used to interpret request parameters for this request.

指定者:
接口 javax.servlet.Filter 中的 doFilter
参数:
request - The servlet request we are processing
result - The servlet response we are creating
chain - The filter chain we are processing
抛出:
IOException - if an input/output error occurs
javax.servlet.ServletException - if a servlet error occurs

init

public void init(javax.servlet.FilterConfig filterConfig)
          throws javax.servlet.ServletException
Place this filter into service.

指定者:
接口 javax.servlet.Filter 中的 init
参数:
filterConfig - The filter configuration object
抛出:
javax.servlet.ServletException

selectEncoding

protected String selectEncoding(javax.servlet.ServletRequest request)
Select an appropriate character encoding to be used, based on the characteristics of the current request and/or filter initialization parameters. If no character encoding should be set, return null.

The default implementation unconditionally returns the value configured by the encoding initialization parameter for this filter.

参数:
request - The servlet request we are processing


Copyright © 2013. All Rights Reserved.