|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.cocoon.util.AbstractLogEnabled org.apache.cocoon.acting.AbstractAction org.apache.cocoon.acting.ServiceableAction org.apache.cocoon.acting.LocaleAction
An action that locates and provides to the pipeline locale information looked up in a range of ways.
A sample configuration (given in the <map:matchers> section of the sitemap) is given below. This configuration shows default values.
<map:action name="locale" src="org.apache.cocoon.acting.LocaleAction"> <locale-attribute>locale</locale-attribute> <use-locale>true</use-locale> <default-locale language="en" country="US"/> <store-in-request>false<store-in-request> <create-session>false<create-session> <store-in-session>false<store-in-session> <store-in-cookie>false<store-in-cookie> </map:action>
Above configuration parameters mean:
locale
)This action will be used in a pipeline like so:
<map:act type="locale"> <map:generate src="file_{language}_{country}_{variant}.xml"/> ... </map:match>
or
<map:act type="locale"> <map:generate src="file_{locale}.xml"/> ... </map:match>
Locales will be tested in following order:
use-locale
is set to true
First found locale will be returned.
Once locale has been found, the following sitemap variables will be available to sitemap elements contained within the action:
Field Summary | |
static String |
CREATE_SESSION
Constant representing the session creation configuration attribute |
static String |
LOCALE
Default locale attribute name. |
static String |
LOCALE_ATTR
Configuration element name for locale attribute name. |
static String |
STORE_COOKIE
Constant representing the cookie storage configuration attribute |
static String |
STORE_REQUEST
Constant representing the request storage configuration attribute |
static String |
STORE_SESSION
Constant representing the session storage configuration attribute |
Fields inherited from class org.apache.cocoon.acting.ServiceableAction |
manager |
Fields inherited from class org.apache.cocoon.acting.AbstractAction |
EMPTY_MAP |
Fields inherited from interface org.apache.cocoon.acting.Action |
ROLE |
Constructor Summary | |
LocaleAction()
|
Method Summary | |
Map |
act(org.apache.cocoon.environment.Redirector redirector,
org.apache.cocoon.environment.SourceResolver resolver,
Map objectModel,
String source,
Parameters params)
Action which obtains the current environments locale information, and places it in the objectModel (and optionally in a session/cookie). |
void |
configure(Configuration config)
Configure this action. |
static String |
getLocaleAttribute(Map objectModel,
String localeAttrName)
Deprecated. See I18nUtils.findLocale |
Methods inherited from class org.apache.cocoon.acting.ServiceableAction |
service |
Methods inherited from class org.apache.cocoon.util.AbstractLogEnabled |
getLogger, setLogger |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String LOCALE
public static final String LOCALE_ATTR
public static final String STORE_REQUEST
public static final String CREATE_SESSION
public static final String STORE_SESSION
public static final String STORE_COOKIE
Constructor Detail |
public LocaleAction()
Method Detail |
public void configure(Configuration config) throws ConfigurationException
configure
in interface Configurable
config
- configuration information (if any)
ConfigurationException
public Map act(org.apache.cocoon.environment.Redirector redirector, org.apache.cocoon.environment.SourceResolver resolver, Map objectModel, String source, Parameters params) throws Exception
act
in interface org.apache.cocoon.acting.Action
Exception
public static String getLocaleAttribute(Map objectModel, String localeAttrName)
objectModel
- requesting object's environment
null if no locale was found
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |