I have the following code to send images to the client :
@GET
@Path("/images/{image}") @Produces("image/*")
public Response getImage(@PathParam("image") String image) {
File f = new File(image);
if (!f.exists()) {
throw new WebApplicationException(404);
}
String mt = new MimetypesFileTypeMap().getContentType(f);
return Response.ok(f, mt).build();
}
Now, the client will receive the image in which format ? Will it be wrapped in XML, or as raw binary ? If I simply put the response in the src of an image tag, will the image be rendered ?
If not, how can I make the raw binary stream that is returned, into an image that can be placed in an img tag