01: /**
02: * Copyright 2005 Sun Microsystems, Inc. All
03: * rights reserved. Use of this product is subject
04: * to license terms. Federal Acquisitions:
05: * Commercial Software -- Government Users
06: * Subject to Standard License Terms and
07: * Conditions.
08: *
09: * Sun, Sun Microsystems, the Sun logo, and Sun ONE
10: * are trademarks or registered trademarks of Sun Microsystems,
11: * Inc. in the United States and other countries.
12: */package com.sun.portal.admin.console.ubt.data;
13:
14: /**
15: *
16: */
17:
18: import java.io.*;
19: import java.util.*;
20: import javax.servlet.*;
21: import javax.servlet.http.*;
22:
23: public class ImageServlet extends HttpServlet {
24:
25: public void service(HttpServletRequest request,
26: HttpServletResponse response) throws IOException,
27: ServletException {
28: Map imagesMap = (Map) request.getSession().getAttribute(
29: "IMAGES_MAP");
30:
31: if (imagesMap != null) {
32: String imageName = request.getParameter("image");
33: if (imageName != null) {
34: byte[] imageData = (byte[]) imagesMap.get(imageName);
35:
36: response.setContentLength(imageData.length);
37: ServletOutputStream ouputStream = response
38: .getOutputStream();
39: ouputStream.write(imageData, 0, imageData.length);
40: ouputStream.flush();
41: ouputStream.close();
42: }
43: }
44: }
45: }
|