Reputation: 3744
I have Java Web app.
I need get its URL where it is running (e.g. http://myserver:8080/mycontext
).
I need it because I want to be able construct URL on some resource, that has been created.
e.g. By soap request was created resource /myresource
and I need insert into soap response reference on this resource (http://myserver:8080/mycontext/myresource
)
And I need to be able return URL on resource even when message come from JMS.
ServletContextListener
.Upvotes: 1
Views: 1489
Reputation: 62603
You can get all those from the HttpServletRequest
object, if you can get a hold of it.
Upvotes: 1