here i tried to write program to download a jpeg image from folder Resource folder. it is downloading a jpeg image as ordinary file with 0 bytes. with name of file as dload(servlet name). i couln`t trace the logical could you correct me..
here i tried to write program to download a jpeg image from folder Resource folder. it is downloading a jpeg image as ordinary file with 0 bytes. with name of file as dload(servlet name). i couln`t trace the logical could you correct me..
First, you should make sure that the image file you want to download is in the correct path.
InputStream is = context.getResourceAsStream("/Resource/vino.jpeg");
In other words, you should check whether is != null;
In particular line #19 will read up to 46000 bytes of the resource into a byte array. You ignore this and just stream the rest of the resource out to the response.