Get browser language

In Lucee 4.5 I use getPageContext().getRequest().getLocale().toString() to get the request preferred locale, but in Lucee 5 it dumps an error:


lucee.runtime.exp.NativeException: javax/servlet/http/HttpUpgradeHandler at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods( at

I can get the lang from the headers ‘Accept-Language’: GetHTTPRequestData().headers[‘Accept-Language’].split(’,’)[1] but looks like a hack to me.

Is there a Lucee 5 function to get the user preferred language ?


Which Lucee/Tomcat-Version are you using?
For me

<cfdump var="#getPageContext().getRequest().getLocale().toString()#">

is working fine …

Or you check the CGI-Scope: CGI.HTTP_ACCEPT_LANGUAGE

It’s a upgraded box from 4.5 to and Tomcat 7. I don’t think is a tomcat issue, because I use the same version with Lucee 4.5.

CGI.HTTP_ACCEPT_LANGUAGE it’s the same as GetHTTPRequestData().headers[‘Accept-Language’]

I have tried with a new server with commandbox and the getPageContext().getRequest().getLocale().toString() works ok, so definitely I think it’s a upgrade issue.

I have opened a bug:

thanks for taking the time to report this!