1 26 27 package org.nextime.ion.frontoffice.bean; 28 29 import java.io.File ; 30 import java.io.FileInputStream ; 31 import java.util.Vector ; 32 import javax.servlet.http.HttpServlet ; 33 34 import org.nextime.ion.common.ResourceServlet; 35 36 public class Resources { 37 38 private static ResourceXmlBean bean; 39 40 public static ResourceXmlBean getResourceXmlBean( 41 HttpServlet servlet, 42 String id) 43 throws Exception { 44 if (bean == null) { 45 FileInputStream fis = 46 new FileInputStream ( 47 new File ( 48 servlet.getServletContext().getRealPath( 49 ResourceServlet.configPath))); 50 bean = ResourceXmlBean.parse(fis); 51 fis.close(); 52 } 53 return bean.getResource(id); 54 } 55 56 public static Vector getResourceXmlBeans(HttpServlet servlet) 57 throws Exception { 58 if (bean == null) { 59 FileInputStream fis = 60 new FileInputStream ( 61 new File ( 62 servlet.getServletContext().getRealPath( 63 ResourceServlet.configPath))); 64 bean = ResourceXmlBean.parse(fis); 65 fis.close(); 66 } 67 return bean.getItems(); 68 } 69 70 } 71 | Popular Tags |