<?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: Blob downloading problem with java automation client in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/blob-downloading-problem-with-java-automation-client/m-p/323504#M10505</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;There are ways to download blobs with Nuxeo automation client:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;// Retrieve document note with full schemas - or using Query operation with doc listing
    note = (Document) session.newRequest(DocumentService.FetchDocument).setHeader(
            Constants.HEADER_NX_SCHEMAS, "*").set("value",
            "/path/path").execute();

    PropertyList list = note.getProperties().getList("files:files");

    PropertyMap map = list.getMap(0).getMap("file");
    assertEquals(filename1, map.getString("name"));
    assertEquals("text/xml", map.getString("mime-type"));

    // get the data URL
    String path = map.getString("data");
    blob = (FileBlob) session.getFile(path);

    // the same for the second file
    map = list.getMap(1).getMap("file");
    assertEquals(filename2, map.getString("name"));
    assertEquals("text/xml", map.getString("mime-type"));

    // get the data URL
    path = map.getString("data");
    blob = (FileBlob) session.getFile(path);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can have several informations on download blobs url pattern here: &lt;A href="http://doc.nuxeo.com/display/NXDOC/Downloading+Files" target="test_blank"&gt;http://doc.nuxeo.com/display/NXDOC/Downloading+Files&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Another way is to use "Blob.Get", "Blob.GetList", "Blob.GetAll" operations. Here an example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;// now test the GetDocumentBlobs operation on the note document
    blobs = (Blobs) session.newRequest(GetDocumentBlobs.ID).setInput(note).set(
            "xpath", "files:files").execute();
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;We're going to improve the way we can download blobs in general.&lt;/P&gt;
&lt;P&gt;Thanks for your feedback.&lt;/P&gt;</description>
    <pubDate>Mon, 28 Oct 2013 10:56:25 GMT</pubDate>
    <dc:creator>Vladimir_Pasqui</dc:creator>
    <dc:date>2013-10-28T10:56:25Z</dc:date>
    <item>
      <title>Blob downloading problem with java automation client</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/blob-downloading-problem-with-java-automation-client/m-p/323503#M10504</link>
      <description>&lt;P&gt;I am trying to download all the files (txt, html, pdf, doc, xls, ...) from nuxeo.
