Reputation: 342
I am deploying a war file to tomcat, however I am wanting to override my deployment descriptor web.xml, the purpose is to have a web app customized for different environments.
I use a jetty demo launcher rather than deploying to tomcat each time, I found out that jetty can do this which works:
Server server = new Server(9090);
WebAppContext context = new WebAppContext("src/main/webapp", "/");
List<String> overrideDescriptors = new ArrayList<String>();
overrideDescriptors.add("src/main/resources/jetty-override-web.xml");
context.setOverrideDescriptors(overrideDescriptors);
context.setClassLoader(Thread.currentThread().getContextClassLoader());
server.setHandler(context);
server.start();
server.join();
I'm no tomcat warrior or anything so please bear with me. My question is is there any config in tomcat I can use to achieve the same thing for when I deploy my war file?
Upvotes: 0
Views: 3476
Reputation: 1461
You can set default deploiment properties in conf/web.xml
in your Tomcat.
You can follow these informations for more details: http://tomcat.apache.org/tomcat-4.1-doc/config/context.html (chapter Automatic Context Configuration).
Upvotes: 1