com.atlassian.core.filters.encoding
Class AbstractEncodingFilter
java.lang.Object
com.atlassian.core.filters.AbstractHttpFilter
com.atlassian.core.filters.encoding.AbstractEncodingFilter
- All Implemented Interfaces:
- javax.servlet.Filter
public abstract class AbstractEncodingFilter
- extends AbstractHttpFilter
Sets the encoding of request and response to a value defined by the application, and prevents later
changes to it by wrapping the response in a FixedHtmlEncodingResponseWrapper.
For unrelated functionality that used to be performed by the old filter, see the related classes below.
- Since:
- 4.0
- See Also:
AbstractCachingFilter,
NoContentLocationHeaderResponseWrapper,
WordCurlyQuotesRequestWrapper
|
Method Summary |
protected void |
doFilter(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
javax.servlet.FilterChain filterChain)
Sets the encoding of the request and the content-type of the response (which includes the
charset parameter) based on the values returned from the template methods. |
protected abstract java.lang.String |
getContentType()
Return the content type to be used for the response, via ServletResponse.setContentType(String). |
protected abstract java.lang.String |
getEncoding()
Return the encoding to be used on the request, via ServletRequest.setCharacterEncoding(String). |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AbstractEncodingFilter
public AbstractEncodingFilter()
doFilter
protected final void doFilter(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
javax.servlet.FilterChain filterChain)
throws java.io.IOException,
javax.servlet.ServletException
- Sets the encoding of the request and the content-type of the response (which includes the
charset parameter) based on the values returned from the template methods. Wraps the request
in a
FixedHtmlEncodingResponseWrapper to ensure the content-type is not changed later.
After setting the encoding and wrapping the request, the remainder of the filter chain is
processed normally.
If your application wants to be sure that the encoding set by this filter is used for all
HTML responses, this filter should be the first filter in your filter chain.
- Specified by:
doFilter in class AbstractHttpFilter
- Throws:
java.io.IOException
javax.servlet.ServletException- See Also:
Filter.doFilter(ServletRequest, ServletResponse, FilterChain)
getContentType
protected abstract java.lang.String getContentType()
- Return the content type to be used for the response, via
ServletResponse.setContentType(String).
The header should include a charset parameter. For example: "text/html; charset=UTF-8".
getEncoding
protected abstract java.lang.String getEncoding()
- Return the encoding to be used on the request, via
ServletRequest.setCharacterEncoding(String).
For example: "UTF-8".
Copyright © 2009 Atlassian Pty Ltd. All Rights Reserved.