Details
Description
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://xxxxx.itc.xxxx.com/odata/core.svc/Authenticate" \
-H "User-Agent: xxxx/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\":\"xxxx.internal
/50 (version 0.0.1; Cocoa)\",\"Scope\":\"register-anonymous\",\"ProviderName\":\"xxxxx\",\"Device\":{\"Type\":\"iOS\",\"Model\":\"iPhone\",\"OsVersion\":\"9.0.2\",\"OsName\":\"iPhone OS\"}}"
—
POST /xxxxx/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: xxxx/0.0.1 (iPhone; iOS 9.0.2; Scale/2.00)
Host: xxxx.itc.xxx.com
Connection: close
Content-Length: 212
{"Origin":"xxxxxx.internal\/50 (version 0.0.1; Cocoa)","Scope":"register-anonymous","ProviderName":"xxxxxxx","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!