How to detect dynamically if the app is under local/online environment
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 ?
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)
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.
精彩评论