WeiTah CHAI created CXF-6640:
--------------------------------
Summary: [Locale Issue] HTTP header Issue for IOS 9 + Chinese
Language user
Key: CXF-6640
URL: https://issues.apache.org/jira/browse/CXF-6640
Project: CXF
Issue Type: Bug
Components: JAX-RS
Affects Versions: 3.1.0
Environment: Linux Server + Java 7 + IOS 9 + HTTP Req
Reporter: WeiTah CHAI
Encountered http language issue in Apple IOS recently:
- After they upgrade to IOS9
- If they enable Chinese input
When HTTP request initiated from IOS 9, there will have additional HTTP Header
for "Accept-Language", and if the Chinese Input is enable, the header would
look like: "Accept-Language: en-GB;q=1, zh-Hans-SG;q=0.9, en-SG;q=0.8".
Somehow the locale with "variants" is not support in apache CXF, and Illegal
locale exception throw.
-
http://grepcode.com/file/repo1.maven.org/maven2/org.apache.cxf/cxf-rt-frontend-jaxrs/3.1.0/org/apache/cxf/jaxrs/utils/HttpUtils.java/
- Line #280.
- Using version 2.7.5 but the same issue still remain in 3.1.0
Quick fix is much appreciated. Thank you
Sample request:
—
curl -X "POST"
"https://castagingbev2.itc.sap.com/mobiliser/odata/core.svc/Authenticate" \
-H "User-Agent: CityAppNG/0.0.1 (iPhone; iOS 9.0.2; Scale/2.00)" \
-H "Accept-Language: en-GB;q=1, zh-Hans-SG;q=0.9, en-SG;q=0.8" \
-H "Content-Type: application/json" \
-H "Accept: application/json; charset=utf-8" \
-d "{\"Origin\":\"com.sap.cityapp.nuremberg.internal\\/50 (version 0.0.1;
Cocoa)\",\"Scope\":\"register-anonymous\",\"ProviderName\":\"mobiliser\",\"Device\":{\"Type\":\"iOS\",\"Model\":\"iPhone\",\"OsVersion\":\"9.0.2\",\"OsName\":\"iPhone
OS\"}}"
—
POST /mobiliser/odata/core.svc/Authenticate HTTP/1.1
Accept: application/json; charset=utf-8
Content-Type: application/json
Accept-Language: en-GB;q=1, zh-Hans-SG;q=0.9, en-SG;q=0.8
User-Agent: CityAppNG/0.0.1 (iPhone; iOS 9.0.2; Scale/2.00)
Host: castagingbev2.itc.sap.com
Connection: close
Content-Length: 212
{"Origin":"com.sap.cityapp.nuremberg.internal\/50 (version 0.0.1;
Cocoa)","Scope":"register-anonymous","ProviderName":"mobiliser","Device":{"Type":"iOS","Model":"iPhone","OsVersion":"9.0.2","OsName":"iPhone
OS"}}
Response:
HTTP/1.1 500 Server Error
Server: nginx/1.4.6 (Ubuntu)
Date: Wed, 07 Oct 2015 17:20:08 GMT
Content-Type: text/plain
Content-Length: 40
Connection: close
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
Exception during error handling occurred!
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)