Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to retrieve entered web address in browser from java code.

 
Safi Khan
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear All,

I wants to know how i can retrieve the entered web address in browser from my java code ?, Is there any specific API or how i can monitor http trrafic? so that from there i can get every entered url in browser.

Any help will be appreciated.

Thanks,
 
Joe Ess
Bartender
Posts: 9320
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you working with a bare socket, an applet or a servlet? The applet class has methods to get the URL it is loaded from. Servlets have a request object that has methods to obtain the request path.
 
Safi Khan
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you working with a bare socket, an applet or a servlet? The applet class has methods to get the URL it is loaded from. Servlets have a request object that has methods to obtain the request path.
Joe Ess


I am working with a bare socket, actually i have a simple program which runs as a service in the background , i wants that program to get the every url that user enters in his/her browser.

Can you help?

Thanks,
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Safi Khan wrote:I am working with a bare socket, actually i have a simple program which runs as a service in the background , i wants that program to get the every url that user enters in his/her browser.


It sounds like you're trying to write a proxy server. Or at least, let me put it this way, if you did write a proxy server then it would naturally get every URL that the user entered in the browser. Provided that you configured the user's browser to connect via your proxy application.

In fact it would get every URL which the browser tried to connect to, regardless of whether the user entered it in the address bar or not.

But I think it would be helpful if you backed up a few steps and explained the background of this question. Right now it's unclear why you want to get URLs entered into the browser, and what your service has to do with that requirement.

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

Thanks for the reply (Paul Clapham)

Here is the clarification,

I am not writing a proxy server, Actually i have a java program/service which has a list of predefined url's, now i wants my program to stop the user access to these url's from browser. So for this i need the entered url in browser so that i can compare and do my actions.

I am thinking about, how i can hava a socket which should start listening data from the browser socket so that when browser sends the http request, i should also get that object, Is it possible or any other idea.

Thanks,

 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, that's why you would use a proxy server. The proxy server inspects all requests from the browser and either passes them on to the web, or rejects them by sending a response itself. I'm posting this from my browser through a proxy server which does exactly that -- it doesn't block the Ranch, but it does block e.g. Facebook.
 
Don Ho
Greenhorn
Posts: 9
Android
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Another alternative would be to filter via DNS lookup, e.g. set custom entrys in the local hosts file or point your system to a custom DNS server.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic