/** * List files in a folder * * @param containerName Folder name * @return List of file names * @throws IOException */ public List<String> listObjects(String containerName) throws Exception { HttpURLConnection urlConnection = getConnBuilder(containerName, null).getConnection(); HttpResponse response = Utils.doReadOperation(urlConnection); if (!response.isSuccessCode()) { if (response.isAuthDenied()) { log.warn("Refreshing credentials and retrying"); authenticate(); return listObjects(containerName); } else { log.error("Error listing container " + containerName + ", code = " + response.code); } } return response.payloadAsLines(); }