package examples.htmlkona;

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import weblogic.html.*;

/**
 * This servlet retrieves a JPG image from a database and displays it.
 * 
 * @author Copyright (c) 1996-98 by WebLogic, Inc. All Rights Reserved.
 * @author Copyright (c) 1999-2000 by BEA Systems, Inc. All Rights Reserved.
 */
public class ImageDataDisplay extends HttpServlet {

  public synchronized void service(HttpServletRequest req, HttpServletResponse res) 
    throws IOException
  {
    try {
      res.setStatus(HttpServletResponse.SC_OK);
      res.setContentType("image/gif");
      
      byte[] bvec = weblogic.utils.FileUtils.getFileBytes(defaults.fileloc() + "GA-B747.JPG");
      ImagePage hp = new ImagePage(bvec);
      
      hp.output(res.getOutputStream());
    }
    catch (Exception e) {
      defaults.showException(e, res.getOutputStream());
    }
  }
}

