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 (Created) (JIRA)" <ji...@apache.org> on 2011/11/03 11:19:32 UTC
[jira] [Created] (ABDERA-292) unreadable text after upload a
XXX.txe file
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
[jira] [Issue Comment Edited] (ABDERA-292) unreadable text after
upload a XXX.txt file
Posted by "liuyanyan (Issue Comment Edited) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/ABDERA-292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13143695#comment-13143695 ]
liuyanyan edited comment on ABDERA-292 at 11/4/11 2:31 AM:
-----------------------------------------------------------
Upload picture is ok. But unreadable codes after upload a *.txt file. The size is 2 byte, but it will be 4byte after uploaded.
Can anyone help me? Thank you in advance!
was (Author: yanyan.liu):
Upload picture is ok. But unreadable codes after upload a *.txt file. The size is 2 byte, but it will be 4byte after uploaded.
Can anyone can help me? Thank you in advance!
> 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
[jira] [Updated] (ABDERA-292) unreadable text after upload a
XXX.txt file
Posted by "liuyanyan (Updated) (JIRA)" <ji...@apache.org>.
[ 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
[jira] [Commented] (ABDERA-292) unreadable text after upload a
XXX.txe file
Posted by "liuyanyan (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/ABDERA-292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13143695#comment-13143695 ]
liuyanyan commented on ABDERA-292:
----------------------------------
Upload picture is ok. But unreadable codes after upload a *.txt file. The size is 2 byte, but it will be 4byte after uploaded.
Can anyone can help me? Thank you in advance!
> 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.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