FileDocCategorySizeDatePackage
ChainImageSource.javaAPI DocExample928Tue Jan 25 10:45:14 GMT 2000None

ChainImageSource

public class ChainImageSource extends HttpServlet

Fields Summary
int
keynum
Constructors Summary
Methods Summary
public voiddoGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)

  // used to create a unique key

       
                                  
    // Get an Image
    String imageFile = req.getRealPath("/system/images/serverduke.gif");
    Image image = Toolkit.getDefaultToolkit().getImage(imageFile);

    // Create a unique key under which to store the image
    String key = "com.oreilly.servlet.ChainImageSource." + keynum++;

    // Store the image in the system Properties list using that key
    System.getProperties().put(key, image);

    // Tell the next servlet to expect an image key
    res.setContentType("java-internal/image-key");

    PrintWriter out = res.getWriter();

    // Send the key
    out.println(key);