public class ISLocaleContext extends Object
ISLocaleContext is = new ISLocaleContext();
is.setOrgLocale ("o=isp,dc=iplanet,dc=com"); // sets the org locale
is.setLocale(req); // get locale from accept-lang,locale param etc
// if user logs in
is.setUserLocale (loc);
For your response, get the locale using:
is.getLocale();
Locale with highest priority takes precedence over lower priority.Modifier and Type | Field and Description |
---|---|
static int |
CORE_AUTH_LOCALE |
static int |
HTTP_HEADER_LOCALE |
static int |
OS_LOCALE |
static int |
PLATFORM_LOCALE |
static int |
URL_LOCALE |
static int |
USER_PREFERRED_LOCALE |
Constructor and Description |
---|
ISLocaleContext()
Initializes
ISLocaleContext to default level It examines
OS_LOCALE, PLATFORM_LOCALE, AUTH_LOCALE and initialize them based on
their priority |
ISLocaleContext(String orgDN)
Initialize
ISLocaleContext for a given Org It can look
into orgs core auth locale value and set the value if it is available |
Modifier and Type | Method and Description |
---|---|
String |
getJavaCharset()
get java charset to be used for current request This class detectes
clientType using Http-Accept-Lang header You should have used
setLocale(HttpServletRequest req) before calling this method.
|
Locale |
getLocale()
Returns Locale value that has got highest prioirty
|
int |
getLocaleLevel()
get current priority level of locale
|
String |
getMIMECharset()
get mime charset to be used for current request This class detectes
clientType using Http-Accept-Lang header You should have used
setLocale(HttpServletRequest req) before calling this method.
|
void |
setLocale(org.forgerock.json.resource.http.HttpContext context)
Returns the locale based on the Http Context supplied.
|
void |
setLocale(javax.servlet.http.HttpServletRequest request)
Set locale based on HTTP Servlet Request.
|
void |
setLocale(int level,
Locale loc)
Set locale to given level.
|
void |
setLocale(int level,
String loc)
Set locale to given level.
|
void |
setOrgLocale(String orgDN)
Update locale context based on org locale user locale takes precedence
over this locale
|
void |
setUserLocale(Locale loc)
Set the current locale level to
USER_LOCALE and sets the
value if current locale level is greater than USER_LOCALE ,
this setting will be ignored. |
void |
setUserLocale(String loc)
Set the current locale level to
USER_LOCALE and sets the
value the locale value is separated by underscore character
ex:en_US . |
public static final int OS_LOCALE
public static final int PLATFORM_LOCALE
public static final int CORE_AUTH_LOCALE
public static final int USER_PREFERRED_LOCALE
public static final int HTTP_HEADER_LOCALE
public static final int URL_LOCALE
public ISLocaleContext()
ISLocaleContext
to default level It examines
OS_LOCALE, PLATFORM_LOCALE, AUTH_LOCALE and initialize them based on
their prioritypublic ISLocaleContext(String orgDN)
ISLocaleContext
for a given Org It can look
into orgs core auth locale value and set the value if it is availablepublic void setLocale(int level, String loc)
level
- Possible values are OS_LOCALE,PLATFORM_LOCALE
AUTH_LOCALE
, ACCEPT_LOCALE
,
USER_PREFERRED_LOCALE
, URL_LOCALE
.loc
- Locale value in string example en
,
ja_JP. Warning: This method overrides priority
lookup mechanism.
public void setLocale(int level, Locale loc)
level
- Possible values are OS_LOCALE,PLATFORM_LOCALE
AUTH_LOCALE
, ACCEPT_LOCALE
,
USER_PREFERRED_LOCALE
, URL_LOCALE
.loc
- Locale value.public void setLocale(org.forgerock.json.resource.http.HttpContext context)
context
- The HttpContext
of the requestpublic void setLocale(javax.servlet.http.HttpServletRequest request)
request
- Analyze HttpHeader and look for URL parameter called
locale . If it is set, it takes high precedence. Else look for
accept-language
header and set the locale if it
is present.public void setUserLocale(Locale loc)
USER_LOCALE
and sets the
value if current locale level is greater than USER_LOCALE
,
this setting will be ignored.loc
- Locale.public void setUserLocale(String loc)
USER_LOCALE
and sets the
value the locale value is separated by underscore character
ex:en_US
.loc
- Locale.public Locale getLocale()
public int getLocaleLevel()
public void setOrgLocale(String orgDN)
orgDN
- -
Distinguished Name of Organizationpublic String getMIMECharset()
public String getJavaCharset()
Copyright © 2010–2025 Open Identity Platform Community. All rights reserved.