restrictedinfinity
restrictedinfinity

Reputation: 435

Tomcat importing web.xml files

I have multiple projects which are to be hosted together in a Tomcat container, as they communicate and share resources. Each project is developed separately and has it own web.xml

Is there a way i can import individual project Web Application Deployment Descriptor (project-web.xml), into one web.xml and deploy.

Upvotes: 0

Views: 1165

Answers (1)

chkal
chkal

Reputation: 5668

If you are using Tomcat 7.0.x, you could try to create a common JAR file with all the shared classes and add a META-INF/web-fragment.xml to the archive. This is file is similar to the web.xml file and you could use it to add common filter, servlet, etc...

<?xml version="1.0" encoding="UTF-8"?>
<web-fragment xmlns="http://java.sun.com/xml/ns/javaee" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-fragment_3_0.xsd"
    version="3.0">

  <!-- content like web.xml -->

</web-fragment>

Upvotes: 1

Related Questions