net.sourceforge.stripes.localization
Interface LocalePicker

All Superinterfaces:
ConfigurableComponent
All Known Implementing Classes:
DefaultLocalePicker

public interface LocalePicker
extends ConfigurableComponent

A LocalePicker is a class that determines what Locale a particular request will use. At first this may seem odd given that the request already has a method called getLocale(), but ask yourself this: if your site only supports English, and the user's browser requests the Japanese locale, in what locale should you accept their input?

The LocalPicker is given access to the request and can use any mechanism it chooses to decide upon a Locale. However, it must return a valid locale. It is suggested that if a locale cannot be chosen that the picker return the system locale.

Author:
Tim Fennell

Method Summary
 Locale pickLocale(HttpServletRequest request)
          Picks a locale for the HttpServletRequest supplied.
 
Methods inherited from interface net.sourceforge.stripes.config.ConfigurableComponent
init
 

Method Detail

pickLocale

Locale pickLocale(HttpServletRequest request)
Picks a locale for the HttpServletRequest supplied. Given that the request could be a regular request or a form upload request it is suggested that the LocalePicker only rely on the headers in the request, and perhaps the session, and not look for parameters.

Parameters:
request - the current HttpServletRequest
Returns:
Locale the locale to be used throughout the request for input parsing and localized output


© Copyright 2005, Stripes Development Team.