Solved

Application settings per server for tomcat

Posted on 2009-05-10
4
363 Views
Last Modified: 2013-12-02
I have two boxes. One for test, one for production.

On test, I may want the following settings:
email=test@test.com
smtp_server=test.int.com
image_uri=/myimgsrvr/testimgages/

On production, I may want the following instead:
email=admin@mycomp.com
smtp_server=mysmtp.mycomp.com
image_uri=/myimgsrvr/prodimages

There are many ways of accomplishing this:
I have used a singleton class with property files.
I have used context.xml and read environment elements.
IF setting is used in servlet, sometimes have used web.xml,

What are the best patterns, system for solving such a problem? Pros/cons?

Note, this is basic web app. No spring,struts,tiles, etc...
0
Comment
Question by:Paullkha
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 24348165
It's just a question of deploying different config files, so it's nothing more or less than a 'macro issue'
0
 
LVL 92

Expert Comment

by:objects
ID: 24350348
handle it in your context.xml, that way your web apps do not need to differ making deployment simpler
0
 
LVL 2

Author Comment

by:Paullkha
ID: 24359765
Since the context.xml config will not change, are there any examples of a wrapper for getting a context?

Should I load all context.xml environment elements into a static variables in a singleton class?

So I could do the following:

MyConfig.SMTP_SERVER
MyConfig.FILE_URI

0
 
LVL 92

Accepted Solution

by:
objects earned 125 total points
ID: 24360308
you would create a separate context.xml for testing and production

0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Verbose logging is used to diagnose garbage collector problems. By default, -verbose:gc output is written to either native_stderr.log or native_stdout.log.   It is also possible to redirect the logs to a user-specified file. This article will de…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question