summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas <>2022-03-01 13:21:58 +0100
committerThomas <>2022-03-01 13:21:58 +0100
commitdfb23f9c5ab93fce1aa7bbb12c076d34e27ca949 (patch)
tree8681edd4c8eb6ff66386142b5f96efd8e70bc8a3
parentbff64fe44f23518e22a370e0bd06c8b08445092e (diff)
downloadEAAF-Components-dfb23f9c5ab93fce1aa7bbb12c076d34e27ca949.tar.gz
EAAF-Components-dfb23f9c5ab93fce1aa7bbb12c076d34e27ca949.tar.bz2
EAAF-Components-dfb23f9c5ab93fce1aa7bbb12c076d34e27ca949.zip
refactor(ux): provide method to extract Locale from HTTP request by using Spring locale-resolver
-rw-r--r--eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/gui/utils/MvcGuiRenderUtils.java17
1 files changed, 12 insertions, 5 deletions
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/gui/utils/MvcGuiRenderUtils.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/gui/utils/MvcGuiRenderUtils.java
index 5a3f14cb..b212f140 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/gui/utils/MvcGuiRenderUtils.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/gui/utils/MvcGuiRenderUtils.java
@@ -92,6 +92,18 @@ public class MvcGuiRenderUtils {
}
/**
+ * Get i18n information from HTTP request.
+ *
+ * @param localeResolver Resolver for localization
+ * @param request HTTP request
+ * @return Current locale
+ */
+ public static Locale getLocaleByRequest(LocaleResolver localeResolver, @NonNull HttpServletRequest request) {
+ return localeResolver != null ? localeResolver.resolveLocale(request) : request.getLocale();
+
+ }
+
+ /**
* Render a GUI by using Spring based ModelAndView (MVC) components.
*
* @param mv GUI model
@@ -144,11 +156,6 @@ public class MvcGuiRenderUtils {
}
- private static Locale getLocaleByRequest(LocaleResolver localeResolver, @NonNull HttpServletRequest request) {
- return localeResolver != null ? localeResolver.resolveLocale(request) : request.getLocale();
-
- }
-
private static View buildViewFromModel(ViewResolver[] viewResolvers, Locale locale,
@NonNull ModelAndView mv) throws Exception {