com.tonbeller.wcf.charset
Class CharsetFilter
java.lang.Object
com.tonbeller.wcf.charset.CharsetFilter
- All Implemented Interfaces:
- javax.servlet.Filter
- public class CharsetFilter
- extends java.lang.Object
- implements javax.servlet.Filter
sets the ServletRequest.setCharacterEncoding to UTF-8.
- Since:
- 18.05.2005
- Author:
- av
Method Summary |
void |
destroy()
|
void |
doFilter(javax.servlet.ServletRequest req,
javax.servlet.ServletResponse res,
javax.servlet.FilterChain chain)
|
static java.lang.String |
getEncoding()
returns the encoding for the URLEncoder. |
void |
init(javax.servlet.FilterConfig fc)
|
static java.lang.String |
urlEncode(java.lang.String s)
encodes s into utf-8 if the filter is installed, into iso-8859-1 else |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CharsetFilter
public CharsetFilter()
init
public void init(javax.servlet.FilterConfig fc)
throws javax.servlet.ServletException
- Specified by:
init
in interface javax.servlet.Filter
- Throws:
javax.servlet.ServletException
destroy
public void destroy()
- Specified by:
destroy
in interface javax.servlet.Filter
getEncoding
public static java.lang.String getEncoding()
- returns the encoding for the URLEncoder.
- Returns:
- "utf-8" when the filter was installed in web.xml, "iso8859-1" otherwise.
urlEncode
public static java.lang.String urlEncode(java.lang.String s)
- encodes s into utf-8 if the filter is installed, into iso-8859-1 else
doFilter
public void doFilter(javax.servlet.ServletRequest req,
javax.servlet.ServletResponse res,
javax.servlet.FilterChain chain)
throws java.io.IOException,
javax.servlet.ServletException
- Specified by:
doFilter
in interface javax.servlet.Filter
- Throws:
java.io.IOException
javax.servlet.ServletException