Solved

Servlet IP Address and Port

Posted on 2001-06-26
2
811 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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

760 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now