1 4 5 9 10 package org.openlaszlo.servlets.responders; 11 12 import java.io.*; 13 import java.util.Properties ; 14 import javax.servlet.ServletConfig ; 15 import javax.servlet.ServletException ; 16 import javax.servlet.ServletOutputStream ; 17 import javax.servlet.http.HttpServletRequest ; 18 import javax.servlet.http.HttpServletResponse ; 19 import org.openlaszlo.utils.FileUtils; 20 import org.openlaszlo.utils.SWFUtils; 21 import org.apache.log4j.Logger; 22 23 26 public final class ResponderUTCSWF extends ResponderAdmin 27 { 28 private static Logger mLogger = Logger.getLogger(ResponderUTCSWF.class); 29 30 public void init(String reqName, ServletConfig config, Properties prop) 31 throws ServletException , IOException 32 { 33 super.init(reqName, config, prop); 34 } 35 36 protected void respondAdmin(HttpServletRequest req, HttpServletResponse res) 37 throws IOException 38 { 39 ServletOutputStream out = res.getOutputStream(); 40 InputStream in = null; 41 try { 42 res.setContentType ("application/x-shockwave-flash"); 43 long utc = System.currentTimeMillis(); 44 String s = "" + utc; 45 in = SWFUtils.getErrorMessageSWF(s); 46 res.setContentLength(in.available()); 47 FileUtils.sendToStream(in, out); 48 } catch (FileUtils.StreamWritingException e) { 49 mLogger.warn("StreamWritingException while sending utcswf: " + e.getMessage()); 50 } finally { 51 FileUtils.close(in); 52 FileUtils.close(out); 53 } 54 } 55 56 public int getMimeType() 57 { 58 return MIME_TYPE_SWF; 59 } 60 } 61 | Popular Tags |