In the current system set up I have several configuration files stored in the conf/Catalina/localhost directory. For example images.xml:
<Context path="/images" docBase="/home/user/images" debug="0" privileged="true" />
This allows to link to files inside this directory, for example: http://localhost:8080/images/image.jpg
But when the mapped drive is on a network location it happens that the connection to the drive is lost. Because Tomcat is then unable to reach the destination the configuration is automatically undeployed. Because of the real web application running on this server I don't want to change this Tomcat settings.
So the question is, can I include this configuration in a WAR file? This would make it easier to redeploy and probably allow me to bundle configurations?
The specific configuration tells tomcat to load the web app from a specified directory (outside of tomcat's default). This is tomcat specific configuration so even if it was possible to bundle this config in war (which i don't think you can) I'd recommend not to go that path.
The better way would be bundle to your images as a exploded war file (so that you can add remove images while tomcat is running)and deploy it in the tomcat. As i understand you want to keep you images in separate network drive whose connectivity is intermittent. In that case it makes sense for tomcat to undeploy the context when the resource is not available.