public static Map < String , String > getCapabilities ( HttpServletRequest request , String ddsUrl ) throws IOException { URL url ; try { url = new URL ( ddsUrl + "/get_capabilities?capability=resolution_width&capability=model_name&capability=xhtml_support_level&" + "headers=" + URLEncoder . encode ( jsonEncode ( getHeadersAsHashMap ( request ) ) , "UTF-8" ) ) ; } catch ( MalformedURLException e ) { throw new IOException ( e ) ; } String httpResponse = fetchHttpResponse ( url ) ; return jsonDecode ( httpResponse , new TypeReference < Map < String , String > > ( ) { } ) ; }
Get the capabilities as a map of capabilities . There are times that a strict data type is not desirable . Getting it as map provides some flexibility . This does not require any knowledge of what capabilities will be returned by the service .