import javax.servlet.*;
import javax.servlet.http.*;
import com.sun.image.codec.jpeg.*;
import java.awt.image.*;
import java.awt.*;
import java.io.*;

public class Pilt extends HttpServlet{
	
	
	public void doGet(HttpServletRequest kysimus, HttpServletResponse vastus) throws ServletException,IOException{
		
		int suurus=75;   
	    BufferedImage pilt=new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB);
	    Graphics2D  piltg=pilt.createGraphics();
	    piltg.setColor(Color.gray);
	    piltg.fillRect(50-suurus/2, 50-suurus/2, suurus, suurus);
	    vastus.setContentType("image/jpeg");
	    JPEGCodec.createJPEGEncoder(vastus.getOutputStream()).encode(pilt);
	}
}
