org.apache.cocoon.acting
Class LangSelect

java.lang.Object
  |
  +--org.apache.avalon.framework.logger.AbstractLoggable
        |
        +--org.apache.cocoon.acting.LangSelect
All Implemented Interfaces:
Action, org.apache.avalon.framework.component.Component, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.logger.Loggable, org.apache.avalon.framework.thread.ThreadSafe

Deprecated. Use LocaleAction instead.

public class LangSelect
extends org.apache.avalon.framework.logger.AbstractLoggable
implements Action, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.thread.ThreadSafe

LangSelect Action returns two character language code to sitemap. Definition in sitemap:

 <map:actions>
                <map:action name="lang_select" src="org.apache.cocoon.acting.LangSelect"/>
 
And you use it in following way:
 <map:match pattern="file">
 <map:act type="lang_select">
                <map:generate src="file_{lang}.xml"/>
 </map:act>
 
{lang} is substituted with language code. eg. if user selects url ../file?lang=en then Sitemap engine generates file_en.xml source. Creation date: (3.11.2000 14:32:19) Modification date: (29.05.2001 0:30:01)

Version:
CVS $Id: LangSelect.java,v 1.7.2.1 2002/07/15 14:42:48 cziegeler Exp $
Author:
Konstantin Piroumian, Lassi Immonen

Fields inherited from interface org.apache.cocoon.acting.Action
ROLE
 
Constructor Summary
LangSelect()
          Deprecated.  
 
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)
          Deprecated. Selects language if it is not set already in objectModel Puts lang parameter to session and to objectModel if it is not already there.
 void configure(org.apache.avalon.framework.configuration.Configuration conf)
          Deprecated. Configure this action.
static java.lang.String getLang(java.util.Map objectModel, org.apache.avalon.framework.parameters.Parameters par)
          Deprecated. Returns two character language code by checking environment in following order Http request has parameter lang Http session has parameter lang Cookies has parameter lang User locales has matching language we are providing Otherwise we return default_lang from sitemap or if that is not found then 'en'
 void storeLang(java.util.Map objectModel, java.lang.String lang)
          Deprecated. Stores language code in the session or a cookie
 
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
 

Constructor Detail

LangSelect

public LangSelect()
Deprecated. 
Method Detail

configure

public void configure(org.apache.avalon.framework.configuration.Configuration conf)
               throws org.apache.avalon.framework.configuration.ConfigurationException
Deprecated. 
Configure this action.
Specified by:
configure in interface org.apache.avalon.framework.configuration.Configurable

act

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
Deprecated. 
Selects language if it is not set already in objectModel Puts lang parameter to session and to objectModel if it is not already there.
Specified by:
act in interface Action
Following copied from interface: org.apache.cocoon.acting.Action
Parameters:
resolver - The SourceResolver in charge
objectModel - 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 Action
parameters - The Parameters for this invocation
Returns:
Map The returned 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 element of the sitemap will be skipped.
Throws:
java.lang.Exception - Indicates something is totally wrong

getLang

public static java.lang.String getLang(java.util.Map objectModel,
                                       org.apache.avalon.framework.parameters.Parameters par)
Deprecated. 
Returns two character language code by checking environment in following order
  1. Http request has parameter lang
  2. Http session has parameter lang
  3. Cookies has parameter lang
  4. User locales has matching language we are providing
  5. Otherwise we return default_lang from sitemap or if that is not found then 'en'
Parameters:
objectModel - java.util.Map
par - org.apache.avalon.framework.parameter.Parameters
Returns:
java.lang.String

storeLang

public void storeLang(java.util.Map objectModel,
                      java.lang.String lang)
               throws java.lang.Exception
Deprecated. 
Stores language code in the session or a cookie
Parameters:
objectModel - java.util.Map
lang - String The language code to store


Copyright � 1999-2002 Apache Software Foundation. All Rights Reserved.