Bonsoir à tous,

je suis en train de débuter sur un projet pour mon site web, c'est la génération de présentation d'uplaod en applet java au lieu d'un site en PHP.

Je rencontre un "leger" soucis de droits .. D'après ce que j'ai vu, c'est car mon applet n'est pas signer, car j'essaye de récupéré le code HTML d'une page de recherche allociné.

Voici les erreurs :

Exception in thread "AWT-EventQueue-7" java.security.AccessControlException: access denied (java.net.SocketPermission www.allocine.fr: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.http://www.protocol.http.HttpURLConn...Client(Unknown Source)
at sun.net.http://www.protocol.http.HttpURLConn...onnect(Unknown Source)
at sun.net.http://www.protocol.http.HttpURLConn...onnect(Unknown Source)
at sun.net.http://www.protocol.http.HttpURLConn...Stream(Unknown Source)
at java.net.URL.openStream(Unknown Source)
at FirstApplet.urlExists(FirstApplet.java:162)
at FirstApplet.getCode(FirstApplet.java:176)
at FirstApplet.getListFilm(FirstApplet.java:46)
at FirstApplet$1.actionPerformed(FirstApplet.java:244)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

J'ai essayé de signé mon applet, le soucis c'est que c'est pas un jar mais un .class qui utilise un autre .class et deux .jar.
Et la, j'ai pas trouvé comment signer mon .class ....


Pour info, j'utilise ca pour récupérer le code HTML, au cas il cela ne viens pas de l'applet unsigne :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
public static boolean urlExists(String url)
	   {
	        try {
	            URL site = new URL(url);
	            try {
	                site.openStream();
	                return true;
	            } catch (IOException ex) {
	                return false;
	            }
	        } catch (MalformedURLException ex) {
	            return false;
	        }
	   }
 
	public static String getCode(String url)
	   {
	       String code = "";
 
	        if(urlExists(url))
	        {
	                BufferedReader in = null;
 
	                try
	                {
	                    URL site = new URL(url);
	                    in = new BufferedReader(new InputStreamReader(site.openStream()));
 
	                    String inputLine;
	                    while ((inputLine = in.readLine()) != null)
	                    {
	                        code = code + "\n" + (inputLine);
	                    }
 
	                    in.close();
 
	                }
	                catch (IOException ex)
	                {
	                    System.out.println("Erreur dans l'ouverture de l'URL : " + ex);
	                }
	                finally
	                {
	                    try
	                    {
	                        in.close();
	                    }
	                    catch (IOException ex)
	                    {
	                        System.out.println("Erreur dans la fermeture du buffer : " + ex);
	                    }
	                }
	        }
	        else
	        {
	           System.out.println("Le site n'existe pas !");
	        }
	       return code;
	    }

Auriez vous une petite idée ?

Amicalement