• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to get the browser url  RSS feed

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


how to get browser url in java code

ex:

http://serverip:port/contents
 
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since it is in browser, wouldn't you want to use javascript?

In JavaScript:
location.href will give you this.


 
Ranch Hand
Posts: 174
Java Java ME Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Rancher
Posts: 42975
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The javax.servlet.http.HttpServletRequest interface has several methods you can use for the various parts of the URL, including getRequestURI, getQueryString, getScheme, getServerName and getServerPort.
 
Saloon Keeper
Posts: 19014
80
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Browsers don't have URLs. Servers do.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!