Class HttpLocalizedMessageSource
java.lang.Object
io.micronaut.context.AbstractLocalizedMessageSource<HttpRequest<?>>
io.micronaut.http.server.util.locale.HttpLocalizedMessageSource
- All Implemented Interfaces:
LocalizedMessageSource
,RequestAware
@RequestScope
public class HttpLocalizedMessageSource
extends AbstractLocalizedMessageSource<HttpRequest<?>>
implements RequestAware
A
RequestScope
which uses the current HttpRequest
to resolve the locale and hence return the localized messages.- Since:
- 3.4.0
- Author:
- Sergio del Amo
-
Constructor Summary
ConstructorDescriptionHttpLocalizedMessageSource
(LocaleResolver<HttpRequest<?>> localeResolver, MessageSource messageSource) -
Method Summary
Modifier and TypeMethodDescriptionvoid
setRequest
(HttpRequest<?> request) Provides the request directly after bean creation.Methods inherited from class io.micronaut.context.AbstractLocalizedMessageSource
getMessage, getMessage, getMessage, resolveLocale
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.micronaut.context.LocalizedMessageSource
getMessageOrDefault, getMessageOrDefault, getMessageOrDefault
-
Constructor Details
-
HttpLocalizedMessageSource
public HttpLocalizedMessageSource(LocaleResolver<HttpRequest<?>> localeResolver, MessageSource messageSource) - Parameters:
localeResolver
- The locale resolvermessageSource
- The message source
-
-
Method Details
-
getLocale
- Specified by:
getLocale
in classAbstractLocalizedMessageSource<HttpRequest<?>>
- Returns:
- The resolved locale;
-
setRequest
Description copied from interface:RequestAware
Provides the request directly after bean creation.- Specified by:
setRequest
in interfaceRequestAware
- Parameters:
request
- The current request
-