| Modifier and Type | Class and Description |
|---|---|
| public static class | AddDefaultCharsetFilter.
Wrapper that adds a character set for text media types if no character set is specified. |
| Modifier and Type | Field and Description |
|---|---|
| private static final String | |
| private String | |
| private final Log |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | doFilter(ServletRequest
The request to process request, ServletResponse The response associated with the request response, FilterChain Provides access to the next filter in the chain for this filter to pass the request and response
to for further processing chain)Implements jakarta. The |
| protected Log | |
| public void | init(FilterConfig
The configuration information associated with the filter instance being initialised filterConfig)Overrides org. Overrides default jakarta. Iterates over the configuration parameters and either logs a warning, or throws an exception for any parameter that does not have a matching setter in this filter. |
| public void |
| DEFAULT_ENCODING | back to summary |
|---|---|
| private static final String DEFAULT_ENCODING | |
| encoding | back to summary |
|---|---|
| private String encoding | |
| log | back to summary |
|---|---|
| private final Log log | |
| AddDefaultCharsetFilter | back to summary |
|---|---|
| public AddDefaultCharsetFilter() | |
| doFilter | back to summary |
|---|---|
| public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException Implements jakarta. Doc from jakarta. The
A typical implementation of this method would follow the following pattern:-
| |
| getLogger | back to summary |
|---|---|
| protected Log getLogger() Implements abstract org.
| |
| init | back to summary |
|---|---|
| public void init(FilterConfig filterConfig) throws ServletException Overrides org. Overrides default jakarta. Doc from org. Iterates over the configuration parameters and either logs a warning, or throws an exception for any parameter that does not have a matching setter in this filter.
| |
| setEncoding | back to summary |
|---|---|
| public void setEncoding(String encoding) | |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | addHeader(String
the name of the header name, String the additional header value If it contains octet string, it should be encoded according to RFC 2047
(http://www.ietf.org/rfc/rfc2047.txt) value)Overrides jakarta. Implements jakarta. The default behavior of this method is to return addHeader(String name, String value) on the wrapped response object. |
| public void | setCharacterEncoding(String
a String specifying only the character set defined by IANA Character Sets
(http://www.iana.org/assignments/character-sets) charset)Overrides jakarta. Implements jakarta. Sets the character encoding (MIME charset) of the response being sent to the client, for example, to UTF-8. |
| public void | setContentType(String
a contentType)String specifying the MIME type of the contentOverrides jakarta. Implements jakarta. Sets the content type of the response being sent to the client, if the response has not been committed yet. |
| public void | setHeader(String
the name of the header name, String the header value If it contains octet string, it should be encoded according to RFC 2047
(http://www.ietf.org/rfc/rfc2047.txt) value)Overrides jakarta. Implements jakarta. The default behavior of this method is to return setHeader(String name, String value) on the wrapped response object. |
| encoding | back to summary |
|---|---|
| private String encoding | |
| ResponseWrapper | back to summary |
|---|---|
| public ResponseWrapper(HttpServletResponse response, String encoding) | |
| addHeader | back to summary |
|---|---|
| public void addHeader(String name, String value) Overrides jakarta. Implements jakarta. Doc from jakarta. The default behavior of this method is to return addHeader(String name, String value) on the wrapped response object.
| |
| setCharacterEncoding | back to summary |
|---|---|
| public void setCharacterEncoding(String charset) Overrides jakarta. Implements jakarta. Doc from jakarta. Sets the character encoding (MIME charset) of the response being sent to the client, for example, to UTF-8. If
the character encoding has already been set by container default, ServletContext default,
This method can be called repeatedly to change the character encoding. This method has no effect if it is called
after
Containers must communicate the character encoding used for the servlet response's writer to the client if the
protocol provides a way for doing so. In the case of HTTP, the character encoding is communicated as part of the
| |
| setContentType | back to summary |
|---|---|
| public void setContentType(String contentType) Overrides jakarta. Implements jakarta. Doc from jakarta. Sets the content type of the response being sent to the client, if the response has not been committed yet. The
given content type may include a character encoding specification, for example,
This method may be called repeatedly to change content type and character encoding. This method has no effect if
called after the response has been committed. It does not set the response's character encoding if it is called
after
Containers must communicate the content type and the character encoding used for the servlet response's writer to
the client if the protocol provides a way for doing so. In the case of HTTP, the | |
| setHeader | back to summary |
|---|---|
| public void setHeader(String name, String value) Overrides jakarta. Implements jakarta. Doc from jakarta. The default behavior of this method is to return setHeader(String name, String value) on the wrapped response object.
| |