eclipse-ee4j / grizzly

Grizzly
https://eclipse-ee4j.github.io/grizzly
Other
147 stars 69 forks source link

Content-Language Header is not added to http2 response #2146

Closed 11rx4f closed 2 years ago

11rx4f commented 2 years ago

Problem Description

Content-Language Header is not added to http2 response despite using ServletResponse#setlocale().

setlocale.zip

HTTP/2 200

Hello, World!


ServletResponse#setlocale() is described in [the servlet spec](https://javadoc.io/doc/jakarta.servlet/jakarta.servlet-api/latest/jakarta/servlet/ServletResponse.html#setLocale-java.util.Locale-) as bellow(*), so I think it is a bug.:

In the case of HTTP, the locale is communicated via the Content-Language header, the character encoding as part of the Content-Type header for text media types.


(*) When accessed via http1.1, Content-Language Header is added to response as below:

curl --http1.1 -s -k -i -X GET "http://localhost:8080/setlocale/sample"

HTTP/1.1 200 OK Server: Eclipse GlassFish 6.2.3 X-Powered-By: Servlet/5.0 JSP/3.0(Eclipse GlassFish 6.2.3 Java/Eclipse Foundation/11) Content-Language: en Content-Length: 14

Hello, World!


## Environment
* Server  
GlassFish (using grizzly-3.0.1 )
* JDK

java -version

openjdk version "11.0.12" 2021-07-20 OpenJDK Runtime Environment Temurin-11.0.12+7 (build 11.0.12+7) OpenJDK 64-Bit Server VM Temurin-11.0.12+7 (build 11.0.12+7, mixed mode)

* OS  
CentOS Linux release 7

## Steps to reproduce by glassfish
1. start-domain
2. deploy app setlocale.war

asadmin deploy setlocale.war

3. Access app by follwing command.

curl --http2 -s -k -i -X GET "http://localhost:8080/setlocale/sample"



## Impact of issue
This is violation of the API spec.  
https://javadoc.io/doc/jakarta.servlet/jakarta.servlet-api/latest/jakarta/servlet/ServletResponse.html#setLocale-java.util.Locale-