站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Spring Framework 1.2.9 API 文档英文版

LocaleResolver (Spring Framework) - Spring Framework 1.2.9 API 文档英文版


org.springframework.web.servlet
Interface LocaleResolver

All Known Implementing Classes:
AbstractLocaleResolver, AcceptHeaderLocaleResolver, CookieLocaleResolver, FixedLocaleResolver, SessionLocaleResolver

public interface LocaleResolver

Interface for web-based locale resolution strategies that allows for both locale resolution via the request and locale modification via request and response.

This interface allows for implementations based on request, session, cookies, etc. The default implementation is AcceptHeaderLocaleResolver, simply using the request's locale provided by the respective HTTP header.

Use RequestContext.getLocale() to retrieve the current locale in controllers or views, independent of the actual resolution strategy.

Since:
27.02.2003
Author:
Juergen Hoeller
See Also:
AcceptHeaderLocaleResolver, RequestContext.getLocale()

Method Summary
 Locale resolveLocale(HttpServletRequest request)
          Resolve the current locale via the given request.
 void setLocale(HttpServletRequest request, HttpServletResponse response, Locale locale)
          Set the current locale to the given one.
 

Method Detail

resolveLocale

Locale resolveLocale(HttpServletRequest request)
Resolve the current locale via the given request. Should return a default locale as fallback in any case.

Parameters:
request - request to be used for resolution
Returns:
the current locale

setLocale

void setLocale(HttpServletRequest request,
               HttpServletResponse response,
               Locale locale)
Set the current locale to the given one.

Parameters:
request - request to be used for locale modification
response - response to be used for locale modification
locale - the new locale, or null to clear the locale
Throws:
UnsupportedOperationException - if the LocaleResolver implementation does not support dynamic changing of the theme


Copyright (c) 2002-2007 The Spring Framework Project.