How to upload a file into Jazz repository ?
![]()
Hi,
I am extending the Jazz repository and one of the data items I need to store is file attachments. I have modeled the file contents as "Content" in my ecore. I am using TeamModelledService, to expose the get/post operations on the extended data-store. From the browser side, I would be using post with enctype = multipart/form-data. Could someone please guide me as to how I would need to implement this on server side ? Thanks - Vibha |
2 answers
![]()
To handle the file upload, you can create a new TeamRawService that handles the form POST data. When you receive the data, you will need to:
1) Find the item that the data will be attached to 2) Create a new IContent object using the IContentService with the uploaded data 3) Create a working copy of your item 4) Attach the content to the working copy 5) Save the new item state The LicenseUploadService does something similar (though it doesn't create and save content). You can use that service as a starting point for how to handle the form POST request. |
![]()
You could also take a look at AttachmentRestService in the com.ibm.team.workitem.service plug-in which does the same for work item attachments.
Christof Jazz Work Item team lavinm wrote: To handle the file upload, you can create a new TeamRawService that |