Solved

Servlet IP Address and Port

Posted on 2001-06-26
2
817 Views
Last Modified: 2013-11-24
Hi,

I have a servlet running on a host at a specific port number. In the servlet, I have to generate an xml file, where I need to put the URL of the server for DOCTYPE declaration(DTD). So I would like to get the server ip address and port number. How do I get it inside the servlet?

Thanks,
Prasanna
0
Comment
Question by:Prasanna_Hebbar
2 Comments
 
LVL 3

Accepted Solution

by:
rkenworthy earned 50 total points
ID: 6232139
In the ServletRequest object, check out the methods getServerName() and getServerPort().

ServletRequest is the super class of HttpServletRequest which is passed into the get or post methods.

Hope that helps.
Rob
0
 
LVL 2

Author Comment

by:Prasanna_Hebbar
ID: 6232551
Thanks Rob.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question