[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Alternative to getServerName() through Servlets

Posted on 2004-09-22
7
Medium Priority
?
226 Views
Last Modified: 2013-11-24
Hi,

I am using request.getServerName(), to get the server name through servlets. (where request is the request object). Please let me know how can I get the servername instead of using this request object.

Waiting for reply.

Regards,
R S
0
Comment
Question by:rajneetbhatia
[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
  • 2
7 Comments
 
LVL 35

Accepted Solution

by:
girionis earned 100 total points
ID: 12122079
The request object encapsulates the http request into a nice wrapper. Have a look at the source code and see how they do it.
0
 

Author Comment

by:rajneetbhatia
ID: 12122379
Actually i want to get the complete path.
Say I am calling my page as :
http://server1111:8080/ABC/index.html

Presently I am using getServerName method of request object to get
server name as "server".
port as "8080"
Path as "ABC"

Now instead of using this request object I want to get the servername using some other way, how can I do that.

Waiting for reply.
0
 
LVL 92

Expert Comment

by:objects
ID: 12128826
> Actually i want to get the complete path

you can use:

String uri = request.getRequestURI();
0
 

Author Comment

by:rajneetbhatia
ID: 12130407
I don't want to use request here.. I want an alternative to this.
0
 
LVL 92

Assisted Solution

by:objects
objects earned 100 total points
ID: 12130430
There is no alternative, the server name is part of the request.
How could you get it from anything other than the request.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses

649 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