unreadable text after upload a XXX.txe file
-------------------------------------------
Key: ABDERA-292
URL: https://issues.apache.org/jira/browse/ABDERA-292
Project: Abdera
Issue Type: Bug
Affects Versions: 0.4.0, 0.3.0
Reporter: liuyanyan
private AlfrescoResponse uploadFile(FileInputStream inputStream, String
fileName, String description, String mimeType, String destinationFolder) {
// Build the input Atom Entry
Abdera abdera = new Abdera();
Entry entry = abdera.newEntry();
entry.setTitle(fileName);
entry.setSummary(description);
entry.setContent(inputStream, mimeType);
ExtensibleElement objElement = (ExtensibleElement)
entry.addExtension(NS_CMIS_CORE, "object", CMIS);
ExtensibleElement propsElement = objElement.addExtension(NS_CMIS_CORE,
"properties", CMIS);
ExtensibleElement stringElement =
propsElement.addExtension(NS_CMIS_CORE, "propertyId", CMIS);
stringElement.setAttributeValue("cmis:name", "ObjectTypeId");
Element valueElement = stringElement.addExtension(NS_CMIS_CORE,
"value", CMIS);
valueElement.setText("document"); // This could be changed as an input
parameter
AbderaClient client = new AbderaClient();
// Authentication header
String encodedCredential = Base64Coder.encodeString((username + ":" +
password));
RequestOptions options = new RequestOptions();
options.setHeader("Authorization", "Basic " + encodedCredential);
String uri = server + "/alfresco/s/cmis/p" + destinationFolder +
"/children";
if (LOGGER.isLoggable(Level.INFO)) {
LOGGER.info("POST " + uri);
}
ClientResponse clientResponse = client.post(uri, entry, options);
AlfrescoResponse alfResponse =
parseResponseWithDocument(clientResponse);
clientResponse.release();
return alfResponse;
}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira