views:

4

answers:

0

I want to know the difference between the below two methods of getting a request URL in Servlet.

method 1:

String url = request.getRequestURL().toString();

method2:

url = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getRequestURI();

are there any chances that , the above two methods will give two different URLs..?