Re: Contradiciting advice in the Java Tutorial.

Marianne Mueller (Marianne.Mueller@Eng)
Wed, 10 Jun 1998 17:00:14 -0700 (PDT)

Date: Wed, 10 Jun 1998 17:00:14 -0700 (PDT)
From: Marianne Mueller <Marianne.Mueller@Eng>
Subject: Re: Contradiciting advice in the Java Tutorial.
To: java-security@web1.javasoft.com, david.berglund@ac.com

--2550_rue_garcia_avenue+MV_620_000
Content-Type: TEXT/plain; charset=us-ascii
Content-MD5: xu+7/xguTJalh/F+J96ReA==

>
> I have been looking for help in your java tutorial and other documents. I
> am trying to create a tool
> to run in a browser environment with but without a server connection. I
> want to be able to run an applet
> (loaded from the client) over several browser pages which can read and
> write to a file on the client.
> The exerpt, below, from your java tutorial indicates that this should be
> posssible.

No, the excerpt says that if you install the applet on the local computer
(where the browser is running) on a directory on the CLASSPATH used by
that browser, then, the applet is treated as if it were part of the trusted
local Java system, and it isn't subjected to the usual security
restrictions.

By default, all downloaded applets are restricted and can't read and write
files. See http://java.sun.com/sfaq and http://java.sun.com/security

> 2. I can't find any further references how to keep an applet running after
> leaving the page. Is there some documentation
> about this?

Part of the defined applet behavior is that it calls its "stop" method
when you leave the page. Try running the attached applet and look at
the messages it prints out when you leave a page or close the browser.

If you leave a page, the applet's stop method is called. When you go back
to the page, the applet's start method is called.

--2550_rue_garcia_avenue+MV_620_000
Content-Type: TEXT/plain; name="HelloUsenix.java"; charset=us-ascii; x-unix-mode=0644
Content-Description: HelloUsenix.java
Content-MD5: XVDFVd/b/ymijMyL/KhaWw==

// Usefull beginner template, to help you see which methods
// are called when, during the applet lifecycle

import java.applet.*;
import java.awt.*; // update(), paint(), handleEvent(), Graphics

public class HelloUsenix extends Applet {
public void update(Graphics g) {
System.out.println("update()");
super.update(g);
}
public void paint(Graphics g) {
g.setColor(Color.blue);
System.out.println("paint()");
g.drawString("Hello World", 20, 20);
}
public void init() {
System.out.println("init()");
}
public void start() {
System.out.println("start()");
}
public void stop() {
System.out.println("stop()");
}
public void destroy() {
System.out.println("destroy()");
}
public boolean handleEvent(Event evt) {
System.out.println("Event: " + evt);
return super.handleEvent(evt);
}
}

--2550_rue_garcia_avenue+MV_620_000
Content-Type: TEXT/html; name="HelloUsenix.html"; charset=us-ascii; x-unix-mode=0644
Content-Description: HelloUsenix.html
Content-MD5: 8iGxXtXocJk0kompCJDcMQ==

<title>Hello Usenix</title>
<h1>Hello Usenix!</h1>
<applet code=HelloUsenix.class width=100 height=100>
</applet>

--2550_rue_garcia_avenue+MV_620_000--