Article View: es.comp.lenguajes.java
Article #27447Re: Ejecutar un applet
From: x
Date: Wed, 09 Sep 1998 00:00
Date: Wed, 09 Sep 1998 00:00
130 lines
4740 bytes
4740 bytes
Hola,
en el Netscape Communicator se puede hacer que se habiliten cualquier
restriccion de seguridad, para ello se han de incluir las peticiones
adecuadas en el codigo:
netscape.security.PrivilegeManager.enablePrivilege("UniversalFileWrite");
Para compilarlo se ha de poner en el CLASSPATH el archivo java40.jar del
Netscape,
y tener firmado el Applet o en su defecto añadir en el archivo prefs.js
la linea
user_pref("signed.applets.codebase_principal_support", true);
Al ejecutar el Applet aparecera una ventana de Netscape solicitando el
privilegio pedido al usuario.
*****************
Para mas informacion mirar en http:\\developer.netscape.com
*****************
Texto en Ingles que explica lo mismo pero mas detallado:
These are the things we noticed in Netscape 4.03 and IE4.0.
Netscape4.03:
If you load applets through the webserevr, there is apparently no change
between the Netscape3.0 and netscape4.0. They work the same way. i.e,
the
applet can connect to only the webserver host and not any other host.
Hence
there is no change required in the applets when netscape4.03 is used.
But if the applets are loaded from classpath, then we have to add some
netscape specific code in every thread we create (if that thread is
going
to do some "security risk" operation) in the applet. Since Advent Snmp
itself creates a session thread internally, this netscape specific code
has
to be incorporated in that thread. Only then the Snmp Socket connections
would work.
I am describing below what code is to be added.
1. In the prefs.js file in Netscape/users/xxx directory add the
following:
user_pref("signed.applets.codebase_principal_support", true);
And add the following as the first lines of every thread in your applet.
netscape.security.PrivilegeManager.enablePrivilege("UniversalListen");
netscape.security.PrivilegeManager.enablePrivilege("UniversalConnect");
netscape.security.PrivilegeManager.enablePrivilege("UniversalMulticast");
netscape.security.PrivilegeManager.enablePrivilege("UniversalFileRead");
You have to set your classpath to
netscape/communicator/program/java/classes, to compile your applet after
adding the above.
When you load this applet with communicator 4.0 it will then prompt you
for
various permissions. If you grant them then it will work.
If you want more details you can look at
http://developer.netscape.com/library/documentation/signedobj/capabilties/in
dex.html.
Ofcoure we will have to provide a patch so that Advent Stack will work
with
Netscape4.0. We will post a patch soon and let everybody know.
One thing to be aware of is that, once we add this netscape specific
code,
it fails to work with netscape3.0 (inspite of checking
if(System.getProperty("browser","").equals(Netscape Communicator). But
it
works with applet viewer and IE.
What ever I have described above is based on something called codebase
principals. For using signed JAR files we are still working on it.
IE4.0.
As far as I have noticed, there is no change required to the applets to
run
it in IE4.0 either from classpath or through webserver. We have provided
a
work around for the port 0 problem in our latest release. But Microfoft
has
posted a patch which fixes this problem anyway. The patch can be
downloaded
from
http://www.microsoft.com/java/vm/debugdownload.htm
Felix Yague wrote:
>
> En principio y solo cambiando las opciones de seguridad del navegador, no se
> puede hacer (o por lo menos no he encontrado el bug que lo consiga).
>
> Si estas muy interesado, se pueden hacer cosas:
> Cambiar clases de java (en la maquina cliente), que sean las encargadas
> de hacer las cosas 'inseguras'.
> Que tu applet llame a clases hechas por ti pero que esten en el
> ordenador cliente.
>
> Lei algo sobre crear un entorno seguro dentro de la maquina virtual java
> que si se podria escribir en el disco cliente, y se configuraria en el
> navegador, pero las pocas pruebas que hice no me direron resultado.
Technical Details
Message-ID:
<35F6D603.ECF094C@mat.upc.es>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<6sdmmj$4ge$1@talia.mad.ibernet.es> <35EEE70D.7CF4C725@jet.es> <6t0img$oar$1@diana.bcn.ibernet.es>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: 1116f3,a21759077c9271f6 X-Google-Attributes: gid1116f3,public From: x <jmoya@mat.upc.es> Subject: Re: Ejecutar un applet Date: 1998/09/09 Message-ID: <35F6D603.ECF094C@mat.upc.es> X-Deja-AN: 389473152 Content-Transfer-Encoding: quoted-printable References: <6sdmmj$4ge$1@talia.mad.ibernet.es> <35EEE70D.7CF4C725@jet.es> <6t0img$oar$1@diana.bcn.ibernet.es> To: Felix Yague <Visual@jpcnet.com> Content-Type: text/plain; charset=iso-8859-1 Organization: Universitat Politecnica de Catalunya Mime-Version: 1.0 Newsgroups: es.comp.lenguajes.java