Ricardo Marimon
Ricardo Marimon

Reputation: 10687

How to incorporate an xml fragment into tomcat's server.xml

I'm doing a distribution of tomcat for a many servers and in each of these servers the realm is going to be different. I would like to have a file /etc/tomcat/realm.xml containing the realm for that installation and have the file /var/lib/tomcat/conf/server.xml import it directly. I've tried with Xinclude without luck and I'm about to resort to sed to the import when running /etc/init.d/tomcat. Is there a better way to do this?

Upvotes: 0

Views: 1455

Answers (1)

Daniel Haley
Daniel Haley

Reputation: 52888

I'm not familiar with tomcat, but will it recognize/handle a system entity?

I'm not sure what the root element of /var/lib/tomcat/conf/server.xml is, so I'll just use server in my example:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE server [
<!ENTITY realm SYSTEM "/etc/tomcat/realm.xml">
]>
<server>
&realm;
</server>

Would something like that work?

Upvotes: 1

Related Questions