1

I am trying to replace an existing Community file using the following java

Map<String, String> paramsMap = new HashMap<String, String>();
paramsMap.put("createVersion", "false");
fileEntry = fileService.updateCommunityFile(fis, fileUuid, fileName, communityLibraryId, paramsMap);

But it is returning a HTTP 411:Length required error.

I am using the latest build (1.1.5.20150520-1200.jar)

Does anyone have a suggestion as to what i am missing?

  • add content-length to your headers sent via fileservice – Paul Bastide Jul 02 '15 at 13:46
  • add content-length to your headers sent via fileservice. 411 means there is no content-length. I'll have someone on our dev team look at it. – Paul Bastide Jul 02 '15 at 14:18
  • Thanks for your assistance Paul – Steve Banister Jul 02 '15 at 14:35
  • @Paul, the error shows that Content-Length is already in the header. It now includes the content-length I have added. The error = Request to url https://apps.na.collabserv.com/files/basic/api/library/... /document/... /entry?content-length=6600&createVersion=false returned an error response 411:Length Required HTTP/1.1 411 Length Required [Server: AkamaiGHost, Mime-Version: 1.0, Content-Type: text/html, Content-Length: 221, Expires: Fri, 03 Jul 2015 09:10:14 GMT, Date: Fri, 03 Jul 2015 09:10:14 GMT, Connection: close] – Steve Banister Jul 03 '15 at 09:15
  • still sounds like the content-length is missing. a member of the team will lok at it – Paul Bastide Jul 06 '15 at 00:01

1 Answers1

1

I tried recreating the issue but I am able to upload New version of Community file correctly with and without version, using the updateCommunityFile API. I do not get any Length related error. This is the snippet I am using :

java.io.File file = new java.io.File("C://TestUploadCommunity.txt");
FileInputStream fis = null;
try { 
    fis = new FileInputStream(file);
} catch (Exception e) {
    //TODO
}
fileEntry = fileService.updateCommunityFile(fis, fileEntry.getFileId(), fileEntry.getLabel(), communityLibraryId, params);

Can you share more details on your sample, what exactly is your fis? I have tried this on 2 environments and I do not see any issue.

Also, from the entry you have pasted,

"Request to url apps.na.collabserv.com/files/basic/api/library... /document/... /entry?content-length=6600&createVersion=false returned an error response 411:Length Required HTTP/1.1 411" 

It seems that somehow an incorrect content-length is passed for your request. Can you share the sample that you are using?