org.springframework.context.i18n.SimpleLocaleContext Java Examples
The following examples show how to use
org.springframework.context.i18n.SimpleLocaleContext.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AcceptHeaderLocaleContextResolver.java From spring-analysis-note with MIT License | 5 votes |
@Override public LocaleContext resolveLocaleContext(ServerWebExchange exchange) { List<Locale> requestLocales = null; try { requestLocales = exchange.getRequest().getHeaders().getAcceptLanguageAsLocales(); } catch (IllegalArgumentException ex) { // Invalid Accept-Language header: treat as empty for matching purposes } return new SimpleLocaleContext(resolveSupportedLocale(requestLocales)); }
Example #2
Source File: AcceptHeaderLocaleContextResolver.java From java-technology-stack with MIT License | 5 votes |
@Override public LocaleContext resolveLocaleContext(ServerWebExchange exchange) { List<Locale> requestLocales = null; try { requestLocales = exchange.getRequest().getHeaders().getAcceptLanguageAsLocales(); } catch (IllegalArgumentException ex) { // Invalid Accept-Language header: treat as empty for matching purposes } return new SimpleLocaleContext(resolveSupportedLocale(requestLocales)); }
Example #3
Source File: CookieLocaleResolver.java From spring-analysis-note with MIT License | 4 votes |
@Override public void setLocale(HttpServletRequest request, @Nullable HttpServletResponse response, @Nullable Locale locale) { setLocaleContext(request, response, (locale != null ? new SimpleLocaleContext(locale) : null)); }
Example #4
Source File: AbstractLocaleContextResolver.java From spring-analysis-note with MIT License | 4 votes |
@Override public void setLocale(HttpServletRequest request, @Nullable HttpServletResponse response, @Nullable Locale locale) { setLocaleContext(request, response, (locale != null ? new SimpleLocaleContext(locale) : null)); }
Example #5
Source File: CookieLocaleResolver.java From java-technology-stack with MIT License | 4 votes |
@Override public void setLocale(HttpServletRequest request, @Nullable HttpServletResponse response, @Nullable Locale locale) { setLocaleContext(request, response, (locale != null ? new SimpleLocaleContext(locale) : null)); }
Example #6
Source File: AbstractLocaleContextResolver.java From java-technology-stack with MIT License | 4 votes |
@Override public void setLocale(HttpServletRequest request, @Nullable HttpServletResponse response, @Nullable Locale locale) { setLocaleContext(request, response, (locale != null ? new SimpleLocaleContext(locale) : null)); }
Example #7
Source File: CookieLocaleResolver.java From lams with GNU General Public License v2.0 | 4 votes |
@Override public void setLocale(HttpServletRequest request, HttpServletResponse response, Locale locale) { setLocaleContext(request, response, (locale != null ? new SimpleLocaleContext(locale) : null)); }
Example #8
Source File: AbstractLocaleContextResolver.java From lams with GNU General Public License v2.0 | 4 votes |
@Override public void setLocale(HttpServletRequest request, HttpServletResponse response, Locale locale) { setLocaleContext(request, response, (locale != null ? new SimpleLocaleContext(locale) : null)); }
Example #9
Source File: CookieLocaleResolver.java From spring4-understanding with Apache License 2.0 | 4 votes |
@Override public void setLocale(HttpServletRequest request, HttpServletResponse response, Locale locale) { setLocaleContext(request, response, (locale != null ? new SimpleLocaleContext(locale) : null)); }
Example #10
Source File: AbstractLocaleContextResolver.java From spring4-understanding with Apache License 2.0 | 4 votes |
@Override public void setLocale(HttpServletRequest request, HttpServletResponse response, Locale locale) { setLocaleContext(request, response, (locale != null ? new SimpleLocaleContext(locale) : null)); }
Example #11
Source File: DataprepLocaleContextResolver.java From data-prep with Apache License 2.0 | 4 votes |
@Override public LocaleContext resolveLocaleContext(HttpServletRequest request) { return new SimpleLocaleContext(getLocale(request)); }
Example #12
Source File: FrameworkServlet.java From spring-analysis-note with MIT License | 2 votes |
/** * Build a LocaleContext for the given request, exposing the request's * primary locale as current locale. * @param request current HTTP request * @return the corresponding LocaleContext, or {@code null} if none to bind * @see LocaleContextHolder#setLocaleContext */ @Nullable protected LocaleContext buildLocaleContext(HttpServletRequest request) { return new SimpleLocaleContext(request.getLocale()); }
Example #13
Source File: FrameworkServlet.java From java-technology-stack with MIT License | 2 votes |
/** * Build a LocaleContext for the given request, exposing the request's * primary locale as current locale. * @param request current HTTP request * @return the corresponding LocaleContext, or {@code null} if none to bind * @see LocaleContextHolder#setLocaleContext */ @Nullable protected LocaleContext buildLocaleContext(HttpServletRequest request) { return new SimpleLocaleContext(request.getLocale()); }
Example #14
Source File: FrameworkServlet.java From lams with GNU General Public License v2.0 | 2 votes |
/** * Build a LocaleContext for the given request, exposing the request's * primary locale as current locale. * @param request current HTTP request * @return the corresponding LocaleContext, or {@code null} if none to bind * @see LocaleContextHolder#setLocaleContext */ protected LocaleContext buildLocaleContext(HttpServletRequest request) { return new SimpleLocaleContext(request.getLocale()); }
Example #15
Source File: FrameworkPortlet.java From spring4-understanding with Apache License 2.0 | 2 votes |
/** * Build a LocaleContext for the given request, exposing the request's * primary locale as current locale. * @param request current HTTP request * @return the corresponding LocaleContext */ protected LocaleContext buildLocaleContext(PortletRequest request) { return new SimpleLocaleContext(request.getLocale()); }
Example #16
Source File: FrameworkServlet.java From spring4-understanding with Apache License 2.0 | 2 votes |
/** * Build a LocaleContext for the given request, exposing the request's * primary locale as current locale. * @param request current HTTP request * @return the corresponding LocaleContext, or {@code null} if none to bind * @see LocaleContextHolder#setLocaleContext */ protected LocaleContext buildLocaleContext(HttpServletRequest request) { return new SimpleLocaleContext(request.getLocale()); }