Package java.net

Examples of java.net.URL


    source.myDouble = new Double("1");

    Destination result = mapper.map(source, Destination.class);

    assertThat(result.file, equalTo(new File("a")));
    assertThat(result.url, equalTo(new URL("http://a")));
    assertThat(result.type, sameInstance(String.class));
    assertThat(result.bigDecimal, equalTo(new Double("1")));
    assertThat(result.myDouble, equalTo(new BigDecimal("1.0")));
  }
View Full Code Here


                if (dotIndex != -1) {
                  modelName = entryFileName.substring(0, dotIndex);
                } else {
                  modelName = entryFileName;
                }
                URL entryUrl = new URL("jar:" + urlContent.getURL() + "!/"
                    + URLEncoder.encode(entryName, "UTF-8").replace("+", "%20").replace("%2F", "/"));
                modelContent = new TemporaryURLContent(entryUrl);
                model = ModelManager.getInstance().loadModel(modelContent);
                if (!entryFileName.toLowerCase().endsWith(".obj")
                    && (this.preferences.isModelContentAlwaysConvertedToOBJFormat()
View Full Code Here

      objFile = "model.obj";
    }

    File tempZipFile = File.createTempFile("urlContent", "tmp");
    OBJWriter.writeNodeInZIPFile(model, tempZipFile, 0, objFile, "3D model " + objFile);
    return new TemporaryURLContent(new URL("jar:" + tempZipFile.toURI().toURL() + "!/"
        + URLEncoder.encode(objFile, "UTF-8").replace("+", "%20")));
  }
View Full Code Here

         
      URLClassLoader urlcl=new URLClassLoader(new URL[]{baseURI.toURL()});
     
      String filename="jbossws-cxf-"+portName.getLocalPart()+".xml";
         
      URL busFile = urlcl.getResource(filename);
     
      log.debug("Web Stack initialization file: name="+filename+" file="+busFile);
     
      if (busFile != null) {
        Bus bus = bf.createBus(busFile.toString());
        bf.setThreadDefaultBus(bus);
       
        log.debug("Set thread default bus="+bus);
      }
           
View Full Code Here

  private static Map<String, Double> loadAccounts(String resourceName) {
    try {
      // parse the accounts document
      DocumentBuilder domBuilder =
          DocumentBuilderFactory.newInstance().newDocumentBuilder();
      URL resource = AccountSystem_Impl.class.getResource(resourceName);
      if (resource == null) return Collections.emptyMap();
      Document accountsDocument = domBuilder.parse(resource.toString());
      // give everyone an initial balance of $50
      Double initialBalance = new Double(50);
      // iterate over the accounts
      Map<String, Double> accounts = new HashMap<String, Double>();
      Element accountsElem = accountsDocument.getDocumentElement();
View Full Code Here

    public List<ActiveNodeInfo> getActiveNodeInfo(String instanceId) {
        return Collections.EMPTY_LIST; // Not used
    }

    public URL getDiagramURL(String id) {
        URL result = null;

        StringBuilder sb = getBaseUrl().append("/process/definition/");
        sb.append(id);
        sb.append("/image");

        try {
            result = new URL(sb.toString());
        } catch (MalformedURLException e) {
            throw new RuntimeException("Failed to create url", e);
        }

        return result;
View Full Code Here

  private MappingsSource parser;

  @Test
  public void testParse() throws Exception {
    ResourceLoader loader = new ResourceLoader();
    URL url = loader.getResource("dozerBeanMapping.xml");

    Document document = XMLParserFactory.getInstance().createParser().parse(url.openStream());
    parser = new XMLParser(document);

    MappingFileData mappings = parser.load();
    assertNotNull(mappings);
  }
View Full Code Here

   * fieldmapping.     
   */
  @Test
  public void testParseCustomConverterParam() throws Exception {
    ResourceLoader loader = new ResourceLoader();
    URL url = loader.getResource("fieldCustomConverterParam.xml");

    Document document = XMLParserFactory.getInstance().createParser().parse(url.openStream());
    parser = new XMLParser(document);
   
    MappingFileData mappings = parser.load();

    assertNotNull("The mappings should not be null", mappings);
View Full Code Here

        return r;
    }
   
    // Get an InputStream based on a publicid and a systemid
    private InputStream getInputStream(String publicid, String systemid) throws IOException, SAXException {
        URL basis = new URL("file", "", System.getProperty("user.dir") + "/.");
        URL url = new URL(basis, systemid);
        URLConnection c = url.openConnection();
        return c.getInputStream();
    }
View Full Code Here

            doctypename = name;
            doctypepublicid = publicid;
            if (theScanner instanceof Locator) {    // Must resolve systemid
                doctypesystemid  = ((Locator)theScanner).getSystemId();
                try {
                    doctypesystemid = new URL(new URL(doctypesystemid), systemid).toString();
                } catch (Exception e) {}
            }
        }
    }
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.