tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Beikov <christian.bei...@gmail.com>
Subject Fwd: Re: Policy files
Date Wed, 24 Apr 2013 17:45:16 GMT
Accidently mailed on tomee-list before ><

Thanks for the quick answer but it seems I didn't explain my situation 
completely.
We use Maven for all assignments, I can control what base project they 
have to use for a specific assignment. Also in my testsuite I 
automatically build these projects and deploy the artifacts to my 
embedded tomcat.

The problem is when it comes to the policy files. Where do I need to add 
the path to the policy file for the base maven projects of the students? 
Is there any option in context.xml or so that I can use?

The second problem is that I want to configure the policy for each 
student project when deploying on embedded tomcat(since the students 
could change the file in their projects). Where do I have to configure 
the policy when instantiating the StandardContext myself? I saw that the 
Loader of the context is of the type WebappLoader and the ClassLoader is 
a WebappClassLoader. I also found a method addPermission in 
WebappClassLoader, but I don't want to parse the policy file myself and 
add the permissions one by one. Isn't there an attribute to set the 
policy for that class loader?

So to summarize it a bit, I want to know what to configure in e.g. 
context.xml(if that is the place where to configure the policy) to have 
a specific policy applied.

Mit freundlichen Grüßen,
------------------------------------------------------------------------
*Christian Beikov*
Am 24.04.2013 12:48, schrieb Martin Gainty:
> Sooner or later your students will need to stop playing with IDEs and 
> get serious about creating a real war
>
> Maven provides maven-war-plugin for creating deployable web archives
>
> as far as applying differing policies (or configurations) you can use
> archetypes for initial creation of the war
> http://www.sonatype.com/books/mvnex-book/reference/web-sect-creating-project.html
>
> properties for deployment configuration changes can be manipulated by 
> passing attributes to MANIFEST.MF
>
> bash>mvn Dmaven.war.containerConfigXML=MYContextXML.xml
> org.apache.maven.plugins:maven-war-plugin:2.3:manifest
>
> http://maven.apache.org/plugins/maven-war-plugin/manifest-mojo.html#containerConfigXML
>
> bash>mvn org.apache.maven.plugins:maven-war-plugin:2.3:war
>
> the first command copies to META-INF your customised MYContextXML.xml 
> (context)
> the second command builds out the war in \target folder
>
> http://maven.apache.org/plugins/maven-war-plugin/war-mojo.html
>
> *Viel Gluck*
> Martin
>
> ______________________________________________
> Thank the general and tell him I have no desire to drink with him or 
> any other Russian *** ** * *****
> General George Patton
>
>
>
> > Date: Wed, 24 Apr 2013 08:29:27 +0200
> > From: christian.beikov@gmail.com
> > To: users@tomcat.apache.org
> > Subject: Policy files
> >
> > Hello there!
> >
> > I am using tomcat as an embedded container for a while now, it is 
> really
> > amazing, but now I got stuck on a topic.
> > I am implementing a testsuite for automatic testing of uploaded
> > solutions by students. The deployment works like a charm, I also found
> > your StuckThreadDetectionValve very useful to kill threads of the
> > students applications.
> > The next assignment will involve some areas where I would like to
> > specify a policy file so that the students can't do anything they 
> aren't
> > supposed to. Now to my problem.
> >
> > One thing is that I want a policy file to be in the students projects,
> > so that they actually get the exceptions when they are doing something
> > wrong. What do I have to configure in these student web projects so 
> that
> > they can e.g. deploy the project directly from netbeans to tomcat and
> > have the policy applied?
> >
> > The other thing is that I want the policy file to be in my testsuite
> > project and configure it on demand when deploying the student 
> solutions.
> > Currently I create an instance of StandardContext for each student web
> > application, then I configure the context and finally add it to the 
> host
> > of the server. What do I need to configure, to apply the policy in this
> > case?
> >
> > I hope someone can help me with that, thanks in advance!
> > --
> >
> > Mit freundlichen Grüßen,
> > ------------------------------------------------------------------------
> > *Christian Beikov*




Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message