Skip to Content
0
Former Member
Feb 17, 2006 at 06:38 PM

Best Practice for managing variables for multiple environments

18 Views

I am very new to Java WebDynPro and have a question

concerning our deployments to Sandbox, Development, QA,

and Production environments.

What is the 'best practice' that people use so that if

you have information specific to each environment you

don't hard-code it in your Java WebDynPro code.

I could put the value in a properties file, but how do I

make that variant? Otherwise I'd still have to make a

change for each environment to the property file and

re-deploy. I know there are some configurations on the

Portal but am not sure if that will work in my instance.

For example, I have a URL that varies based on my

environment. I don't want to hard-code and re-compile

for each environment. I'd prefer to get that

information on the fly by knowing which environment I'm

running in and load the appropriate URL.

So far the only thing I've found that is close to

telling me where I'm running is by using a Parameter Map

but the 'key' in the map is the URL not the value and I

suspect there's a cleaner way to get something like that.

I used Eclipse's autosense in Netweaver to discover some

of the things available in my web context.

Here's the code I used to get that map:

TaskBinder.getCurrentTask().getWebContextAdapter().getRequestParameterMap();

In the forum is an example that gets the IP address of

the site you're serving from. It sounds like it is going

to be or has been deprecated (it worked on my system

right now) and I would really rather have something like

the DNS name, not something like an IP that could change.

Here's that code:

String remoteHost = TaskBinder.getCurrentTask().getWebContextAdapter().getHttpServletRequest().getRemoteHost();

Thanks in advance for any clues you can throw my way -

Greg