import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
import javax.imageio.*;
import java.awt.*;
import java.awt.image.*;

public class ImageServlet extends HttpServlet
{
	public void doGet(HttpServletRequest request,HttpServletResponse response)
			throws ServletException,IOException {
				
		response.setContentType("image/jpeg");
		int width = 200;
		int height =150;
		
		BufferedImage image = new BufferedImage(width, height, 
									BufferedImage.TYPE_INT_RGB); 

		Graphics g = image.getGraphics(); 

		g.setColor(new Color(0xEEEEEE)); 
		g.fillRect(0, 0, width, height);
		g.setColor(Color.red);
		g.drawOval(0,0,width, height);
		g.dispose(); 
		
		try {
			ImageIO.write(image, "JPEG", response.getOutputStream());
		} catch (IOException e) {
		}
	}
}
