Skip to content

Commit

Permalink
support get content bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
ruan-wei committed Jul 4, 2016
1 parent 4df01bd commit dc04f28
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ public void contentManagement() {
}
printNewLine();

printStep("get the content bytes of the document from the local rest server");
renditionList = client.getContents(createdObjectWithContent, "media-url-policy", "local", "inline", "true");
for(Entry<RestObject> renditionEntry : renditionList.getEntries()) {
System.out.println(renditionEntry.getTitle());
System.out.println("the content media link: " + renditionEntry.getHref(ENCLOSURE));
byte[] bytes = client.getContentBytes(renditionEntry.getHref(ENCLOSURE));
System.out.println(new String(bytes));
}
printNewLine();

printStep("delete the created document");
client.delete(createdObjectWithContent);
printHttpStatus();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,8 @@ public interface DCTMRestClient {
*/
public Feed<RestObject> getContents(RestObject object, String... params);

public byte[] getContentBytes(String uri);

/**
* get users of the repository
* @param params
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,11 @@ public void delete(String uri, String... params) {
sendRequest(uri, DELETE, isXml()?ACCEPT_XML_HEADERS:ACCEPT_JSON_HEADERS, null, null, params);
}

@Override
public byte[] getContentBytes(String uri) {
return get(uri, byte[].class);
}

@Override
public void delete(Linkable linkable, String... params) {
if(linkable.getHref(LinkRelation.DELETE) != null) {
Expand Down

0 comments on commit dc04f28

Please sign in to comment.