Page tree
Skip to end of metadata
Go to start of metadata

 

The org.opencode4workspace.endpoints.FilePostToSpaceEndpoint is used to post a file to a Space and retrieve a FileResponse object corresponding to a successful posting.

The FilePostToSpaceEndpoint is instantiated, like the other endpoints, by passing in the WWClient for the request. The message is posted using the postFile(File file, String spaceId) method. There is an overloaded method applicable for posting images, postFile(File file, String spaceId, String imageSize). Alternatively, the WWClient.postFileToSpace(File file, String spaceId) and WWClient.postFileToSpace(File file, String spaceId, String imageSize) helper methods are available for easier use.

If the posting is successful, a FileResponse object is returned comprising the String id of the file, the String name of the file, the int size of the file in bytes, a Map of URLs for the file (metadata, no-redirect download, and redirect download), the Long created timestamp, the String id of the creator and the String contentType of the file.

Examples

postFile
File file = new File("C:/Temp/test.doc");
FileResponse response = client.postFileToSpace(file, spaceId);
assert (!"".equals(response.getName()));
assert (appId.equals(response.getCreatedBy()));
postPhoto
File photo = new File("C:/Temp/testPhoto.jpg");
FileResponse response = client.postFileToSpace(photo, spaceId, "50x50");
assert (!"".equals(response.getName()));
assert (appId.equals(response.getCreatedBy())) 

 

 

3 Comments

  1. Anonymous

    This article on post file is useful.Thanks for the post. Awesome guide for beginners. All the points you mentioned are correct. Write post which provides useful, quality, inspiring information which makes your blog a vital.Thanks. I can use any tips in order to write a better blog post as this is always a challenge.Very good information. The methods are really working. I like your article. Keep sharing more article in future.You can visit best essay writing service for any kind of essay writing assignment.

  2. Anonymous

    This Was A Great And Interesting Article To Read. I Have Really Enjoyed All Of This Very Cool Information Pay Me To Do Homework

  3. Anonymous

    Hi Buddy, Your Blog' S Design Is Simple And Clean And I Like It. Your Blog Posts About Online Dissertation Help Are Superb. Please Keep Them Coming. Greets!! Dissertation Help

Write a comment…