Class RequestLocaleResolver

  • All Implemented Interfaces:
    io.micronaut.core.order.Ordered, io.micronaut.core.util.LocaleResolver<io.micronaut.http.HttpRequest<?>>, HttpLocaleResolver

    @Singleton
    @Requires(property="micronaut.server.locale-resolution.header",
              notEquals="false")
    public class RequestLocaleResolver
    extends HttpAbstractLocaleResolver
    A locale resolver which resolves the locale via HttpRequest.getLocale().
    Since:
    2.3.0
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.Integer ORDER  
      • Fields inherited from class io.micronaut.core.util.locale.AbstractLocaleResolver

        defaultLocale
      • Fields inherited from interface io.micronaut.core.order.Ordered

        HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getOrder()  
      java.util.Optional<java.util.Locale> resolve​(io.micronaut.http.HttpRequest<?> request)  
      • Methods inherited from class io.micronaut.core.util.locale.AbstractLocaleResolver

        resolveOrDefault
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface io.micronaut.core.util.LocaleResolver

        resolveOrDefault
    • Field Detail

      • ORDER

        public static final java.lang.Integer ORDER
    • Constructor Detail

      • RequestLocaleResolver

        public RequestLocaleResolver​(HttpLocaleResolutionConfiguration httpLocaleResolutionConfiguration)
        Parameters:
        httpLocaleResolutionConfiguration - Locale resolution configuration
    • Method Detail

      • resolve

        @NonNull
        public java.util.Optional<java.util.Locale> resolve​(@NonNull
                                                            io.micronaut.http.HttpRequest<?> request)