简体   繁体   中英

read remote excel file stored on a server with authenticaion

I need to access a remote excel file https://wim-example.com/rest/api/2/issue/SDLCDEVOPS-3238/abc.xlsx that is attached to a JIRA ticket. Each time I access JIRA ticket I have to add authentication token to the connection. I have to use the XSSFWorkbook that takes inputstream

URLConnection con1 = url1.openConnection(); con1.setRequestProperty("Authorization", "Basic dTU3NjI3MjpGcmVtb250MTIz");

How can I get the input stream that I can give to XSSFWorkbook?

Figured out how to provide the inputstream:

Connection. getInputStream()

URLConnection con1 = url1.openConnection();
con1.setRequestProperty("Authorization", "Basic dTU3NjI3MjpGcmVtb250MTIz");

XSSFWorkbook fs = new XSSFWorkbook(con1.getInputStream());

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM