You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Sergey Beryozkin <sb...@gmail.com> on 2015/02/25 11:53:25 UTC

Re: returning a object's byte array

Perhaps this can help:

http://stackoverflow.com/questions/20706783/put-byte-array-to-json-and-vice-versa

Sergey
On 24/02/15 23:00, Sonam Samdupkhangsar wrote:
> Hi,
>
> I have a Java Object:
>
> class MyFile {
>    Long id;
> byte[] myBytes;
>
> }
>
> I have a JAXRS service that returns MyFile objects:
>
> @GET
> @Produces ( "application/json" )
> @Path("/new")
> public Set<MyFile> getMyFiles();
>
>
> On the Javascript-client side, the contents of MyFile.myBytes is encoded in Base64 (not sure but looks like it).    The myBytes is a byte array containing a PDF file.  I used the "atob()" javascript method to get the binary (blob) data but I am not able to display the pdf file using the HTML's "<embed>" tag.
> Not sure if this helps but I see this error on Firefox console : "Error: Invalid XRef stream header".
>
> Thanks
>
> -Sonam
>
>
>


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com