We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpIntegration › Access net behind proxy with username and password
Page Index Toggle Pages: 1
Access net behind proxy with username and password (Read 1863 times)
Access net behind proxy with username and password
May 24th, 2010, 10:25am
 
Hi,
Having a bit of a headache with this one. I'm trying to access some images online but the place I'm doing it from has a proxy with username and passwords. I found this forum topic-
http://processing.org/discourse/yabb2/num_1233748146.html
Which has been very useful. I thought it might be a simple case of adding http.proxyUser and http.proxyPassword as well as the other settings however it's still not working.

Here's my code if it helps:

Quote:
//Import properties to setup proxy settings for college
import java.util.Properties;

int num=0;
PImage img;


void setup(){
  size(600,600);

//Setting up proxy settings for college  
  Properties systemSettings = System.getProperties();

  systemSettings.put("http.proxyHost", "my.proxy.example.com");
  systemSettings.put("http.proxyPort", "80");
  systemSettings.put("http.proxyUser", "myusername");
  systemSettings.put("http.proxyPassword", "mypassword");
  System.setProperties(systemSettings); 
  
  img=loadImage("http://");
}

void draw(){

  image(img,0,0);
}



Any help would be greatly appreciated. I have an exhibition very soon and I'm now panicking.

Tim
Re: Access net behind proxy with username and password
Reply #1 - May 24th, 2010, 3:29pm
 
I found the Java Networking and Proxies article quite clear and relatively simple, maybe it can help you. Never tried it as I haven't had to go through a proxy yet.
Re: Access net behind proxy with username and password
Reply #2 - May 24th, 2010, 3:59pm
 
Yep I had a read of that but I still couldn't get it working after setting it up. I'm running on linux if that makes any difference.
I'm going to try running this bit of code once I get into Uni tomorrow http://www.java-tips.org/java.net/how-to-detect-proxy-settings-for-internet-conn.... I'll see if it is actually trying the connection.
Even if I do get this code running is the setting up the proxy applicable to the loadStrings(URL HERE) function Would this act through the proxy
Re: Access net behind proxy with username and password
Reply #3 - May 25th, 2010, 5:22am
 
I think so, as behind the scene, Processing creates regular InputStreams on its loadXxx() functions.
Page Index Toggle Pages: 1