Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Best ways of handling proxy details for url.openConnection

  Asked By: Qadriyah    Date: Sep 08    Category: Java    Views: 1331
  

Code below will work provided it can connect to given urlString even through browser.


URL url = new URL(urlString);
URLConnection conn = url.openConnection();
OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
wr.write(data);
wr.flush();

All most all offices / companies have proxy servers and they want to route the trafic through these proxy servers. My question is How such situations should be handled?

Couple of thoughts -
1) We can set proxy details as a part of JVM
2) We can retrive it from browser at runtime.

Is there any better / recommended way?
Also on production region, what will be the browser proxy settings? Will it be disabled?

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Hayden Evans     Answered On: Sep 08

I suggest Apache HttpCleint -which handels lots of details  like this- instead of it.
jakarta.apache.org/.../features.html

 
Didn't find what you were looking for? Find more on Best ways of handling proxy details for url.openConnection Or get search suggestion and latest updates.




Tagged: