views:

14

answers:

2

greetings all i want to detect dynamically if the application is under local environment (development) or online server environment, through the httpservletRequest maybe , i don't know, any ideas ?

A: 

You could try using getRequestURL() on your HttpServletRequest object to retrieve the URL that is being requested. Then search that string for "localhost" or your development IP address.

Drackir
A: 

I always do it in the configuration file, and manage the development and production configuration files as two separate entities (i.e. in separate places within version control)

Kendrick