|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.cocoon.acting.AbstractAction
org.apache.cocoon.acting.ServiceableAction
org.apache.cocoon.acting.LocaleAction
public class 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 trueFirst 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(Redirector redirector,
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.avalon.framework.logger.AbstractLogEnabled |
|---|
enableLogging, getLogger, setupLogger, setupLogger, setupLogger |
| 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 Configurableconfig - configuration information (if any)
ConfigurationException
public Map act(Redirector redirector,
SourceResolver resolver,
Map objectModel,
String source,
Parameters params)
throws Exception
act in interface Actionresolver - The SourceResolver in chargeobjectModel - The Map with object of the
calling environment which can be used
to select values this controller may need
(ie Request, Response).source - A source String to the Actionparams - The Parameters for this invocation
Map object with
sitemap substitution values which can be used
in subsequent elements attributes like src=
using a xpath like expression: src="mydir/{myval}/foo"
If the return value is null the processing inside
the Exception - Indicates something is totally wrong
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 | |||||||||