<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: retrieve if a file exists in an http server in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/retrieve-if-a-file-exists-in-an-http-server/m-p/2282978#M57006</link>
    <description>Ok this is the first time I will use a routine.&lt;BR /&gt;I have create a new routine call HttpFileCheck.&lt;BR /&gt;And I paste the code from the link you have provided, is it correct like below?&lt;BR /&gt;Thanks,&lt;BR /&gt;package routines;&lt;BR /&gt;public class HttpFileCheck {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; import java.net.*;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; import java.io.*;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public static boolean exists(String URLName){&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; try {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; HttpURLConnection.setFollowRedirects(false);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // note : you may also need&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; HttpURLConnection.setInstanceFollowRedirects(false)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; HttpURLConnection con =&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (HttpURLConnection) new URL(URLName).openConnection();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; con.setRequestMethod("HEAD");&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return (con.getResponseCode() == HttpURLConnection.HTTP_OK);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; catch (Exception e) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; e.printStackTrace();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return false;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; }&lt;BR /&gt;}</description>
    <pubDate>Fri, 29 Jan 2016 07:44:20 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2016-01-29T07:44:20Z</dc:date>
    <item>
      <title>retrieve if a file exists in an http server</title>
      <link>https://community.qlik.com/t5/Talend-Studio/retrieve-if-a-file-exists-in-an-http-server/m-p/2282974#M57002</link>
      <description>Hello, &lt;BR /&gt;we have a large list of file stored in a http server with a database storing the path and file name.&lt;BR /&gt;Is there a way to iterate for each file in the database and retrieve the http error code (ex. 404)?&lt;BR /&gt;Thanks,</description>
      <pubDate>Mon, 25 Jan 2016 09:05:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/retrieve-if-a-file-exists-in-an-http-server/m-p/2282974#M57002</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-01-25T09:05:04Z</dc:date>
    </item>
    <item>
      <title>Re: retrieve if a file exists in an http server</title>
      <link>https://community.qlik.com/t5/Talend-Studio/retrieve-if-a-file-exists-in-an-http-server/m-p/2282975#M57003</link>
      <description>Hi&amp;nbsp;&lt;BR /&gt;Read the file path or file name from database, and then iterate each one and fetch it from HTTP serve with tFileFetch, uncheck 'die on error' option if you want the job continue to retrieve next file even there is an error. eg:&lt;BR /&gt;tMysqlInput--main--tFlowToIterate--iterate--tFileFetch</description>
      <pubDate>Thu, 28 Jan 2016 12:59:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/retrieve-if-a-file-exists-in-an-http-server/m-p/2282975#M57003</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-01-28T12:59:04Z</dc:date>
    </item>
    <item>
      <title>Re: retrieve if a file exists in an http server</title>
      <link>https://community.qlik.com/t5/Talend-Studio/retrieve-if-a-file-exists-in-an-http-server/m-p/2282976#M57004</link>
      <description>Thanks, 
&lt;BR /&gt;but I do not want to retrieve the file but to ensure the file is present, as we have many files which are not existing or has been moved to anohter location. 
&lt;BR /&gt;So it is to get the status when the file does not exist anymore at the stored location
&lt;BR /&gt;cheers.</description>
      <pubDate>Thu, 28 Jan 2016 14:09:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/retrieve-if-a-file-exists-in-an-http-server/m-p/2282976#M57004</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-01-28T14:09:23Z</dc:date>
    </item>
    <item>
      <title>Re: retrieve if a file exists in an http server</title>
      <link>https://community.qlik.com/t5/Talend-Studio/retrieve-if-a-file-exists-in-an-http-server/m-p/2282977#M57005</link>
      <description>Hi&amp;nbsp;
&lt;BR /&gt;Write a routine function to do it, here is an example code in this page:
&lt;BR /&gt;
&lt;A href="http://stackoverflow.com/questions/4596447/check-if-file-exists-on-remote-server-using-its-url" rel="nofollow noopener noreferrer"&gt;http://stackoverflow.com/questions/4596447/check-if-file-exists-on-remote-server-using-its-url&lt;/A&gt;
&lt;BR /&gt;Call the routine function on tMap or tJavaRow, eg:
&lt;BR /&gt;
&lt;FONT size="2"&gt;&lt;FONT face="Verdana, Helvetica, Arial, sans-serif"&gt;tMysqlInput--main--tJavaRow--main--tLogRow&lt;/FONT&gt;&lt;/FONT&gt;</description>
      <pubDate>Fri, 29 Jan 2016 04:16:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/retrieve-if-a-file-exists-in-an-http-server/m-p/2282977#M57005</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-01-29T04:16:49Z</dc:date>
    </item>
    <item>
      <title>Re: retrieve if a file exists in an http server</title>
      <link>https://community.qlik.com/t5/Talend-Studio/retrieve-if-a-file-exists-in-an-http-server/m-p/2282978#M57006</link>
      <description>Ok this is the first time I will use a routine.&lt;BR /&gt;I have create a new routine call HttpFileCheck.&lt;BR /&gt;And I paste the code from the link you have provided, is it correct like below?&lt;BR /&gt;Thanks,&lt;BR /&gt;package routines;&lt;BR /&gt;public class HttpFileCheck {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; import java.net.*;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; import java.io.*;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public static boolean exists(String URLName){&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; try {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; HttpURLConnection.setFollowRedirects(false);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // note : you may also need&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; HttpURLConnection.setInstanceFollowRedirects(false)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; HttpURLConnection con =&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (HttpURLConnection) new URL(URLName).openConnection();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; con.setRequestMethod("HEAD");&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return (con.getResponseCode() == HttpURLConnection.HTTP_OK);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; catch (Exception e) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; e.printStackTrace();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return false;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; }&lt;BR /&gt;}</description>
      <pubDate>Fri, 29 Jan 2016 07:44:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/retrieve-if-a-file-exists-in-an-http-server/m-p/2282978#M57006</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-01-29T07:44:20Z</dc:date>
    </item>
    <item>
      <title>Re: retrieve if a file exists in an http server</title>
      <link>https://community.qlik.com/t5/Talend-Studio/retrieve-if-a-file-exists-in-an-http-server/m-p/2282979#M57007</link>
      <description>Hi&lt;BR /&gt;I did't test the code, but I think it is OK for you to check the file if it exists. Please test it and let me know if it is OK or any problem you get.&amp;nbsp;</description>
      <pubDate>Sat, 30 Jan 2016 10:58:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/retrieve-if-a-file-exists-in-an-http-server/m-p/2282979#M57007</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-01-30T10:58:04Z</dc:date>
    </item>
  </channel>
</rss>