To achieve this, I have found "Java automation client". (Hope I have made a good choice?)&lt;/P&gt;
&lt;P&gt;My starting point is the example from the java automation client documentation:
&lt;A href="http://doc.nuxeo.com/display/public/NXDOC/Java+Automation+Client" target="test_blank"&gt;http://doc.nuxeo.com/display/public/NXDOC/Java+Automation+Client&lt;/A&gt;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;P&gt;Getting all the docs:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;     Documents docs = (Documents) session.newRequest("Document.Query").set(
 		"query", "SELECT * FROM Document WHERE ecm:primaryType=\'File\' " +
 		"OR ecm:primaryType=\'Note\'").execute();
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;With an iteration, get every "doc" from "docs" and get its blob:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;     Iterator&amp;lt;Document&amp;gt; it = docs.iterator();
 while (it.hasNext()){
 	Document doc = (Document)it.next();
         String path = doc.getPath();
     	path = URLEncoder.encode(path, "UTF-8");
 	Blob blob = (FileBlob) session.getFile(path);
 	try{
 		InputStream is = blob.getStream();
 		// do something with "is"
 	}catch(Exception e){
 		e.printStackTrace();
 	}
 }
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;But every time, I get the exception:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;Exception in thread "main" java.lang.RuntimeException: Cannot execute {Authorization=Basic QWRtaW5pc3RyYXRvcjpBZG1pbmlzdHJhdG9y}
at org.nuxeo.ecm.automation.client.jaxrs.impl.HttpConnector.execute(HttpConnector.java:122)
at org.nuxeo.ecm.automation.client.jaxrs.spi.ConnectorHandler.execute(ConnectorHandler.java:30)
at org.nuxeo.ecm.automation.client.jaxrs.spi.DefaultSession.getFile(DefaultSession.java:127)
at Extract.main(Extract.java:79)
Caused by: java.lang.NullPointerException
at org.nuxeo.ecm.automation.client.RemoteException.extractInfo(RemoteException.java:61)
at org.nuxeo.ecm.automation.client.RemoteException.&amp;lt;init&amp;gt;(RemoteException.java:38)
at org.nuxeo.ecm.automation.client.jaxrs.impl.HttpConnector.execute(HttpConnector.java:145)
at org.nuxeo.ecm.automation.client.jaxrs.impl.HttpConnector.execute(HttpConnector.java:118)
... 3 more
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I have spent already 2 days on this, and I am making little progress. Please help!!!
thanks in advance!!!&lt;/P&gt;</description>
      <pubDate>Sat, 26 Oct 2013 02:29:51 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/blob-downloading-problem-with-java-automation-client/m-p/323503#M10504</guid>
      <dc:creator>murataht_</dc:creator>
      <dc:date>2013-10-26T02:29:51Z</dc:date>
    </item>
    <item>
      <title>Re: Blob downloading problem with java automation client</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/blob-downloading-problem-with-java-automation-client/m-p/323504#M10505</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;There are ways to download blobs with Nuxeo automation client:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;// Retrieve document note with full schemas - or using Query operation with doc listing
    note = (Document) session.newRequest(DocumentService.FetchDocument).setHeader(
            Constants.HEADER_NX_SCHEMAS, "*").set("value",
            "/path/path").execute();

    PropertyList list = note.getProperties().getList("files:files");

    PropertyMap map = list.getMap(0).getMap("file");
    assertEquals(filename1, map.getString("name"));
    assertEquals("text/xml", map.getString("mime-type"));

    // get the data URL
    String path = map.getString("data");
    blob = (FileBlob) session.getFile(path);

    // the same for the second file
    map = list.getMap(1).getMap("file");
    assertEquals(filename2, map.getString("name"));
    assertEquals("text/xml", map.getString("mime-type"));

    // get the data URL
    path = map.getString("data");
    blob = (FileBlob) session.getFile(path);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can have several informations on download blobs url pattern here: &lt;A href="http://doc.nuxeo.com/display/NXDOC/Downloading+Files" target="test_blank"&gt;http://doc.nuxeo.com/display/NXDOC/Downloading+Files&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Another way is to use "Blob.Get", "Blob.GetList", "Blob.GetAll" operations. Here an example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;// now test the GetDocumentBlobs operation on the note document
    blobs = (Blobs) session.newRequest(GetDocumentBlobs.ID).setInput(note).set(
            "xpath", "files:files").execute();
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;We're going to improve the way we can download blobs in general.&lt;/P&gt;
&lt;P&gt;Thanks for your feedback.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Oct 2013 10:56:25 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/blob-downloading-problem-with-java-automation-client/m-p/323504#M10505</guid>
      <dc:creator>Vladimir_Pasqui</dc:creator>
      <dc:date>2013-10-28T10:56:25Z</dc:date>
    </item>
    <item>
      <title>Re: Blob downloading problem with java automation client</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/blob-downloading-problem-with-java-automation-client/m-p/323505#M10506</link>
      <description>&lt;P&gt;thanks for your answer!!! i will let you about the results.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Oct 2013 11:22:09 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/blob-downloading-problem-with-java-automation-client/m-p/323505#M10506</guid>
      <dc:creator>murataht_</dc:creator>
      <dc:date>2013-10-28T11:22:09Z</dc:date>
    </item>
    <item>
      <title>Re: Blob downloading problem with java automation client</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/blob-downloading-problem-with-java-automation-client/m-p/323506#M10507</link>
      <description>&lt;P&gt;I tried the two methods. Bun in both methods, the "PropertyMap" I got was always null. So all I got was an exception, at the end.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Oct 2013 11:03:45 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/blob-downloading-problem-with-java-automation-client/m-p/323506#M10507</guid>
      <dc:creator>murataht_</dc:creator>
      <dc:date>2013-10-29T11:03:45Z</dc:date>
    </item>
    <item>
      <title>Re: Blob downloading problem with java automation client</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/blob-downloading-problem-with-java-automation-client/m-p/323507#M10508</link>
      <description>&lt;P&gt;@murataht this is not a forum, please don't post questions in the Answers section. Ask another question or update your original question or add a comment to it.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Oct 2013 15:24:20 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/blob-downloading-problem-with-java-automation-client/m-p/323507#M10508</guid>
      <dc:creator>Florent_Guillau</dc:creator>
      <dc:date>2013-10-29T15:24:20Z</dc:date>
    </item>
  </channel>
</rss>

