About Question enthuware.jwpv6.2.1069 :

Moderator: admin

Post Reply
himaiMinh
Posts: 358
Joined: Fri Nov 29, 2013 8:26 pm
Contact:

About Question enthuware.jwpv6.2.1069 :

Post by himaiMinh »

for someserver.com, should it be request.getServerName() ?


It seems to me that :
1. the client is running at 10.10.2.23 using port number 2260.
2 .the client sends the request to the servlet at someserver.com and the receiving port is 8080.

admin
Site Admin
Posts: 10053
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.jwpv6.2.1069 :

Post by admin »

No, as per http://docs.oracle.com/javaee/6/api/jav ... ServerName():
getServerName returns the host name of the server to which the request was sent. It is the value of the part before ":" in the Host header value, if any, or the resolved server name, or the server IP address.
If you like our products and services, please help us by posting your review here.

himaiMinh
Posts: 358
Joined: Fri Nov 29, 2013 8:26 pm
Contact:

Re: About Question enthuware.jwpv6.2.1069 :

Post by himaiMinh »

I assume the url in the question is :
http://www.someserver.com:8080/MyContext/index.jsp.
The client is at 10.10.2.23:2262?

So, to return http://www.someserver, it should be getServerName ?

It is just like http://localhost:8080/MyContext/index.jsp.
And the localhost is to where the request is sent.

admin
Site Admin
Posts: 10053
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.jwpv6.2.1069 :

Post by admin »

No, the problem statement says that the request is coming FROM someserver.com.
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: No registered users and 24 guests