I need to retrieve images from my database. For this I used jquery and servlet to retrieve all images stored in a table. But when i run the code it produces HTTP Statu
You included two InputStream
variables in your class, which are getting set to instances of OracleBlobInputStream
, which your GSON provider cannot serialize. You probably want to store the image content as bytes instead (or as a (URL encoded) string).
public class ImageFileInfo implements Serializable {
// Other class variables
private byte[] thumbarray;
private byte[] fullarray;
// Constructors, Getters/Setters
}
ImageFile.setThumb(rs.getBytes("imagethumb"));
ImageFile.setFull(rs.getBytes("imagefull"));
On a side tangent, it looks like you are trying to return JSON content, but you have incorrectly specified your Content-Type
as text/html
, instead of application/json
.