Package java.net

Examples of java.net.URL


   
    try {
      String name = PLUGIN_UPDATES_FILENAME.substring(0,
          PLUGIN_UPDATES_FILENAME.indexOf('.'))
          + "_" + Mirror.MIRROR_LIST_FILE_NAME;
      IOUtilities.download(new URL(baseUrl + (baseUrl.endsWith("/") ? "" : "/") + name), new File(Settings.getUserSettingsDirName(), name));
    } catch(Exception ee) {}
   
    java.net.URL url = new java.net.URL(baseUrl + "/" + PluginAutoUpdater.PLUGIN_UPDATES_FILENAME);
    SoftwareUpdater softwareUpdater = new SoftwareUpdater(url,PluginLoader.getInstance().getInfoOfAvailablePlugins());
   
View Full Code Here


       
        try {
          String name = PLUGIN_UPDATES_FILENAME.substring(0,
              PLUGIN_UPDATES_FILENAME.indexOf('.'))
              + "_" + Mirror.MIRROR_LIST_FILE_NAME;
          IOUtilities.download(new URL(url + (url.endsWith("/") ? "" : "/") + name), new File(Settings.getUserSettingsDirName(), name));
        } catch(Exception ee) {}
       
        MainFrame.getInstance().updatePlugins(url, true, infoLabel, Settings.propAutoUpdatePlugins.getBoolean());
      }
    }.start();
View Full Code Here

/** XMLDocument initialisation
*/
  public XmlConfig(String configFileName){
     try {
         DOMParser parser = new DOMParser();
         URL url = createURL(configFileName);
         parser.setErrorStream(System.err);
         parser.showWarnings(true);
         parser.parse(url);
         configDoc = parser.getDocument();
         rootConfigNode = (XMLNode) configDoc;
View Full Code Here

   }


   private static URL createURL(String fileName)
   {
      URL url = null;
      try
      {
         url = new URL(fileName);
      }
      catch (MalformedURLException ex)
      {
         File f = new File(fileName);
         try
         {
            String path = f.getAbsolutePath();
            String fs = System.getProperty("file.separator");
            if (fs.length() == 1)
            {
               char sep = fs.charAt(0);
               if (sep != '/')
                  path = path.replace(sep, '/');
               if (path.charAt(0) != '/')
                  path = '/' + path;
            }
            path = "file://" + path;
            url = new URL(path);
         }
         catch (MalformedURLException e)
         {
            System.out.println("Cannot create url for: " + fileName);
            System.exit(0);
View Full Code Here

        }
        if (evt.getEventType() == HyperlinkEvent.EventType.EXITED) {
          mInfoEP.setToolTipText(mTooltip);
        }
        if (evt.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
          URL url = evt.getURL();
          if (url != null) {
            Launch.openURL(url.toString());
          }
        }
      }
    });
View Full Code Here

    infoPanel.setText(generateHtml(doc));

    infoPanel.addHyperlinkListener(new HyperlinkListener() {
      public void hyperlinkUpdate(HyperlinkEvent evt) {
        if (evt.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
          URL url = evt.getURL();
          if (url != null) {
              Launch.openURL(url.toString());
          }
        }
      }
    });
View Full Code Here

      }
    }

    final File toFile=new File(Settings.propPluginsDirectory.getString(),getClassName() + ".jar.inst");
    try {
        IOUtilities.download(new URL(url),toFile);
    }catch (Exception exc) {
      throw new TvBrowserException(SoftwareUpdateItem.class, "error.1",
                "Download failed", url,toFile.getAbsolutePath(),exc);
    }
    return true;
View Full Code Here

   * @return a String containing an URL that will be relative to the given
   * context if both URLs are on the same host, otherwise it will simply
   * return urlStr
   */
  private String localizeURL(String urlStr, URL context) {
    URL url;
    try {
      url = new URL(context, urlStr);
    } catch (MalformedURLException e) {
      return urlStr;
    }

    // only localize "http:" links
    if (! url.getProtocol().equalsIgnoreCase("http")) {
      return urlStr;
    }

    // only localize if new URL is on the same host !
   
    if ((context != null)
  && (context.getHost().equalsIgnoreCase(url.getHost()))) {
      String ref = url.getRef();
      String path = url.getPath();
     
      // Already relative
      // this should only happen if the context
      // is null
      if (path.startsWith("../")) {
  return urlStr;
      }

      // URL references
      if ((ref != null) && (! ref.equals(""))) {
  path = path+"#"+ref;
      }

      // implied index.html
      if ((path.length()>0) && (path.charAt(path.length()-1)) == '/') {
  path = path+"index.html";
      }
 
      return localizePath(url.getPath(),context.getPath());
    } else {
      return urlStr;
    }
  }
View Full Code Here

            String[] arr = StringUtils.split(ignore, ",");
            for (int i=0; i<arr.length; i++)
                ignoreDirs.add(arr[i].trim());
        }

        URL helmajar = TypeManager.class.getResource("/");

        if (helmajar == null) {
            // Helma classes are in jar file, get helma.jar URL
            URL[] urls = ((URLClassLoader) TypeManager.class.getClassLoader()).getURLs();
View Full Code Here

    throws MalformedURLException
  {
    StringBuffer buffer = new StringBuffer( 128 ) ;
   
    this.urlPath( buffer ) ;
    return new URL( buffer.toString() ) ;
  } // toURL()
View Full Code Here

TOP

Related Classes of java.net.URL

Copyright © 2018 www.massapicom. 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.