?
Solved

Servlet IP Address and Port

Posted on 2001-06-26
2
Medium Priority
?
821 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 3

Accepted Solution

by:
rkenworthy earned 200 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

Interactive Way of Training for the AWS CSA Exam

An interactive way of learning that will help you visualize core concepts so that you can be more effective when taking your AWS certification exam.  Built for students by a student to help them understand the concepts that they are being taught.

Question has a verified solution.

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

I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Suggested Courses
Course of the Month7 days, 21 hours left to enroll

765 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