Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-6640

[Locale Issue] HTTP header Issue for IOS 9 + Chinese Language user

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.1
    • 3.1.1
    • JAX-RS
    • Linux Server + Java 7 + IOS 9 + HTTP Req

    • Novice

    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.

      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!

      Attachments

        Activity

          People

            sergey_beryozkin Sergey Beryozkin
            postalc WeiTah CHAI
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 48h
                48h
                Remaining:
                Remaining Estimate - 48h
                48h
                Logged:
                Time Spent - Not Specified
                Not Specified