• Post Reply Bookmark Topic Watch Topic
  • New Topic

specify http proxy host, http proxy port for an URL connection

 
ying lam
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Can you please tell me how can I specify http proxy host, http proxy port
when I create a HTTP connection? (just a particular http connection not for the whole jvm).

I have looked at the javadoc for the URL class , i don't see it has method to specify http proxy host/port for a particular url connection.

http://java.sun.com/j2se/1.4.2/docs/api/java/net/URL.html

Thank you for any pointers.
 
Joe Ess
Bartender
Posts: 9361
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JDK Release Notes: Java Networking And Proxies
 
ying lam
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks but doing that will configure the http proxy for my whole program:

http://java.sun.com/j2se/1.5.0/docs/guide/net/proxies.html

That is not what I want. I want it to go thru a http proxy sometimes only (doing it dynamically in my program).
 
Joe Ess
Bartender
Posts: 9361
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Scroll down to Item 3, where it describes the Proxy class:
That's why it was decided to introduce a new, more flexible, API in J2SE 5.0 so that it would be possible to have connection based proxy settings.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!