Does anybody have a working example of a file upload from a java client 
using a rest call for version 5.3 of Nuxeo?

I must be missing some secret sauce because I have everything else working 
but the file gets rejected because the content-length is not set (although 
from what I have read and seen this should be set by the restlet client 
code).

I'm using the sample NuxeoServer client code to perform the gets and 
posts. It's also used to build the base connection url. doRestletPostCall 
is unchanged from the sample code so I haven't posted it here.

Here's the code I'm using to attach the file. I've hardcoded some of the 
values for testing.

                        try {
                                nxServer.setAuthType(NuxeoServer.
AUTH_TYPE_BASIC);
                                nxServer.setBasicAuthentication(uid, pwd);

                                String restletCall = 
"upload/default/27c7432c-85f9-45e5-9065-9b7832d06d70/test.doc";
                                File myFile = new File("c:/temp/test.doc"
); 
 
                                if (myFile.exists() && myFile.canRead() && 
myFile.length() > 0) {
                                        FileInputStream is = new 
FileInputStream(myFile);
                                        myResult = 
nxServer.doRestletPostCall(restletCall, null, is);
                                }
                                else {
                                        myResult = null;
                                }
                        }
                        catch (Exception e) {
                                System.out.println("Restlet call failed");
                        } 


thanks,
bruce.
--------------------
metaLogic
ph. +1.905.629.7775 x225
fax +1.905.629.9887
http://metaLogic.ca
_______________________________________________
ECM mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm
To unsubscribe, go to http://lists.nuxeo.com/mailman/options/ecm

Reply via email to