Jose Luis López created HADOOP-20006:
----------------------------------------
Summary: Clear the response charset along with the content type
Key: HADOOP-20006
URL: https://issues.apache.org/jira/browse/HADOOP-20006
Project: Hadoop Common
Issue Type: Sub-task
Components: common, hdfs, mapreduce, yarn
Reporter: Jose Luis López
Every server {{HttpServer2}} builds runs {{QuotingInputFilter}}, which sets
{{text/plain; charset=utf-8}} before the request reaches its resource. JAX-RS
resources that choose their own content type undo it with
{{response.setContentType(null)}}, at 14 call sites in 13 classes.
On Jetty 12 that is not enough. The charset is dropped, but the response
remembers that one was set and appends it to the next content type, so WebHDFS
SETPERMISSION answers {{application/octet-stream;charset=null}}. Types without
a default charset are affected, {{application/xml}} among them;
{{application/json}} is not.
h3. Changes
* New {{JettyUtils#clearContentType(HttpServletResponse)}} calls
{{setContentType(null)}} and {{setCharacterEncoding(null)}}. It uses only
{{javax.servlet}}.
* It is used at all 14 call sites: {{NamenodeWebHdfsMethods}}, the WebHDFS
{{ExceptionHandler}}, {{AMWebServices}}, {{HsWebServices}},
{{GenericExceptionHandler}}, {{TimelineWebServices}}, {{LogWebService}},
{{WebServices}}, {{NMWebServices}}, {{RMWebServices}}, {{RouterWebServices}},
{{TimelineCollectorWebService}} and {{TimelineReaderWebServices}}.
h3. Compatibility
No change on Jetty 9.4.
h3. Tests
{{TestHttpServer}} asserts the Content-Type header a resource sends after
clearing and re-setting its content type.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]