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 <lakshm...@wso2.com>
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
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Denuwanthi De Silva
Software Engineer;
WSO2 Inc.; http://wso2.com,
Email: denuwan...@wso2.com
Blog: https://denuwanthi.wordpress.com/
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to