private static void checkConnect(URL url) { SecurityManager security = System.getSecurityManager(); if (security != null) { try { j86.java.security.Permission perm = url.openConnection().getPermission(); if (perm != null) security.checkPermission(perm); else security.checkConnect(url.getHost(), url.getPort()); } catch (j86.java.io.IOException ioe) { security.checkConnect(url.getHost(), url.getPort()); } } }
/** Return an enumeration of all the accessible applets on this page. */ public Enumeration getApplets() { AppletSecurity security = (AppletSecurity) System.getSecurityManager(); Vector v = new Vector(); SocketPermission panelSp = new SocketPermission(panel.getCodeBase().getHost(), "connect"); for (Enumeration e = appletPanels.elements(); e.hasMoreElements(); ) { AppletPanel p = (AppletPanel) e.nextElement(); if (p.getDocumentBase().equals(panel.getDocumentBase())) { SocketPermission sp = new SocketPermission(p.getCodeBase().getHost(), "connect"); if (panelSp.implies(sp)) { v.addElement(p.applet); } } } return v.elements(); }
/** Get an applet by name. */ public Applet getApplet(String name) { AppletSecurity security = (AppletSecurity) System.getSecurityManager(); name = name.toLowerCase(); SocketPermission panelSp = new SocketPermission(panel.getCodeBase().getHost(), "connect"); for (Enumeration e = appletPanels.elements(); e.hasMoreElements(); ) { AppletPanel p = (AppletPanel) e.nextElement(); String param = p.getParameter("name"); if (param != null) { param = param.toLowerCase(); } if (name.equals(param) && p.getDocumentBase().equals(panel.getDocumentBase())) { SocketPermission sp = new SocketPermission(p.getCodeBase().getHost(), "connect"); if (panelSp.implies(sp)) { return p.applet; } } } return null; }