1 package org.nextime.ion.backoffice.bean; 2 3 import java.io.File ; 4 import java.io.FileInputStream ; 5 import java.util.Vector ; 6 import javax.servlet.http.HttpServlet ; 7 8 public class Resources { 9 10 private static ResourceXmlBean bean; 11 12 public static ResourceXmlBean getResourceXmlBean(HttpServlet servlet, String id) throws Exception { 13 if( bean == null ) { 14 FileInputStream fis = new FileInputStream ( new File(servlet.getServletContext().getRealPath("../../../conf/resources.xml")) ); 15 bean = ResourceXmlBean.parse(fis); 16 fis.close(); 17 } 18 return ResourceXmlBean.getResource(id); 19 } 20 21 public static Vector getResourceXmlBeans(HttpServlet servlet) throws Exception { 22 if( bean == null ) { 23 FileInputStream fis = new FileInputStream ( new File(servlet.getServletContext().getRealPath("../../../conf/resources.xml")) ); 24 bean = ResourceXmlBean.parse(fis); 25 fis.close(); 26 } 27 return ResourceXmlBean.getItems(); 28 } 29 30 } 31 32 | Popular Tags |