Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to get Tomcat Port in servlet's init method

 
Deepak KumarMishra
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friends,
I need to get the tomcat's port number in a servlet's init method.

I understand that I can use HttpeServletRequest.getServerPort() to get the port, but for this, I need to have the request; but I need the Port number in servlet's init method.

Can you please suggest a way to find that out?

Thank you,
Deepak
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hope This Helps
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic