|
|
|
|||
|
Grant the Required PermissionTo grant theWriteFile applet permission to
create and to write to the writetest file,
you must create a policy entry granting this permission.
To do so, choose
the Add Policy Entry button
in the main Policy Tool window.
This brings up the Policy Entry dialog box,
as shown in the following figure.
![]() This figure has been reduced to fit on the page. Click the image to view it at its natural size. A policy entry specifies one or more permissions for code from a particular code source - code from a particular location (URL), code signed by a particular entity, or both. The CodeBase and the SignedBy text boxes are used to specify which code you want to grant the permission(s) you will be adding.
If you have both a CodeBase and a SignedBy entry, the permission(s) will be granted only to code that is both from the specified location and signed by the named alias. To grant Type the following URL into the CodeBase text box of the Policy Entry dialog box: (Note, this is a URL and thus must always have slashes, not backslashes.)http://java.sun.com/docs/books/tutorial/security1.2/tour1/example-1dot2/ Leave the SignedBy text box blank, since you aren't requiring the code to be signed.
http://java.sun.com/docs/books/tutorial/security1.2/- You've specified where the code comes from (the CodeBase), and that the code does not have to be signed (since there's no SignedBy value). Now you are ready to grant permissions to that code. Choose the Add Permission button to bring up the Permissions dialog box. ![]() This figure has been reduced to fit on the page. Click the image to view it at its natural size. writetest.
![]() This figure has been reduced to fit on the page. Click the image to view it at its natural size. Choose the OK button. The new permission appears in a line in the Policy Entry dialog. So now the policy entry window looks like this. ![]() This figure has been reduced to fit on the page. Click the image to view it at its natural size. You are now done specifying this policy entry, so choose the Done button in the Policy Entry dialog. The Policy Tool window now contains a line representing the policy entry, showing the CodeBase value. ![]() This figure has been reduced to fit on the page. Click the image to view it at its natural size. | |||
|