Issue
The accept-language header in request is usually a long complex string -
Eg.
Accept-Language : en-ca,en;q=0.8,en-us;q=0.6,de-de;q=0.4,de;q=0.2
Is there a simple way to parse it in java? Or a API to help me do that?
Solution
I would suggest using ServletRequest.getLocales()
to let the container parse Accept-Language rather than trying to manage the complexity yourself.
Answered By - Brett Kail