private GridHubConfiguration getHubConfiguration ( ) throws Exception { String hubApi = "http://" + registrationRequest . getConfiguration ( ) . getHubHost ( ) + ":" + registrationRequest . getConfiguration ( ) . getHubPort ( ) + "/grid/api/hub" ; URL api = new URL ( hubApi ) ; HttpClient client = httpClientFactory . createClient ( api ) ; String url = api . toExternalForm ( ) ; HttpRequest request = new HttpRequest ( GET , url ) ; HttpResponse response = client . execute ( request ) ; try ( Reader reader = new StringReader ( response . getContentString ( ) ) ; JsonInput jsonInput = new Json ( ) . newInput ( reader ) ) { return GridHubConfiguration . loadFromJSON ( jsonInput ) ; } }
uses the hub API to get some of its configuration .