Reputation: 3689
How do I retrieve the port number in the init method.
In a doGet
or doPost
I can use:
request.getLocalPort();
but in the init()
method there is no request object.
I don't want to configure it, I want the port dynamically.
Upvotes: 1
Views: 623
Reputation: 310860
You can't. There is no such thing as 'the' port. The container could be listening on any number of ports and any number of IP addresses.
Upvotes: 2