Topic: 怎样可以令Java Applet有权存取档案?

  Print this page

1.怎样可以令Java Applet有权存取档案? Copy to clipboard
Posted by: manwk
Posted on: 2003-02-08 12:41

怎样可以令Java Applet有权存取档案?是不是用security policy?如果是请问怎样用?

2.Re:怎样可以令Java Applet有权存取档案? [Re: manwk] Copy to clipboard
Posted by: taogang
Posted on: 2003-02-12 17:37

Default Policy Files and Their Locations

There is by default a single system-wide policy file, and an optional user policy file.

The system policy file is by default located at

java.home\lib\security\java.policy

Here, java.home is the runtime environment's directory (the jre directory in the SDK or the top-level directory of the Java 2 Runtime Environment).

The user policy file is by default located at

user.home\.java.policy

Here, user.home indicates the user's home directory.

When the Policy is initialized, the system policy is loaded in first, and then the user policy is added to it. If neither policy is present, a built-in policy is used. This built-in policy is the same as the original sandbox policy.

Policy file locations are specified in the security properties file, which is located at

java.home\lib\security\java.security

The policy file locations are specified as the values of properties whose names are of the form
policy.url.n

Here, n indicates a number. You specify each such property value in a line of the following form:
policy.url.n=URL

Here, URL is a URL specification. For example, the default policy files, sometimes referred to as the "system" and "user" policy files, respectively, are defined in the security properties file as
policy.url.1=file:${java.home}/lib/security/java.policy
policy.url.2=file:${user.home}/.java.policy

Note: when a string like

${some.property}

appears in a policy file, or in the security properties file, it will be expanded to the value of the specified system property. For example,
${java.home}

indicates the value of the java.home property specifying the runtime environment's directory (the jre directory in the SDK or the top-level directory of the Java 2 Runtime Environment).
Whether or not property expansion is allowed is controlled by the value of the "policy.expandProperties" property in the security properties file. If the value of this property is true (the default), expansion is allowed.

You can actually specify a number of URLs in the security properties file (including ones of the form "http://"), and all the designated policy files will get loaded. You can also comment out or change the second one to disable reading the default user policy file.

The algorithm starts at policy.url.1, and keeps incrementing until it does not find a URL. Thus if you have policy.url.1 and policy.url.3, policy.url.3 will never be read.

It is also possible to specify an additional or a different policy file when invoking execution of an application. This can be done via the "-Djava.security.policy" command-line argument, which sets the value of the java.security.policy property. For example, if you type the following, where pURL is a URL indicating the location of a policy file, then the specified policy file will be loaded in addition to all the policy files that are specified in the security properties file.

java -Djava.security.manager -Djava.security.policy=pURL SomeApp

(The "-Djava.security.manager" argument ensures that the default security manager is installed, and thus the application is subject to policy checks. It is not required if the application SomeApp installs a security manager.)
If you instead type the following, using a double equals, then just the specified policy file will be used; all others will be ignored.

java -Djava.security.manager -Djava.security.policy==pURL SomeApp

If you want to pass a policy file to the appletviewer, again use a "-Djava.security.policy" argument as follows:

appletviewer -J-Djava.security.policy=pURL myApplet

Please note: The "-Djava.security.policy" policy file value will be ignored (for both java and appletviewer commands) if the "policy.allowSystemProperty" property in the security properties file is set to false. The default is true.

3.read more info at : [Re: manwk] Copy to clipboard
Posted by: taogang
Posted on: 2003-02-12 17:39

read more info at :

http://java.sun.com/products/jdk/1.2/docs/tooldocs/win32/policytool.html#DefaultFiles

4.Re:怎样可以令Java Applet有权存取档案? [Re: manwk] Copy to clipboard
Posted by: linux_china
Posted on: 2003-02-13 20:51

please use jarsigner

5.Re:怎样可以令Java Applet有权存取档案? [Re: manwk] Copy to clipboard
Posted by: R7733251
Posted on: 2003-02-15 10:59

SmileSadBig SmileCoolBlushTongueEvilWinkClownBlack EyeShyShockAngryDeadSleepyKissesApprovedDisapprovedQuestionSmileBig SmileOh My GodTounge Wink Sad Confused What are you talking about? Cry Embaressed Cool Angry Angel Give me a hug My heart Broken heart... Present Rose Wilted Rose Camera Film Phone Kitty bowwow Coffee Light Bulb MoonSleepy Start Musical Note Envelope Cake Clock Thumbs up Thumbs down Beer Food Kiss Fight Music Stupid Devil


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923