0

Possible Duplicate:
Java and crossdomain.xml

I need an unsigned (I don't want prompt for visitors asking to run the applet) Java applet that scrape source code from another domain. I have made an applet using prowser library, when I execute it on eclipse (as applet) or as runnable jar it works but it don't work when I execute the applet on my website. It returns me "null".

My applet code :

import java.applet.Applet;   

public class HelloWorldApplet extends Applet {

public void init() {

    Prowser prowser = new Prowser();
    Tab tab = prowser.createTab();
    System.out.println(tab.go("http://www.canyouseeme.org").getPageSource());    

   }

} 

Previously I have had an issue with the import of the library: Export Applet Java with referenced libraries

Thanks in advance for your help.

Community
  • 1
  • 1
user895063
  • 23
  • 1
  • 3

1 Answers1

1

Put the code that scrapes the other site on your server (i.e., in a servlet), then have the applet talk to the servlet via HTTP (REST, web services, whatever.)

Ernest Friedman-Hill
  • 80,601
  • 10
  • 150
  • 186
  • but the scrape will be client-side or server-side ? because the scrape must be client-side. – user895063 Aug 16 '11 at 07:40
  • i see that my thread was closed with this link http://stackoverflow.com/questions/1908083/java-and-crossdomain-xml but i don't understand the crossdomain.xml must be placed on the server ? and is it allow to create a socket connection with urlconnection function in java ? because i have tested it but the java console return me a denied access for socket permission ? Really thanks for your help – user895063 Aug 16 '11 at 07:44
  • I have read doc for crossdomain.xml but i cant upload it to the website that i want scrape. I have tested my applet and it works for a website on the same domain but not for cross domain. – user895063 Aug 16 '11 at 08:53