Reading a WRR Resource as InputStream
I need to read a file kept in Portal WRR as inputstream.
From below link, I could write code to get instance of IResource and it's URI, but I don't see any 'getContent' or similar method for this object which will give me inputstream for this file.
Hence, first question is, "Is there any method or standard way to read a WRR Resource as inputstream like we have in KM Resource?"
Then I tried to get inputstream using URI of this object using traditional old URLConnection way.
Hence, I noticed strange thing: -
1. When I try to get inputstream from URL of below pattern, I am able to get the inputstream: -
http : // <host> : <port> / com.sap.portal.resourcerepository / repo / folder1 / Test_Data.csv
2. And when I try to get inputStream using masked hostname URL (the one which actually used by end-users), I get connection timed out error in URLConnection: -
http : // <masked-hostname> / com.sap.portal.resourcerepository / repo / folder1 / Test_Data.csv
Thanks & Regards,
Can you try reading the file with relative URL, not including the host?
/ com.sap.portal.resourcerepository / repo / folder1 / Test_Data.csv
Another try is after you get the resource with code:
IResource resource = resourceRepository.getResource(resourcePath, IResource.CSSfalse)Get its path by: IResourceInformation resourceInfo = resource.getResourceInformation(); File file = new File(resourceInfo.getSource());