06.01.2013 Views

Learning Processing: A Beginner's Guide to Programming Images ...

Learning Processing: A Beginner's Guide to Programming Images ...

Learning Processing: A Beginner's Guide to Programming Images ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

However, if you request a URL on a diff erent domain, you are out of luck.<br />

// Will not work in the browser<br />

String[] lines = loadStrings( " http://www.yourkookoodomain.com " );<br />

Data Input 355<br />

A solution for this problem is <strong>to</strong> create a proxy script that lives on the server with your applet, connects <strong>to</strong><br />

an external URL and passes that information back <strong>to</strong> the applet—in essence, you are tricking your applet<br />

in<strong>to</strong> thinking it is retrieving only local information.<br />

Another solution is <strong>to</strong> “ sign ” your applet. Signing an applet is the process of saying “ Hello, my name is<br />

Daniel Shiff man and I made this applet. If you trust me say ‘ yes ’ <strong>to</strong> let this applet access resources it might<br />

not normally be allowed <strong>to</strong> access. ”<br />

Again, if you are just developing sketches locally on your computer in the <strong>Processing</strong> development<br />

environment you will not have an issue. If you need <strong>to</strong> get your applet working on a web server<br />

and need <strong>to</strong> make requests <strong>to</strong> pages not on that server, please visit this book’s web site<br />

( http://www.learningprocessing.com/sandbox/ ) for an example PHP proxy script as well as tips on how<br />

<strong>to</strong> sign your applets.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!