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?)
My starting point is the example from the java automation client documentation:
http://doc.nuxeo.com/display/public/NXDOC/Java+Automation+Client
Getting all the docs:
Documents docs = (Documents) session.newRequest("Document.Query").set(
"query", "SELECT * FROM Document WHERE ecm:primaryType=\'File\' " +
"OR ecm:primaryType=\'Note\'").execute();
With an iteration, get every "doc" from "docs" and get its blob:
Iterator<Document> 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();
}
}
But every time, I get the exception:
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.<init>(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
I have spent already 2 days on this, and I am making little progress. Please help!!!
thanks in advance!!!