Permissions for a web app to delete in specific directory

I am not having any luck setting permissions for a web app to delete files in a specific directory.

This works (this is in Sun Java Studio Creator which test deploys to the build directory):

grant codeBase

"file:/D:/CreatorProjects/JasperReports/build/web/-"{

...

permission java.io.FilePermission"<<ALL FILES>>","delete";

}

This does not work. That is, I get (java.io.FilePermission D:\CreatorProjects\JasperReports\build\web\resources\templates\MyReportByPerson _1159988360809_824120.java delete)

grant codeBase

"file:/D:/CreatorProjects/JasperReports/build/web/-"{

...

permission java.io.FilePermission"D:/CreatorProjects/JasperReports/build/web/resources/templates/-","delete";

}

This does not work either (same error):

grant codeBase

"file:/D:/CreatorProjects/JasperReports/build/web/-"{

...

permission java.io.FilePermission"file:/D:/CreatorProjects/JasperReports/build/web/resources/templates/-","delete";

}

Does anyone know what the correct syntax is? I don't think it is a good idea to enable delete permissions for all files (or maybe I am wrong?). I have googled and googled and can't find the answer.

[1644 byte] By [jetsons] at [2007-11-14]
# 1

When working with policy, I like to open everything to test it. If it works, then I start to put some limit to them.

For you, I suggest to open everything [1], then if it works, limit only the codeBase [2]

Try to put the specific FilePermission (yours), before the default FilePermission, originally bundled with SJSAS.

1)

grant {

permission java.security.AllPermission;

};

2) The codeBase, accepts a URI. Put 3 slash at the protocol name

grant codeBase "file:///D:/CreatorProjects/JasperReports/build/web/-" {

permission java.security.AllPermission;

};

Claudio4J at 2007-7-7 > top of java,Application & Integration Servers,Application Servers...
# 2

Claudio

Thanks for your reply. However, as stated in my original post, I am able to set delete permissions for all files. However, I want to limit the delete permission to a specific location.

As this is code that is in a tutorial, I do not want to provide code for our customers that makes them open up wide permissions.

jetsons at 2007-7-7 > top of java,Application & Integration Servers,Application Servers...