Class CurrentUriAdvice
java.lang.Object
springboot.bg.harisauto.common.config.i18n.CurrentUriAdvice
CurrentUriAdvice.java - Exposes the current request path to every view.
The language switcher needs to link back to the page the visitor is on, with only the
lang parameter changed. Thymeleaf 3.1 removed the #request object, so the
path has to come from the model instead.
- Author:
- Kristian Popov
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncurrentUri(jakarta.servlet.http.HttpServletRequest request) The path of the current request, for building same-page links.
-
Constructor Details
-
CurrentUriAdvice
public CurrentUriAdvice()
-
-
Method Details
-
currentUri
@ModelAttribute("currentUri") public String currentUri(jakarta.servlet.http.HttpServletRequest request) The path of the current request, for building same-page links.- Parameters:
request- The current request.- Returns:
- The request URI, or "/" when it cannot be determined.
-