Hi Denuwanthi,

Thanks for the answer. Anyway I will not get file object from jaggery
layer. content hashmap include a input stream object as a value for the key
called "Data". I want to get that input stream object. Other values like
name and contentType in hashmap can retrieve successfully from hash map.
problem is that inputstream object will not be extractable from jaggery
method.

Thanks

On Thu, Oct 22, 2015 at 10:48 AM, Denuwanthi De Silva <[email protected]>
wrote:

> Hi Lakshman,
>
> Did you try the following?
>
> var inputStream = Packages.java.io.InputStream;
>
> inputStream = file.getStream().getStream();
>
> (You need to call getStream() method twice)
>
>
> Thanks,
>
>
>
>
>
>
> On Wed, Oct 21, 2015 at 3:39 PM, Lakshman Udayakantha <[email protected]>
> wrote:
>
>> Hi ES team,
>>
>> There is a method to get document from registry in API Manager Impl
>> layer. We can get any file saved in registry with that method. But when I
>> pass the returned file object to jaggery method, jaggery layer gets an
>> empty object.
>>
>> public static Map<String, Object> getDocument(String userName, String
>> resourceUrl,
>>                                               String tenantDomain)
>>  {
>>     Map<String, Object> documentMap = new HashMap<String, Object>();
>>
>>     InputStream inStream = null;
>>
>>     Resource apiDocResource;
>>
>>             inStream = apiDocResource.getContentStream();
>>             documentMap.put("Data", inStream);
>>             documentMap.put("contentType", apiDocResource.getMediaType());
>>             String[] content = apiDocResource.getPath().split("/");
>>             documentMap.put("name", content[content.length - 1]);
>>
>>     return documentMap;
>> }
>> above is the getDocument method. It gets the document from registry and
>> put into a hash map. Below is the jaggery method to get the file where I
>> can get the hash map values successfully but the file content.
>>
>>  StoreAPIProxy.prototype.getDocument = function (username, resourcepath,
>> tenantDomain) {
>>         var document = {};
>>
>>             var content = APIUtil.getDocument(username, resourcepath,
>> tenantDomain);
>>             document.data = content.get("Data");
>>             document.contentType = content.get("contentType");
>>             document.name = content.get("name");
>>
>>             return {
>>                 error:false,
>>                 document:document
>>             };
>>         }
>>     };
>>
>> How do I get the InputStream object returns by java method to jaggery
>> method?
>>
>> Thanks
>> --
>> Lakshman Udayakantha
>> WSO2 Inc. www.wso2.com
>> lean.enterprise.middleware
>> Mobile: *0711241005*
>>
>>
>> _______________________________________________
>> Dev mailing list
>> [email protected]
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> Denuwanthi De Silva
> Software Engineer;
> WSO2 Inc.; http://wso2.com,
> Email: [email protected]
> Blog: https://denuwanthi.wordpress.com/
>



-- 
Lakshman Udayakantha
WSO2 Inc. www.wso2.com
lean.enterprise.middleware
Mobile: *0711241005*
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to