AnsweredAssumed Answered

Getting Web Script URL from java bean

Question asked by lilyh on Feb 9, 2010
Latest reply on Feb 15, 2010 by lilyh
I have a java bean that calls a web script to create different sized renditions of an image.
// Get WebScript Service Endpoint
      String wsUrl = this.getResizeimagewebscripturl();
      if (wsUrl != null && wsUrl.length() != 0)
         // Prepare HTTP Connection
         HttpClient client = new HttpClient();
         GetMethod get = new GetMethod(wsUrl);

         // Add request headers
         get.addRequestHeader( "Cache-control", "no-cache" );

         // Make sure ticket is the first parameter
         NameValuePair[] kvps =
               new NameValuePair[]{new NameValuePair("ticket", ticket),
               new NameValuePair("ref", sourcePath),
         try {
            // execute the GET
         } catch( Throwable err ) {
            // throw exception
         } finally {
            // release any connection resources used by the method

my wsUrl is retreived from a custom-config properties file.

The above code works but I want to change the resizeimagewebscripturl property to just the context path and not have the host and port hard coded.

and from within my java bean I want to dynamically retrieve the host and port. That way I'd only need the context path of my web script from the properties file.

Does anyone have any suggestions? I have tried everything I could think of but with no success.
Any pointers would be greatly appreciated.
Thank you!