|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.avalon.framework.logger.AbstractLoggable | +--org.apache.cocoon.acting.AbstractAction | +--org.apache.cocoon.acting.ComposerAction | +--org.apache.cocoon.acting.LocaleAction
LocaleAction is a class which obtains the request's locale information (language, country, variant) and makes it available to the sitemap/pipeline. Definition in sitemap:
<map:actions> <map:action name="locale" src="org.apache.cocoon.acting.LocaleAction"/> </map:actions>Examples:
<map:match pattern="file"> <map:act type="locale"> <map:generate src="file_{lang}{country}{variant}.xml"/> </map:act> </map:match>or
<map:match pattern="file"> <map:act type="locale"> <map:generate src="file.xml?locale={locale}"/> </map:act> </map:match>
lang
, country
,
variant
, and locale
are all available. Note that
country
and variant
can be empty, however
lang
and locale
will always contain a valid value.
<map:action name="locale" src="org.apache.cocoon.acting.LocaleAction"> <language-attribute>lg</language-attribute> </map:action>or:
<map:act type="locale"> <map:parameter name="language-attribute" value="lg"/> </map:act>
Field Summary | |
static java.lang.String |
COUNTRY
Constant representing the country parameter |
static java.lang.String |
COUNTRY_ATTR
Constant representing the country configuration attribute |
static java.lang.String |
CREATE_SESSION
Constant representing the session creation configuration attribute |
static java.lang.String |
LANG
Constant representing the language parameter |
static java.lang.String |
LANG_ATTR
Constant representing the language configuration attribute |
static java.lang.String |
LOCALE
Constant representing the locale parameter |
static java.lang.String |
LOCALE_ATTR
Constant representing the locale configuration attribute |
static java.lang.String |
STORE_COOKIE
Constant representing the cookie storage configuration attribute |
static java.lang.String |
STORE_REQUEST
Constant representing the request storage configuration attribute |
static java.lang.String |
STORE_SESSION
Constant representing the session storage configuration attribute |
static java.lang.String |
VARIANT
Constant representing the variant parameter |
static java.lang.String |
VARIANT_ATTR
Constant representing the variant configuration attribute |
Fields inherited from class org.apache.cocoon.acting.ComposerAction |
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 | |
java.util.Map |
act(Redirector redirector,
SourceResolver resolver,
java.util.Map objectModel,
java.lang.String source,
org.apache.avalon.framework.parameters.Parameters par)
Action which obtains the current environments locale information, and places it in the objectModel (and optionally in a session/cookie). |
void |
configure(org.apache.avalon.framework.configuration.Configuration conf)
Configure this action. |
static java.lang.String |
getLocaleAttribute(java.util.Map objectModel)
Helper method to access Locale sub component values. |
Methods inherited from class org.apache.cocoon.acting.ComposerAction |
compose |
Methods inherited from class org.apache.avalon.framework.logger.AbstractLoggable |
getLogger, setLogger, 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 java.lang.String LANG
public static final java.lang.String COUNTRY
public static final java.lang.String VARIANT
public static final java.lang.String LOCALE
public static final java.lang.String LANG_ATTR
public static final java.lang.String COUNTRY_ATTR
public static final java.lang.String VARIANT_ATTR
public static final java.lang.String LOCALE_ATTR
public static final java.lang.String STORE_REQUEST
public static final java.lang.String CREATE_SESSION
public static final java.lang.String STORE_SESSION
public static final java.lang.String STORE_COOKIE
Constructor Detail |
public LocaleAction()
Method Detail |
public void configure(org.apache.avalon.framework.configuration.Configuration conf) throws org.apache.avalon.framework.configuration.ConfigurationException
configure
in interface org.apache.avalon.framework.configuration.Configurable
conf
- configuration information (if any)public java.util.Map act(Redirector redirector, SourceResolver resolver, java.util.Map objectModel, java.lang.String source, org.apache.avalon.framework.parameters.Parameters par) throws java.lang.Exception
org.apache.cocoon.acting.Action
resolver
- 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 Actionparameters
- The Parameters
for this invocationMap
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 java.lang.Exception
- Indicates something is totally wrongpublic static java.lang.String getLocaleAttribute(java.util.Map objectModel) throws java.lang.Exception
objectModel
- requesting object's environmentjava.lang.Exception
- should some error occur
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |