Witam, mam taki oto kod
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
import java.net.*;
import java.io.*;
import java.applet.*;
/**
*
* @author matx132
*/
public class PuzzleAplet extends Applet {
/**
* Initialization method that will be called after the applet is loaded
* into the browser.
*/
public void init() {
try {
URL y;
InputStream is = null;
DataInputStream dis;
String s;
y = new URL(getParameter("link"));
is = y.openStream();
dis = new DataInputStream(new BufferedInputStream(is));
String text = "";
while ((s = dis.readUTF()) != null) {
text+=s;
}
try {
getAppletContext().showDocument(new URL("javascript:doAlert(\"" + text + "\")"));
} catch (MalformedURLException me) {
}
}
catch (IOException ex) {
}
}
}
po wejściu na stronę www w console java jest takie coś:
java.security.AccessControlException: access denied (java.net.SocketPermission www.google.pl:80 connect,resolve)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkConnect(Unknown Source)
at sun.plugin2.applet.Applet2SecurityManager.checkConnect(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.<init>(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at java.net.URL.openStream(Unknown Source)
at PuzzleAplet.init(PuzzleAplet.java:34)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Exception: java.security.AccessControlException: access denied (java.net.SocketPermission www.google.pl:80 connect,resolve)
Piszę aplikacje która będzie pobierać kod źródłowy danej strony (muszę zrobić to w java).
Prosiłbym o pomoc z tym bo nie wiem dlaczego tak jest :/