Coding Web Services to use HTTPS

If you want to use the Junos Space REST APIs in applications designed to support HTTPS, you may need to take special steps to ensure that certificates can be provided correctly. For example, if the application calls SDK web services through Ext JS, then the relative path /api/space/... is used, and no additional steps are required. Since Ext JS code runs on the browser, the browser will automatically provide the certificate if the user logs into the Space UI through HTTPS.

However, to use a Java client there are two methods in the sdk-shared library that need to be called. The methods are shown in the code example below.

Protocol easyhttps = new Protocol("https", new EasySSLProtocolSocketFactory(), 443); 
Protocol.registerProtocol("https", easyhttps); 
String userUrl = ""; 
HttpClient client = new HttpClient(); 
HeadMethod head = new HeadMethod(userUrl); 
    int statusCode = client.executeMethod(head); 
catch (Exception ex) 

You can write your code the same way as Hornet-Q does, by just forwarding the address from the caller of your API. You have to know what the address is, because the API which comes in from the client already has this address. However, if you want to have a new origination address, then understand that the address for the sandbox will be different than the address in production. But that is also true of coding for HTTP.