protected String initializeURI(URL url, String servicePrefix) {
        if ( url == null ) {
            throw new IllegalArgumentException( "The url may not be empty or null." );
        }
        try {
            url.toURI();
        } catch ( URISyntaxException urise ) {
            throw new IllegalArgumentException(
                    "URL (" + url.toExternalForm() + ") is incorrectly formatted: " + urise.getMessage(), urise );
        }

        String urlString = url.toExternalForm();
        if ( !urlString.endsWith( "/" ) ) {
            urlString += "/";
        }
        urlString += "services/"+servicePrefix + "/server";

        URL serverPlusServicePrefixUrl;
        try {
            serverPlusServicePrefixUrl = new URL( urlString );
        } catch ( MalformedURLException murle ) {
            throw new IllegalArgumentException(
                    "URL (" + url.toExternalForm() + ") is incorrectly formatted: " + murle.getMessage(), murle );
        }

        return urlString;
    }
protected String initializeURI ( URL url , String servicePrefix ) { if ( url == null ) { throw new IllegalArgumentException ( "The url may not be empty or null." ) ; } try { url . toURI ( ) ; } catch ( URISyntaxException urise ) { throw new IllegalArgumentException ( "URL (" + url . toExternalForm ( ) + ") is incorrectly formatted: " + urise . getMessage ( ) , urise ) ; } String urlString = url . toExternalForm ( ) ; if ( ! urlString . endsWith ( "/" ) ) { urlString += "/" ; } urlString += "services/" + servicePrefix + "/server" ; URL serverPlusServicePrefixUrl ; try { serverPlusServicePrefixUrl = new URL ( urlString ) ; } catch ( MalformedURLException murle ) { throw new IllegalArgumentException ( "URL (" + url . toExternalForm ( ) + ") is incorrectly formatted: " + murle . getMessage ( ) , murle ) ; } return urlString ; }
Initializes the URL that will be used for web service access

@param url URL of the server instance
@return An URL that can be used for the web services