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 & HelpPrograms › Reading data from URL: problem in applet
Page Index Toggle Pages: 1
Reading data from URL: problem in applet (Read 1237 times)
Reading data from URL: problem in applet
May 25th, 2006, 5:00pm
 
Hi all

I have the following problem: I am using processing to visualize data from the web, using a standard java URL reader to get the data.

When I export this as an application, everything works fine. When I export it as an applet, however, I don't seem to get any data from the web.

For example, I can run Daniel Shiffmans Google News reader (http://itp.nyu.edu/~dts204/a2z/thread/) without problem as an application, but when I export it as an applet, all I get is a gray, empty canvas.

I first though that there was an issue with my networks settings, but since I can view Daniels' applet on his website without any problems, this seems not to be the case. I tried to put the exported applet on my own webserver (http://www.aharef.info/static/applet/), but again, no luck.

Has anyone ever encountered such a problem? Any help / hint would be  greatly appreciated!

Best regards
Sala
Re: Reading data from URL: problem in applet
Reply #1 - May 25th, 2006, 7:08pm
 
sala,

this is a known problem with applets. by default they are only allowed to read data from the server they are coming from. see the exception that your applet raises:

java.security.AccessControlException: access denied (java.net.SocketPermission itp.nyu.edu resolve)

so .. to get this working you should either sign your applet, or even better use php to fetch the data from the other server like:

applet -> php -> other server -> php -> applet

i don't have an example at hand, but since this is something people run into quite often i'm sure you will find one by searching the forum ( try "PHP" ) ...

best,
F
Re: Reading data from URL: problem in applet
Reply #2 - May 25th, 2006, 8:54pm
 
Fijen,

Thanks for your response. I'll check that.

Anyways, I'm still curious why it works on Shiffman's site. I dont assume he uses a certifcate.
Re: Reading data from URL: problem in applet
Reply #3 - May 25th, 2006, 9:24pm
 
no. the problem is that the applet is not allowed to read from any other servers than it came from. so your applet can read from your server / domain ... shiffman reads from his server, so that's ok. but your applet can't read from his.

F
Re: Reading data from URL: problem in applet
Reply #4 - May 26th, 2006, 2:05pm
 
fjen,

thanks again. I have now managed the php part, works fine. However, now I am having another difficulty. Two, to be precise:

It works fine on firefox, but nothing on safari

Even stranger, if I check it online at another computer, it gives me some java errors of classes missing. I thought they are all in the jar that the export function creates?

Puh, I am having a hard time figuring this out.

I wrote this app to create networks of any HTML DOM (see http://www.aharef.info/2006/05/websites_as_graphs.htm for screenshots), it works fine in processing, but I just dont get it running on a webserver Sad
Re: Reading data from URL: problem in applet
Reply #5 - May 26th, 2006, 2:31pm
 
Sounds to me like a Java version problem.  Which classes are missing?  If the Java plugin version is 1.1, for example, you'll get class not found errors for all Collections other than Vector (ArrayList, HashMap, etc.).
Re: Reading data from URL: problem in applet
Reply #6 - May 26th, 2006, 2:43pm
 
org.w3c.dom.Node is missing
Re: Reading data from URL: problem in applet
Reply #7 - May 28th, 2006, 6:57pm
 
Ok, I just wanted to say I got it up and running: http://www.aharef.info/static/htmlgraph/
Re: Reading data from URL: problem in applet
Reply #8 - May 28th, 2006, 8:14pm
 
Heres my derived 'web browser' version:
http://mkv25.net/applets/mkv_htmlgraph/getDataFromURL.php?url=http://www.aharef.info
Page Index Toggle Pages: 1