users@jax-ws.java.net

FW: Getting Server Port in a jax-ws web service ?

From: Glenn <gpet44_at_excite.com>
Date: Wed, 14 Feb 2007 12:48:07 -0500 (EST)

 I'm trying to retrieve the server address (host &amp; port), and possibly the relative path (relative to server root) from within a jax-ws web service.I have a web service, which includes several images for retrieval based on metadata provided by the caller, below is a very simplified version of the code. I know I can use InetAddress to get the host name, but is there a way to retrieve the port number of the server that the web service is running in ?I'd prefer getting the information at run-time rather than playing with properties or application config files, that would have to be modified each time the war file is deployed.Any suggestions would be greatly appreciated._at_WebService()public class ImageRetriever {  @WebMethodpublic URL[] getImagery(@WebParam(name=&quot;metadata&quot;) Metadata metadata) {   URL[] urls = new URL[1];   String host = null;   int port = 80;   // TO-DO set host address to web server host   // TO-DO set port to webserver port   url[0] = new
URL(&quot;http&quot;, host, port, &quot;Imagery/image1.png&quot;);   return urls;   }}Thanks, Glenn

_______________________________________________
Join Excite! - http://www.excite.com
The most personalized portal on the Web!