Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] how to dynamically config jetty policy files?

I mean, one app can read and write it's own directory .
When I add a new app, I want to add it's own directory and own policy in policy files.

for example:
I have 2 app,and two directory,like 
/webapps/app1.war
/webapps/app2.war
/read_write/app1/
/read_write/app2/

app1.war can only read and write /read_write/app1/ and app2.war can only read and write /read_write/app2/
I use policy file to realize this principle.
app1.policy file:
grant codeBase "file:/tmp/jetty-0.0.0.0-10000-app1.war-_app1-any-/-" {
   permission java.io.FilePermission "/read_write/app1/-", "read, write";
};

app2.policy file:
grant codeBase "file:/tmp/jetty-0.0.0.0-10000-app2.war-_app2-any-/-" {
   permission java.io.FilePermission "/read_write/app2/-", "read, write";
};

but when I add app3.war , I should add an app3.policy file like this:
app3.policy file:
grant codeBase "file:/tmp/jetty-0.0.0.0-10000-app3.war-_app3-any-/-" {
   permission java.io.FilePermission "/read_write/app3/-", "read, write";
};

How can I dynamically realize this? Should I modify jetty's source code?

BTW, what's the difference between java.io.tmpdir and jetty's work directory?

Thank you very much.


On Wed, Sep 7, 2011 at 10:09 PM, Jesse McConnell <jesse@xxxxxxxxxxx> wrote:
that would be my best guess as a solution...

if its not what you need could you explain in a bit more detail?

cheers,
jesse

--
jesse mcconnell
jesse@xxxxxxxxxxx

http://webtide.com / http://intalio.com
(the folks behind jetty and cometd)



On Wed, Sep 7, 2011 at 04:07, John English <john.foreign@xxxxxxxxx> wrote:
> On 06/09/2011 05:58, zhiwei chen wrote:
>>
>> hi,all.
>>
>> I have run many app under jetty, and I want to give one app a specified
>> read_write dir.
>> like this:
>>
>> /webapps/app1.war  read_write_dir is   /dir/app1/
>> /webapps/app2.war  read_write_dir is   /dir/app2/
>> /webapps/app3.war  read_write_dir is   /dir/app3/
>> .......
>>
>> How to dynamically specified app's read_write_dir when app are comming?
>
> Not sure if I understand the question, but could you use context params
> in the web.xml of each app to specify the directory path?
>
> ------------------------------------------------------------------------
>  John English | My old University of Brighton home page is still here:
>              | http://www.cem.brighton.ac.uk/staff/je/
> ------------------------------------------------------------------------
> _______________________________________________
> jetty-users mailing list
> jetty-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/jetty-users
>
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users


Back to the top