Solved

Application settings per server for tomcat

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
servlet  URL Rewriting 1 42
how to add new optional parameter to JSP 1 49
Glassfish admin console not working 1 34
American Express @Work site and Java 4 30
Configure Web Service (server application) I. Configure security for Web Services methods First, we need to protect Session bean which implements the service: 1. Open EJB deployment descriptor (ejb-jar.xml) in the EJB project that contains you…
This article is about some of the basic and important steps to be used to improve the performance in web-sphere commerce application development. 1) Always leverage the Dyna-caching facility provided by the product 2) Remove the unwanted code …
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 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.

830 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