Solved

Application settings per server for tomcat

Posted on 2009-05-10
4
356 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
  • 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
factorial example challenge 10 62
changePi Challenge 15 76
array6 challenfge 6 63
nestparen challenge 4 56
I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
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…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

758 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now