public Object getRequest ( String restUrl , Map < String , String > params ) throws IOException , WebServiceException { HttpURLConnection conn = null ; try { // Make the URL urlString = new StringBuilder ( this . host ) . append ( restUrl ) ; urlString . append ( this . makeParamsString ( params , true ) ) ; LOGGER . debug ( "Doing HTTP request: GET [{}]" , urlString . toString ( ) ) ; // Connection configuration // Proxy proxy = DEBUG_HTTP ? new Proxy(Proxy.Type.HTTP, new InetSocketAddress("127.0.0.1", 8008)) : Proxy.NO_PROXY; URL url = new URL ( urlString . toString ( ) ) ; conn = ( HttpURLConnection ) url . openConnection ( ) ; conn . setRequestMethod ( HttpMethod . GET . name ( ) ) ; conn . setRequestProperty ( "Connection" , "Keep-Alive" ) ; // Gets the response return this . readResponse ( restUrl , conn ) ; } catch ( WebServiceException e ) { LOGGER . debug ( "WebServiceException catched. Request error" , e ) ; throw e ; } catch ( IOException e ) { LOGGER . debug ( "IOException catched. Request error" , e ) ; throw e ; } catch ( Exception e ) { LOGGER . debug ( "Exception catched, throwing a new IOException. Request error" , e ) ; throw new IOException ( e . getLocalizedMessage ( ) ) ; } finally { if ( conn != null ) { conn . disconnect ( ) ; } } }
Do a GET HTTP request to the given REST - URL .