Thursday, February 4, 2016

Using Application Server>URL resources to manage J2EE property files and external service url

Use following code to retrieve url resource using jndi
InitialContext initCtx = new InitialContext();
URL url = (java.net.URL) initCtx.lookup(jndi);
URLConnection conn = url.openConnection();
InputStream is = conn.getInputStream();

With this method you can either enter web service url in resource field or properties file path.

Note: You need to restart the server to lookup the url resource from code.

Reference link: http://www.ibm.com/developerworks/websphere/library/techarticles/0502_botzum/0502_botzum.html

No comments:

Post a Comment