yegor256
yegor256

Reputation: 105043

How to get URL of a running app inside ServletContextListener?

I'm inside ServletContextListener, and need to get a URL of the application in full format, including protocol, server, port, and path. How can I do this?

Upvotes: 1

Views: 1002

Answers (1)

user207421
user207421

Reputation: 310860

You can't because it isn't unique. The container could have any number of aliases; it could be listening to any number of ports; and it could be listening on any specific port either HTTP or HTTPS.

Upvotes: 1

Related Questions