Page 1 of 1
About Question enthuware.jwpv6.2.1069 :
Posted: Sun May 22, 2016 10:24 pm
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.
Re: About Question enthuware.jwpv6.2.1069 :
Posted: Sun May 22, 2016 10:48 pm
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.
Re: About Question enthuware.jwpv6.2.1069 :
Posted: Mon May 23, 2016 9:54 am
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.
Re: About Question enthuware.jwpv6.2.1069 :
Posted: Mon May 23, 2016 11:51 am
by admin
No, the problem statement says that the request is coming FROM someserver.com.