Answer the question
In order to leave comments, you need to log in
Tomcat java web application where to store application settings for a specific server?
Hello.
I am writing a *.war program. Accordingly, I develop and test on my working computer. There is a linux server for deployment. The app has settings. For example, there is an account under which my application goes through ntlm to a third-party service in windows. Here on an example of this parameter also wanted to formulate a question. Where is it better to "hide" it without "sewing" it into a war file? And so that other war applications cannot read it (for security reasons). I really like how "it" is done in IIS. There is a file "web.config" it is text and lies in the directory, I can fix it and restart the application in IIS and it will read the parameters from this file again. Other applications cannot read it. Can I do something similar under tomcat?
PS Do not offer home directories, because. it can be accessed by all applications running under tomcat.
Update:
2016-04-27 14:05:23
I found "this" standard method, laid down for this very purpose in tomcat itself. It is quite possible that other containers (glassfish / jetty, etc.) also provide this. The bottom line is to read additional application settings in a standard way:
This standard method is called context parameter . The essence of the work is as follows. You put the file in the tomcat/conf/Catalina/localhost/[webappname].xml directory with the following parameters:
Now, when tomcat sees this file in the conf/... directory, it reads the parameters from it, not from web.xml .
So it is much more convenient to store the settings of the application being developed separately, because The deployment of the application becomes completely independent in terms of parameters from the developer's computer. If, the developer parametrizes the application, of course.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question