r.walde
(r.walde@podconsult.de Walde)
August 31, 2022, 4:04pm
1
Hi,
I need the complete URL or the App name inside an AuthenticationEventListener.
We need to use different apps on the same DB and need to log the user login and which app was used.
Cannot find the information in the doc or forum .
Any help would be great.
Roland
andrey_vb
(Andrey Balabanov)
September 1, 2022, 2:59am
2
Try use Environment bean for read application properties.
@Autowired
private Environment environment;
...
String appPrefix = environment.getProperty("server.servlet.context-path");
…
r.walde
(r.walde@podconsult.de Walde)
September 1, 2022, 1:52pm
3
Hi,
I also tried environment,
but only get NULL using getProperty(“server.servlet.context-path”)
Regards
Roland
r.walde
(r.walde@podconsult.de Walde)
September 1, 2022, 2:32pm
4
found a way:
@Autowired
private ServletContext context;
context.getContextPath()
that works
1 Like
krivopustov
(Konstantin Krivopustov)
September 2, 2022, 7:16am
5
server.servlet.context-path is used only when the application is deployed as an executable JAR, i.e. contains an embedded app server.
r.walde
(r.walde@podconsult.de Walde)
September 2, 2022, 8:45am
6
ah, ok
and we deploy a war file to Tomcat,
thx