https://bz.apache.org/bugzilla/show_bug.cgi?id=61917

            Bug ID: 61917
           Summary: AddDefaultCharsetFilter only supports text/* response
           Product: Tomcat 8
           Version: 8.5.24
          Hardware: PC
            Status: NEW
          Severity: minor
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: fuweic...@gmail.com
  Target Milestone: ----

Overview:
I want to use AddDefaultCharsetFilter as a generic purpose filter not only for
type text/* but also for type application/json, appliation/javascript, etc.

Steps to Reproduce:
1) Adding a filter registeration in web.xml
<filter>
        <filter-name>AddDefaultCharset</filter-name>
       
<filter-class>org.apache.catalina.filters.AddDefaultCharsetFilter</filter-class>
        <init-param>
                <param-name>encoding</param-name>
                <param-value>UTF-8</param-value>
        </init-param>
</filter>
<filter-mapping>
        <filter-name>AddDefaultCharset</filter-name>
        <servlet-name>default</servlet-name>
</filter-mapping>

2. Requesting a static json(e.g. /test.json) resource

Actual Results:
No default charset added in response header 'Content-Type'.
(AddDefaultCharsetFilter only adds default charset for type 'text/*')

Expected Results:
Add default charset for specified types.
response types which will be processed by AddDefaultCharsetFilter can be
specified through a init-param (e.g. with name 'accept' and with value
'application/json,text/*'),
if the init-param not present, use defaut value 'text/*'

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to