wood burning stoves 2.0*
The moose likes Servlets and the fly likes Constants.java class vs context param Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Constants.java class vs context param" Watch "Constants.java class vs context param" New topic
Author

Constants.java class vs context param

Pongsakorn Semsuwan
Ranch Hand

Joined: May 15, 2011
Posts: 34

Hi,

I'm just wondering whether to keep some of my variables in Constants class or keep it in web.xml

Say, I want to keep a variable of facebook graph api prefix or api_key, client_id

From my understand, the difference between Constants.java and web.xml is web.xml is easier to rewrite on compile using ant.
So you can replace your variables in web.xml according to what environment you are building you app for. (client_id varies by dev environment/prod environment, for example)

If I get it right, then facebook graph api prefix should be kept in Constants.java (because it always is "https://graph.facebook.com/" ) and api_key,client_id should be kept in web.xml ?


Please guide me what's the proper way to use them. Thank you.


A web application developer wannabe from Thailand
My StartUp : http://www.dreamlog.co
Blog : http://pongsakornsemsuwan.wordpress.com
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Constants.java class vs context param
 
Similar Threads
A 404 Error, need help configuring web.xml
Facebook integration with android app
Servlet running on Local host but throwing Exception on public server
Facebook Share Icon not visible for posts made through Graph API
Mock exam question