This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Distributed Java and the fly likes Slashes in the policy file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "Slashes in the policy file" Watch "Slashes in the policy file" New topic
Author

Slashes in the policy file

David Duran
Ranch Hand

Joined: Feb 11, 2002
Posts: 122
Does anyone know how to specify an os-independent slash in an RMI policy file?

Is there a way to specify something like file.separator within the policy file?
Junaid Bhatra
Ranch Hand

Joined: Jun 27, 2000
Posts: 213
You can do that using ${/} in the policy file.
For eg:
permission java.io.FilePermission "${/}mydir${/}-", "read,write,delete,execute";
In the codebase specifier however, it should always be a / since it is a URL, (even though you may point it to a local file).
For eg:
grant codeBase "file:/c:/myhome/-" {
permission java.io.FilePermission "${/}mydir${/}-", "read,write,delete,execute";
};
You can even utilize system properties. For eg:
grant codeBase "file:/${user.home}/-" {
permission java.io.FilePermission "${user.home}${/}-", "read,write,delete,execute";
};
[ May 14, 2002: Message edited by: Junaid Bhatra ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Slashes in the policy file
 
Similar Threads
Problems with security policies for Axis2 in Tomcat
different operating systems
Running JForum with Security Policy
Deleteing a file
Tomcat Java2 Security Issue: modifyThread and modifyThreadGroup