Groovy web console

subscribe to the feed Subscribe
to this
site

get dataFile from dataFileLink

Published 2 months ago by Rutger de Vries with tags InputStream dataFile
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
def getData(dataFileLink){
	URI dataFileUri = new URI(dataFileLink)
	Response response = webTarget('OHI_POLICIES', dataFileUri)
      .request()
      .buildGet()
      .invoke()
	status = response.getStatus()
	if(status != 200){
  throw new Exception (response.toString())
	} else {
  r = new InputStreamReader( response.readEntity(InputStream.class) )
  br = new BufferedReader(r)
  line = br.readLine()    
  while (line != null){
   financialMessage = financialMessage + line
   line = br.readLine()
  }  
  br.close()
  r.close()
	}
}