Sending BLOBs in a JSON service,... how?
- by Marten Sytema
Hello
I have a webservice (ie. servlet) implemented in Java. It gets some data from a MySQL table, with one column being of type BLOB (an image), and some other columns are just plain text.
Normally I would store the file outside the database with a pointer to it in the database, but due to circumstance I now have to use this BLOB column...
What is the proper way to send this? How to encode the image in a JSONObject, and how to parse (and RENDER!) it on the otherside ?
I want to use JSONP, to avoid having to proxy it through the consumer's webserver.
So that the consumer can just put in a tag pointing to the webservice, calling a callback.
Any thoughts how to handle images in this situation? Also thoughts on performance etc. are interesting!