pulse - the web application framework Get pulse at SourceForge.net. Fast, secure and Free Open Source software downloads Ohloh project report for pulse-java

org.torweg.pulse.component.core
Class LocalizationLocator

java.lang.Object
  extended by org.torweg.pulse.bundle.Controller
      extended by org.torweg.pulse.component.core.LocalizationLocator

public final class LocalizationLocator
extends Controller

attempts to find a matching localisation for the SitemapNode defined in the Command.

The localisation must be mapped as a translation of the Content attached to the SitemapNode. The Controller uses Content.getLocalizationMap() to find available localisations.

If an additional parameter targetLocale is given, the locator tries to find the localisation in the given target locale. If the parameter is omitted or the localisation is not available in the target locale, the locator tries to find a matching locale via the Accept-Language request header and the request origin ( ServiceRequest.getRequestOrigin()). If this does also yield no matches, the user is redirected to the original SitemapNode.

This Controller is especially useful when you establish short entry URLs in conjunction with Apache HTTP Server's mod_rewrite to map URLs like http://pulse.torweg.org/support to a localised version of the support page.

Version:
$Revision: 1975 $
Author:
Thomas Weber

Nested Class Summary
 
Nested classes/interfaces inherited from class org.torweg.pulse.bundle.Controller
Controller.AlwaysRun
 
Constructor Summary
LocalizationLocator()
           
 
Method Summary
 java.lang.Object findLocalization(ServiceRequest request)
          tries to find a matching localisation for the SitemapNode defined in the Command.
 
Methods inherited from class org.torweg.pulse.bundle.Controller
getAlwaysRun, isAlwaysRun, setAlwaysRun
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalizationLocator

public LocalizationLocator()
Method Detail

findLocalization

@Action(value="findLocalization", stripSitemapID=false, generate=true)
@Permission(value="findLocalization")
public java.lang.Object findLocalization(ServiceRequest request)
tries to find a matching localisation for the SitemapNode defined in the Command.

If the current Command does not contain a sitemapID the locator does nothing.

If an additional parameter targetLocale is given, the locator tries to find the localisation in the given target locale. If no localisation could be found, the user is redirected to the target locales homepage.

If the targetLocale parameter is omitted, the locator tries to find a matching locale via the LocaleManager. If this does yield to no matches, the user is redirected to the original SitemapNode .

Parameters:
request - the current request
Returns:
null