title: Tomcat: Change the Virtual hosts programmatically?
body: <p>Tomcat offers a build in "Virtual Hosting" Support: An Engine/Web-Application can be configured to be responsible for a list of Domains. These Domains have to be put into the server.xml/context.xml files with a special xml directive.</p>
  
  <p>=> Is there any possibility to change the Tomcat Configuration (in general) and especially the "Virtual Hosts" of a Web-Application/Engine programmatically? </p>
  
  <p>For example if a new user signs up, I have to add his domain to the list of "accepted virtual hosts/domains". The only way I currently think of is changing the xml files via a script and then restart Tomcat.</p>
  
  <p>Is there any way to add them add runtime via some Java-Methods programmatically?</p>
  
  <p>Thank you very much!
  Jan</p>