Beispiel #1
0
 /**
  * Get the current thread's context class loader which is set to the CommonClassLoader by
  * ApplicationServer
  *
  * @return the thread's context classloader if it exists; else the system class loader.
  */
 public static ClassLoader getClassLoader() {
   if (Thread.currentThread().getContextClassLoader() != null) {
     return Thread.currentThread().getContextClassLoader();
   } else {
     return ClassLoader.getSystemClassLoader();
   }
 }
Beispiel #2
0
 public static Properties getPropertiesFromFile(String file) throws IOException {
   InputStream is = ClassLoader.getSystemResourceAsStream(file);
   if (is != null) {
     Properties config = new Properties();
     config.load(is);
     return config;
   } else {
     String remoteclient = "/" + file;
     InputStream is2 = Utility.class.getResourceAsStream(remoteclient);
     Properties config = new Properties();
     config.load(is2);
     return config;
   }
 }