When i upload images to Nuxeo, there is no preview
Hi As the creation of document is 3 step process. I am having two different apis- Batch Creation and Create metadata(document) ——> Wrapper on nuxeo created with spring rest template and uploading image in 2nd step directly to nuxeo with out wrapper——>working fine.
I am also having another api which does all 3 steps in one method in wrapper java sdk But then the image is not visible. and getting “picture:info”: {
"colorSpace": null,
"depth": null,
"width": null,
"format": null,
"height": null
}, in response
For reference attaching two responses and code for uploading image:- //sending file as form data using postman public HttpResponse upload(String url, String fileName, String caseId, MultipartFile file, String batchId,
int index, HttpHeaders headers) {
File tmpFile = null;
try {
HttpClient httpclient = HttpClientBuilder.create().build();
HttpPost httppost = new HttpPost(url);
for (Map.Entry<String, List<String>> header : headers.entrySet()) {
if (header.getKey().equalsIgnoreCase("Content-Length")) {
continue;
}
httppost.setHeader(header.getKey(), header.getValue().get(0));
}
httppost.setHeader(DmsConstants.CONTENT_TYPE, MediaType.APPLICATION_OCTET_STREAM_VALUE);
//Writing multi-part file in temporary file
tmpFile = new File(fileName + "_" + caseId + "_" + UUID.randomUUID().toString()); //UUID added so two requests do not over-write same file
file.transferTo(tmpFile);
httppost.setHeader(DmsConstants.X_FILE_NAME, tmpFile.getName());
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);
builder.addBinaryBody("file", tmpFile, ContentType.DEFAULT_BINARY, tmpFile.getName());
//
HttpEntity entity = builder.build();
httppost.setEntity(entity);
// execute the request
HttpResponse response = httpclient.execute(httppost);
LOGGER.info("response from upload file: {}", response);
return response;
}