setNonXml problem

Hi
I’ve got a problem with the setNonXML(java.lang.String url,java.lang.String inputFile) from the HTTP Client API for Java.
The most important part of the code is below (less important with …):

import java.applet.Applet;
import java.awt.;
import java.awt.event.MouseListener;
import java.awt.event.MouseEvent;
import java.io.
;
import com.softwareag.tamino.API.dom.;
import com.docuverse.dom.
;
import org.w3c.dom.*;

public class CreaUfficio extends Applet
implements MouseListener {

TaminoNonXml taminononxml=new TaminoNonXml(“http://localhost/tamino/DatiIdrologici/Collection_Fiumi”);
taminononxml.startSession();
String uurl=“http://localhost/tamino/DatiIdrologici/Collection_Fiumi/Immagine/po.gif”;
taminononxml.setNonXML(uurl,“h:\po.gif”);
taminononxml.commit(false);
taminononxml.endSession();

}

and the error at runtime:

Exception occurred during event dispatching:
java.security.AccessControlException: access denied (java.io.FilePermission h:\p
o.gif read)
at java.security.AccessControlContext.checkPermission(AccessControlConte
xt.java:272)
at java.security.AccessController.checkPermission(AccessController.java:
399)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:545)
at java.lang.SecurityManager.checkRead(SecurityManager.java:890)
at java.io.FileInputStream.(FileInputStream.java:61)
at com.softwareag.tamino.API.dom.TaminoNonXml.setNonXML(Unknown Source)
at com.softwareag.tamino.API.dom.TaminoNonXml.setNonXML(Unknown Source)
at CreaUfficio.action(CreaUfficio.java:112)
at java.awt.Component.handleEvent(Component.java:3906)
at java.awt.Component.postEvent(Component.java:2790)
at java.awt.Component.postEvent(Component.java:2800)
at java.awt.Component.dispatchEventImpl(Component.java:2607)
at java.awt.Component.dispatchEvent(Component.java:2499)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:319)
at java.awt.EventDispatchThread.pumpOneEvent(EventDispatchThread.java:10
3)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:84)

Some observations:
The file “po.gif” has no particoular permission
The problem persists with all files (different names, different types)
The servlet version (exactly the same in the “taminononxml part”) compiles and runs ok!!!

I think could be a JAVA coding error done by me, 'cause the error come out from the line:
taminononxml.setNonXML(uurl,“h:\po.gif”);
should I set someting for file interaction in applet version? I really don’t know how to solve.

thanks in advance.

Applets run in a java “sandbox” that isolates them from the local (client machine) file system to protect users from malicious applets. To overcome this you have to digitally sign your Applet, or find a way to access your data without using the client machine’s local file system.

Signing an Applet is a tricky business. You can get a feel for the issues at these links:

Making code trusted in Internet Explorer

Signing applets for the Sun Java Plug-In

Overcoming permission errors in a signed Java Applet

Servlets run server-side and can access the server’s local file system.

HTH

[This message was edited by Bill Leeney on 20 Nov 2002 at 10:08.]

Thanks for the answer.