1 4 5 9 10 package org.openlaszlo.servlets.responders; 11 12 import java.io.*; 13 import java.net.URL ; 14 import java.util.Hashtable ; 15 import java.util.Properties ; 16 import javax.servlet.ServletConfig ; 17 import javax.servlet.ServletException ; 18 import javax.servlet.ServletOutputStream ; 19 import javax.servlet.http.HttpServletRequest ; 20 import javax.servlet.http.HttpServletResponse ; 21 import org.openlaszlo.media.MimeType; 22 import org.openlaszlo.utils.FileUtils; 23 import org.openlaszlo.utils.LZHttpUtils; 24 import org.openlaszlo.utils.StringUtils; 25 import org.openlaszlo.compiler.CompilationError; 26 import org.apache.log4j.Logger; 27 28 public final class ResponderINFO_XML extends ResponderCompile 29 { 30 private static Logger mLogger = Logger.getLogger(ResponderINFO_XML.class); 31 32 public void init(String reqName, ServletConfig config, Properties prop) 33 throws ServletException , IOException 34 { 35 super.init(reqName, config, prop); 36 } 37 38 39 42 protected void respondImpl(String fileName, HttpServletRequest req, 43 HttpServletResponse res) 44 throws IOException 45 { 46 ServletOutputStream output = null; 47 48 if (fileName.endsWith(".lzo")) { 49 fileName = StringUtils.setCharAt(fileName, 50 fileName.length() - 1, 'x'); 51 } 52 53 try { 55 mLogger.info("Requesting info_xml for " + fileName); 56 57 output = res.getOutputStream(); 58 Properties props = initCMgrProperties(req); 59 String info = mCompMgr.getInfoXML(fileName, props); 60 res.setContentType(MimeType.XML); 61 62 output.print(info); 63 64 } catch (Exception e) { 65 respondWithException(res, e); 66 } finally { 67 FileUtils.close(output); 68 } 69 } 70 71 public int getMimeType() 72 { 73 return MIME_TYPE_XML; 74 } 75 76 protected void handleCompilationError(CompilationError e, 77 HttpServletRequest req, 78 HttpServletResponse res) 79 throws IOException 80 { 81 respondWithErrorXML(res, e.getMessage()); 82 } 83 } 84 | Popular Tags |