You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@abdera.apache.org by "liuyanyan (Updated) (JIRA)" <ji...@apache.org> on 2011/11/04 03:27:32 UTC

[jira] [Updated] (ABDERA-292) unreadable text after upload a XXX.txt file

     [ https://issues.apache.org/jira/browse/ABDERA-292?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

liuyanyan updated ABDERA-292:
-----------------------------

    Summary: unreadable text after upload a XXX.txt file  (was: unreadable text after upload a XXX.txe file)
    
> unreadable text after upload a XXX.txt file
> -------------------------------------------
>
>                 Key: ABDERA-292
>                 URL: https://issues.apache.org/jira/browse/ABDERA-292
>             Project: Abdera
>          Issue Type: Bug
>    Affects Versions: 0.3.0, 0.4.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