Uploading file to nuxeoserver from android
Hi All, While uploading file from Android using “nuxeo-Android-Connector” i'm getting Exception like “Binary request are not supported“. I'm resceiving this exception from defaultsession.java file of nuxeo-android-connector package. i'm using “Nuxeo Android simple client project” Please help me for solving the issue.
Hi Ravi,
did you find your answer? I encounter same issue during picture attachement. I try this code below without success and don't undestand storeAndUpload attributes.
Did you solve it for you?
Document imageDoc = documentMgr.createDocument(pictureBook, "Picture", "test");
FileUploader uploader = session.getAdapter(FileUploader.class);
uploader.storeAndUpload("BID", "1", fb, new AsyncCallback<Serializable>() {
@Override
public void onSuccess(String executionId, Serializable data) {
Log.i(TAG, "success");
}
@Override
public void onError(String executionId, Throwable e) {
Log.i(TAG, "errdroior");
}
});
Doc Url is : http://doc.nuxeo.com/x/GoWE
i'll try to check the build, but the code you need is inside nuxeo-android-connector.
Tiry
I'm trying to create session with respective credentials as below but it is returning the session as null ,
NuxeoContext nc=NuxeoContextFactory.getNuxeoContext(getApplicationContext());
AndroidAutomationClient aclient=nc.getNuxeoClient();
String url="http://localhost:8080/nuxeo/site/automation";
aclient.setBasicAuth("Username", "password");
Context androidContext=aclient.getAndroidContext();
SQLStateManager sqlStateManager=aclient.getSqlStateManager();
BlobStoreManager blobStoreManager=aclient.getBlobStoreManager();
NuxeoNetworkStatus networkStatus=aclient.getNetworkStatus();
NuxeoServerConfig serverConfig=aclient.getServerConfig();
aclient=new AndroidAutomationClient(url,androidContext,sqlStateManager,blobStoreManager,networkStatus,serverConfig);
Session session1=aclient.getSession("Username", "password");
Connector client1=aclient.getConnector();
I was doing the above to create object for FileUploader.java class which has constructor of "AndroidAutomationClient" as below public FileUploader(AndroidAutomationClient client) {
store = client.getBlobStoreManager().getBlobStore("upload");
this.client = client;
}
can you suggest me feasible way to achive…FileUploading… Thank you very much..
Document doc = (Document) session.newRequest("Document.Create").setInput(docc).set("type", "File").set("name", "uploadfile").set("properties", "dc:title="+filename).execute();
session.newRequest("Blob.Attach").
setHeader(Constants.HEADER_NX_VOIDOP, "true")
.setInput(fb)
.set("document", doc).execute();
in the first line file will be created in the second line the exception will be thrown as "Binary request are not supported".
Hi,
The BlobWidgetWrapper is part of the nuxeo-android-connector.
There is some documentation about the principles here, but for your specific question the best solution is probably to take a look at the sample code.
=> build nuxeo-android-connector, nuxeo-android-connector-ui and nuxeo-android-sample
you have everything demonstrated inside the sample :
- view a document
- edit a document (including blob upload)
- manage caching
- …
Tiry
I was trying to use FileUploader.java from Nuxeo connector but I did not get succeed in creating session using "AndroidAutomationClient".
Hi,
You should have a look at the sample application. Post (binary upload) is supported, but not via a direct Automation call.
There are mainly 2 reasons for that :
- Android SDK does not provide native support for Multipart encoding (and I was too lazy to rewrite one)
- Putting all binary data in the same request may not be very effective from a network point of view ( at least from a mobile device)
That's why in the sample client and application, the binary resources are uploaded separately and simply referenced in the Automation call. This means the cinematic is :
- you do simple Http Post on /automation/batch/upload for each file
- you call the automation operation using the batchId used for upload
You can take a look at BlobWidgetWrapper that is used to have a file upload widget.
Hope this helps.
Tiry
Could you give more details: which version of the Nuxeo server do you use? Did you build the code from the master branch or did you download an already built APK (if so, from where)?
You seem to use nuxeo-android (Nuxeo Android simple client project) which is a deprecated sample, you should use nuxeo-automation-sample (Nuxeo Android sample client for Nuxeo automation).
Also, do you have some development skills in Android?<br/>Do you aim to customize the sample application, to develop your own application based on the Nuxeo SDK for Android or were you looking for a ready-to-use application?
Regards