Package java.net

Examples of java.net.URLClassLoader.findResource()


          if ( plugin_class_loader instanceof URLClassLoader ){

            URLClassLoader  current = (URLClassLoader)plugin_class_loader;

            URL url = current.findResource("plugin.properties");

            if ( url != null ){
              URLConnection connection = url.openConnection();

              InputStream is = connection.getInputStream();
View Full Code Here


        URLClassLoader apploader = (URLClassLoader)
                                   ClassLoader.getSystemClassLoader();

        // try to get Helma installation directory
        if (installDir == null) {
            URL launcherUrl = apploader.findResource("helma/main/launcher/Main.class");

            // this is a  JAR URL of the form
            //    jar:<url>!/{entry}
            // we strip away the jar: prefix and the !/{entry} suffix
            // to get the original jar file URL
View Full Code Here

      URL url = null;
      String propertyName = "roles.properties";

      if (loader instanceof URLClassLoader) {
        URLClassLoader ucl = (URLClassLoader) loader;
        url = ucl.findResource(propertyName);
      }
      if (url == null) {
        url = loader.getResource(propertyName);
      }
      if (url == null) {
View Full Code Here

        URL archive = getClass().getResource("data/json-files.jar");
        assertThat(archive, is(notNullValue()));

        URLClassLoader loader = new URLClassLoader(new URL[] { archive });
        try {
            URL inUrl = loader.findResource("simple-in.json");
            URL outUrl = loader.findResource("simple-out.json");
            assertThat(inUrl, is(notNullValue()));
            assertThat(outUrl, is(notNullValue()));

            FlowPartTester tester = new FlowPartTester(getClass());
View Full Code Here

        assertThat(archive, is(notNullValue()));

        URLClassLoader loader = new URLClassLoader(new URL[] { archive });
        try {
            URL inUrl = loader.findResource("simple-in.json");
            URL outUrl = loader.findResource("simple-out.json");
            assertThat(inUrl, is(notNullValue()));
            assertThat(outUrl, is(notNullValue()));

            FlowPartTester tester = new FlowPartTester(getClass());
            tester.setFrameworkHomePath(framework.getHome());
View Full Code Here

                        "/WEB-INF/beans.xml",
                        "/META-INF/beans.xml",
                };

                for (String path : paths) {
                    if (loader.findResource(path) != null) return true;
                }
            } catch (Exception e) {
            }
            return false;
        }
View Full Code Here

      URLConnection connection = url.openConnection();
      if (connection instanceof JarURLConnection) {
        JarURLConnection jarURLConnection = (JarURLConnection)connection;
        URLClassLoader urlClassLoader = new URLClassLoader(new URL[] { jarURLConnection.getJarFileURL() });
        try {
          return urlClassLoader.findResource(jarURLConnection.getEntryName()) != null;
        }
        finally {
          if (urlClassLoader instanceof Closeable) {
            ((Closeable)urlClassLoader).close();
          }
View Full Code Here

        // TODO Auto-generated catch block
        e.printStackTrace();
      }
      if (null == checker
      // || null != checker.findResource("java/lang/Object.class") //$NON-NLS-1$
              || null != checker.findResource("org/apache/uima/impl/UIMAFramework_impl.class")) //$NON-NLS-1$
        continue;
      if (result.length() > 0)
        result = result.append(PATH_SEPARATOR);
      result = result.append(classPath);
    }
View Full Code Here

   @CoberturaIgnore
   public static String readManifestImplementationVersion() {
      final URLClassLoader classLoader = (URLClassLoader) JarUtils.class.getClassLoader();
      try {
         final URL url = classLoader.findResource("META-INF/MANIFEST.MF");
         final Manifest manifest = new Manifest(url.openStream());
         return manifest.getMainAttributes().getValue("Implementation-Version");
      } catch (Exception e) {
         //Do nothing
      }
View Full Code Here

   @CoberturaIgnore
   public static String readManifestBuiltDate() {
      final URLClassLoader classLoader = (URLClassLoader) JarUtils.class.getClassLoader();
      try {
         final URL url = classLoader.findResource("META-INF/MANIFEST.MF");
         final Manifest manifest = new Manifest(url.openStream());
         return manifest.getMainAttributes().getValue("Built-Date");
      } catch (Exception e) {
         //Do nothing
      }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.