Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Reading a WRR Resource as InputStream

Hello All,

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.

Accessing the Web Resource Repository - Portal - SAP Library

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> / / 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> / / repo / folder1 / Test_Data.csv

Any ideas/pointers?

Thanks & Regards,


Former Member replied

Hi Amey,

Can you try reading the file with relative URL, not including the host?

/ / 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());

Best Regards,


0 View this answer in context

Helpful Answer

Not what you were looking for? View more on this topic or Ask a question