Binary files again - how do I get them in GWT?

103 views
Skip to first unread message

Carsten

unread,
Jun 16, 2012, 6:28:58 AM6/16/12
to google-we...@googlegroups.com
Hi,

so far I worked around the problem whenever I had a binary file I needed in GWT. Usually I converted the binary files to something like XML. Now I cannot.

I have a closed-source lib that accepts only byte[] (and InputStreams) and returns a POJO. It does some very complex conversion and also the binary format is not available. It is a very specialized area I am working in/on. Everything works perfect in GWT as long as I hard-code the data in form of a byte[] in my .java file which has a 64k restriction -- so I couldn't really do this for every of my input-files since they are 20k-200k in size. Also it would be insane to hardcode them in .java files and then compile them to JS.

So yes, I need a way to load those binary files into my GWT app. The GWT app resides on server1/domain1 the binary date resides on server2/domain2 (I think that's no problem since cross-site linking?).

Any idea how to solve this? I should add that I cannot touch server2/domain2. I can perhaps ask them to change some settings, but I cannot deploy some servlet there which serves the binary files with base64 encoding. If it is possible to tell the server to serve certain files in base64 encoding it may be possible to do that though.

I would love to make this app in GWT since I already had a lot of progress. I thought I care about the data-problem at the end but it seems I hit a wall :(

Thanks,
Carsten

bartolomiew

unread,
Jun 16, 2012, 11:07:53 AM6/16/12
to google-we...@googlegroups.com
You can use the same technique used here : http://code.google.com/p/js-openctm/ to read binary files.
You have just to wrap the javascript code then decode yours data, but this won't solve cross origine.
Reply all
Reply to author
Forward
0 new messages