Package java.net

Examples of java.net.URL.toURI()


            }
            // parse XQuery expression
            XQueryParser parser = new XQueryParser(is);
            StaticContext staticEnv = parser.getStaticContext();
            try {
                URI baseUri = url.toURI();
                staticEnv.setBaseURI(baseUri);
            } catch (URISyntaxException e) {
                log(PrintUtils.prettyPrintStackTrace(e, -1));
            }
            final XQueryModule module;
View Full Code Here


   */

   public void testURLRss() throws Exception
   {
      URL url = new URL("http://itredux.com/blog/feed/atom/");
      RSSDocument<DefaultRSSChannel, DefaultRSSItem> document = parser_.createDocument(url.toURI(), "utf-8");
      if (document != null)
      {
         List<DefaultRSSItem> items = document.getItems();
         for (DefaultRSSItem item : items)
         {
View Full Code Here

    */

   public void testRssChannelLink() throws Exception
   {
      URL url = new URL("http://www.lagazettedescommunes.com/RSS/generateRSS.asp");
      RSSDocument<DefaultRSSChannel, DefaultRSSItem> document = parser_.createDocument(url.toURI(), "utf-8");
      if (document != null)
      {
         IRSSChannel channel = document.getChannel();
         System.out.println("RSS Channel Title: " + channel.getTitle());
         System.out.println("RSS Channel Link: " + channel.getLink());
View Full Code Here

    * We test only the first item under a channel
    */
   public void testRssItemLinks() throws Exception
   {
      URL url = new URL("http://www.lagazettedescommunes.com/RSS/generateRSS.asp");
      RSSDocument<DefaultRSSChannel, DefaultRSSItem> document = parser_.createDocument(url.toURI(), "utf-8");
      if (document != null)
      {
         DefaultRSSItem firstItem = document.getItem(0);
         System.out.println("Creator: " + firstItem.getCreator());
         System.out.println("Description: " + firstItem.getDesc());
View Full Code Here

    @Override
    public File getConfigFile(Context ctx) {
        URL configUrl = ctx.getConfigFile();
        if (configUrl != null) {
            try {
                URI configUri = configUrl.toURI();
                if ("file".equals(configUri.getScheme())) {
                    return new File(configUri.getPath());
                }
            } catch (Exception ex) {
                logger.error("Could not convert URL to URI: " + configUrl, ex);
View Full Code Here

  private String getSource() {
    URL url = ZipUtilsTest.class.getClassLoader().getResource(testFilename + ".txt");
    File f = null;
    try {
      f = new File(url.toURI());
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
    return f.getAbsolutePath();
  }
View Full Code Here

  @SuppressWarnings("nls")
  public void testFILEFeed() throws Exception {
    URL pluginLocation = FileLocator.toFileURL(Platform.getBundle("org.rssowl.core.tests").getEntry("/"));
    IConnectionService conManager = Owl.getConnectionService();
    URL feedUrl = pluginLocation.toURI().resolve("data/interpreter/feed_rss.xml").toURL();
    IFeed feed = new Feed(feedUrl.toURI());

    Pair<IFeed, IConditionalGet> result = conManager.reload(feed.getLink(), null, null);

    assertEquals("RSS 2.0", result.getFirst().getFormat());
  }
View Full Code Here

    } else {
      System.out.println("File from URI ("+url.getFile()+") does not exist");
    }

    // GOOD - Converting a URL to a file this way is fine when the file path contains spaces
    File f3 = new File(url.toURI());
    if (f3.exists()) {
      System.out.println("2nd File from URI ("+f3.getAbsolutePath()+") exists");
    } else {
      System.out.println("2nd File from URI ("+f3.getAbsolutePath()+") does not exist");
    }
View Full Code Here

  @SuppressWarnings("nls")
  public void testFILEFeed() throws Exception {
    URL pluginLocation = FileLocator.toFileURL(Platform.getBundle("org.rssowl.core.tests").getEntry("/"));
    IConnectionService conManager = Owl.getConnectionService();
    URL feedUrl = pluginLocation.toURI().resolve("data/interpreter/feed_rss.xml").toURL();
    IFeed feed = new Feed(feedUrl.toURI());

    Triple<IFeed, IConditionalGet, URI> result = conManager.reload(feed.getLink(), null, null);

    assertEquals("RSS 2.0", result.getFirst().getFormat());
  }
View Full Code Here

    Assert.assertEquals(response.getStatus(), 200);
    Assert.assertEquals(response.getHeader("Accept-Ranges"), "bytes");

    Assert.assertEquals(response.getContentLength(), 59);

    File file = new File(testDoc.toURI());
    request = new MockHttpServletRequest();
    response = new MockHttpServletResponse();
    request.addHeader("Range", "bytes=5-12");
    streamDownloader.download(request, response, testDoc, null);
    Assert.assertEquals(response.getStatus(), 206);
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.