}
public void sendImage(ResourceContext context, RenderedImage image)
throws IOException {
// ImageIO.write(image,"gif",context.getOutputStream());
GIFEncoder encoder = new GIFEncoder();
DataOutputStream out = new DataOutputStream(context.getOutputStream());
try {
encoder.encode((BufferedImage) image, out);
out.flush();
out.close();
} catch (Exception e) {
// IE can unexpected close connection