Get App name or url in AuthenticationEventListener

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 :frowning: .
Any help would be great.

Roland

Try use Environment bean for read application properties.

@Autowired
private Environment environment;

...
String appPrefix = environment.getProperty("server.servlet.context-path");

Hi,
I also tried environment,
but only get NULL using getProperty(“server.servlet.context-path”)
Regards
Roland

found a way:

@Autowired
private ServletContext context;
context.getContextPath()

that works

1 Like

server.servlet.context-path is used only when the application is deployed as an executable JAR, i.e. contains an embedded app server.

ah, ok
and we deploy a war file to Tomcat,
thx