'Unrestricted' option of the AppletViewer.

A

Andrew Thompson

What is the purpose of the 'Unrestricted' option of the AppletViewer?

Try this..
1) Save the SSCCE to a convenient location (including the first
comment
line that defines an applet element for it)
2)
prompt>javac TestSecurityDemo.java
3)
prompt>appletviewer TestSecurityDemo.java
(Yes, that '.java' is intentional)

Now, click the 'Browse to File' button to see an
AccessControlException
This is logical enough, the applet is sandboxed, and browsing the
user's file system is forbidden.

Now, in AppletViewer access the 'Applet' menu, 'Properties...'
menu item, to see a dialog containing two text fields and a combo
for 'Class access:' with options 'Unrestricted' and 'Restricted'.

That implies to me, that we can select between the two, to set the
security level/privileges of the applet. Yet if you select
'Unrestricted' and try the applet again, you'll get another ACE.

It is the same effect with a self-signed applet
prompt>appletviewer http://pscode.org/test/docload/applet.html


Has anybody ever seen this combo have any effect on an applet?
Is this functionality broken? If it is, could it be considered
a bug - it is not as if I can even find documentation on the
appletviewer*?

* Yes, I can find..
<http://java.sun.com/javase/6/docs/technotes/tools/windows/
appletviewer.html>
...but it has no mention of 'Unr' or 'Class acc'.


<SSCCE>
// <applet code='TestSecurityDemo' width='300' height='100'></applet>
import java.awt.event.*;
import javax.swing.*;

public class TestSecurityDemo extends JApplet {

public void init() {
JButton openFile = new JButton("Browse to File");
openFile.addActionListener( new ActionListener(){
public void actionPerformed(ActionEvent ae) {
JFileChooser fileChooser = new JFileChooser();
fileChooser.showOpenDialog(TestSecurityDemo.this);
}
} );
getContentPane().add(openFile);
validate();
}
}
</SSCCE>
 
J

John B. Matthews

[...]
prompt>appletviewer TestSecurityDemo.java
(Yes, that '.java' is intentional)

That's handy! appletviewer uses the <applet> tag in the source.

[...]
It is the same effect with a self-signed applet
prompt>appletviewer http://pscode.org/test/docload/applet.html

I get the results you describe.
Has anybody ever seen this combo have any effect on an applet?
Is this functionality broken? If it is, could it be considered
a bug - it is not as if I can even find documentation on the
appletviewer?

I get ACE either way, although I notice that the combo box state is
preserved across invocations of appletviewer. I'm not sure where.

[...]
 
A

Andrew Thompson

[...]
prompt>appletviewer TestSecurityDemo.java
(Yes, that '.java' is intentional)

That's handy! appletviewer uses the <applet> tag in the source.

Yep. I only found that out a couple of weeks ago,
when somebody mentioned it on the Sun forums. Sure
makes applet testing simpler (especially for 'toss
away' examples and SSCCEs).

Thanks for your 'null' reports. ( And you'd think if
they were going to bother to persist the decision, it
would have made a lot of sense to implement it first. ;)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top