Package java.net

Examples of java.net.URL.toURI()


        try {
            if (protocol.startsWith("jar")) {
                return new StandardPluginLocation(new URL(jar.toExternalForm()
                    .replaceFirst("!(.*?)$", Util.joinPath("!", context))), jar);
            } else if (protocol.startsWith("file")) {
                File f = new File(jar.toURI());
                return new StandardPluginLocation(f.getParentFile(), manifest);
            }
        } catch (URISyntaxException e) {
            return null;
        } catch (MalformedURLException e) {
View Full Code Here


 
  @Override
  protected PasswordAuthentication getPasswordAuthentication() {
    URL requestURL = getRequestingURL();
    try {
      String uri = requestURL.toURI().normalize().toString();
      Site site = findBestMatch(uri);
      if (site != null) {
        return new PasswordAuthentication(site.login, site.pwd);
      }
    } catch (URISyntaxException e) {
View Full Code Here

            // Try to use url.toURI() to translate URL specific sequences like %20 into
            // standard characters:
            File fl = null;
            try {
                URL url = new URL(line);
                fl = new File(url.toURI());
            } catch(URISyntaxException e) {
                e.printStackTrace();
            } catch (MalformedURLException e) {
                e.printStackTrace();
            }
View Full Code Here

      {
         log.debug("Begin distribute: " + deployment);
         final URL contentURL = deployment.getContentURL();
         String[] rnames;
         if(!deployment.isCopyContent()) {           
            final File file = new File(contentURL.toURI());
            if(file.exists() == false) {
               throw new RuntimeException(String.format("file (%s) does not exist. Use 'copyContent = true' " +
                   "to copy the deployment.", contentURL));
            }
         }
View Full Code Here

   {
      // Get resource
      URL url = Thread.currentThread().getContextClassLoader().getResource(resource);
      // The input source
      InputSource input = new InputSource(url.openStream());
      input.setSystemId(url.toURI().toString());
      XMLReader reader = XMLReaderFactory.createXMLReader();
      reader.setEntityResolver(new JBossEntityResolver());
      SAXSource source = new SAXSource(reader, input);
      // New JAXB context
      JAXBContext context = JAXBContext.newInstance(ManagedConnectionFactoryDeploymentGroup.class);
View Full Code Here

      // Represent as a File
      File dir = null;
      try
      {
         dir = new File(location.toURI());
      }
      catch (final URISyntaxException urise)
      {
         throw new RuntimeException("Could not desired directory from URL: " + location, urise);
      }
View Full Code Here

        logger.info("Running testSSLStartup");

        SSLConfig cfg = new SSLConfig();
        ClassLoader cl = getClass().getClassLoader();
        URL keystoreUrl = cl.getResource("ssltest-keystore.jks");
        String keyStoreFile = new File(keystoreUrl.toURI()).getAbsolutePath();
        cfg.setKeyStoreFile(keyStoreFile);
        cfg.setKeyPass("changeit");

        URL cacertsUrl = cl.getResource("ssltest-cacerts.jks");
        String trustStoreFile = new File(cacertsUrl.toURI()).getAbsolutePath();
View Full Code Here

        String keyStoreFile = new File(keystoreUrl.toURI()).getAbsolutePath();
        cfg.setKeyStoreFile(keyStoreFile);
        cfg.setKeyPass("changeit");

        URL cacertsUrl = cl.getResource("ssltest-cacerts.jks");
        String trustStoreFile = new File(cacertsUrl.toURI()).getAbsolutePath();
        cfg.setTrustStoreFile(trustStoreFile);
        cfg.setTrustStorePass("changeit");

        AtmosphereSpadeServer sslSpade = AtmosphereSpadeServer.build("https://127.0.0.1:" + 7777 + "/",
                PubSubTest.class.getPackage().getName(), cfg );
View Full Code Here

    path = path.replace("/ContentPackage", "/_resources/imscp.zip");

    path = VFSManager.sanitizePath(path);
    URL url = this.getClass().getResource(path);
    try {
      File f = new File(url.toURI());
      if (f.exists() && root.exists()) {
        FileUtils.copyFileToDir(f, root);
      } else {
        log.error("cp template was not copied. Source:  " + url + " Target: " + root.getAbsolutePath());
      }
View Full Code Here

  }
 
  public void testDicPath() throws URISyntaxException {
    URL url = Dictionary.class.getResource("/");
    String path = "";
    path = url.toURI().getRawPath();
    System.out.println(path);
    File f = new File(path+"data");
    System.out.println(f+" -> "+f.exists());
   
   
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.