Object
The L10nResourceManager
helps resolve resources
(such as JSP pages, static resources such as HTML files, images
etc.) based on a given locale.
Given a resource path in the form [dir]/[name] where [dir] is the directory ("/" separated, relative to the web app root) and [name] is the name of the resource, this class resolves the path to a localized version, if available.
For resolving a resource to a localized version, this class expects the locale to be present in the path structure as a sub-directory.
For instance, the following localized resources are considered valid for a resource "/portlets/news/flash.jsp":
This class resolves a localized version of in the following search order:
In order to enable this class to recognize newly added or deleted resources after server startup, enable hot deployment for classes via the WebLogic Server admin console.
Object
L10nResourceManager
Constructor Summary |
|
Method Summary |
public void |
|
public static |
|
public |
|
public |
|
public |
|
public |
|
public |
|
public |
|
Methods from class java.lang. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
protected L10nResourceManager(ServletContext
context)
Constructs an instance of L10nResourceManager
for the given context.
Method Detail |
public void ensureReloaded()
Ensures that the cached resources are fresh.
public staticL10nResourceManager
getInstance(ServletContext
context)
Returns an instance of L10nResourceManager
.
publicEnumeration
getPreferredLocales(ServletRequest
request)
Accessor for getting an Enumeration of preferred locales based on both the request and the setting of the internal localeProvider object, which is optionally overrideable by developers.
ServletRequest
Locale
objects as
determined from the request by the configured LocaleProvider
publicArrayList
getPreferredLocalesAsList(ServletRequest
request)
Accessor for getting an ordered collection of preferred locales. Used in places where l10nManager cannot be used directly, but where a collection may be passed to a consumer of locales.
ServletRequest
ArrayList
containing Locale
objects publicString
resolve(String
path,ServletRequest
request)
Resolves the given path per the given locales to a localized resource. Applications may use this method to resolve resources such as JSP pages, or other static resources to locales.
ServletRequest
publicString
resolve(String
path,ServletRequest
request,ResolvedLocale
resolvedLocale)
Resolves the given path per the given locales to a localized resource. Applications may use this method to resolve resources such as JSP pages, or other static resources to locales.
This version of resolve accepts an out argument that is populated with extra resolution information.
ServletRequest
ResolvedLocale
object to populate with resolution information publicString
resolve(String
path,Enumeration
locales)
Resolves the given path per the given locales to a localized resource. Applications may use this method to resolve resources such as JSP pages, or other static resources to locales.
Locales
to use for resolution publicString
resolve(String
path,Enumeration
locales,ResolvedLocale
resolvedLocale)
Resolves the given path per the given locales to a localized resource. Applications may use this method to resolve resources such as JSP pages, or other static resources to locales.
This version of resolve accepts an out argument that is populated with extra resolution information.
Locales
to use for resolution ResolvedLocale
object to populate with resolution information