cancel
Showing results for 
Search instead for 
Did you mean: 

Getting Web Script URL from java bean

lilyh
Champ in-the-making
Champ in-the-making
Hello,
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),
         get.setQueryString(kvps);
         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.
resizeimagewebscripturl=http://localhost:8080/alfresco/wcservice/au/com/seedim/imagemanagement/resize

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.
resizeimagewebscripturl=/alfresco/wcservice/au/com/seedim/imagemanagement/resize

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!
3 REPLIES 3

britto
Champ in-the-making
Champ in-the-making
hai  lilyh


    can u  explain your code briefly

especially     new NameValuePair("ref", sourcePath),
         get.setQueryString(kvps);
regards
britto

britto
Champ in-the-making
Champ in-the-making
hai lilyh

   found the solution

Thank you

Regards
britto

lilyh
Champ in-the-making
Champ in-the-making
Hi Britto,
I never found the solution.
Mind sharing your thoughts?
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.