Can I obtain and download a file from source control if I have the URL using a state transition or save on a work item?

Hi,
I have a work item type called A and this contains a field which is a URL to a file in source control within RTC.
Is it possible (via a plugin or other mechanism) to extract (copy) this file and publish to a location such as C:\
This would be triggered on SAVE or STATE CHANGE of a work item.
Thanks!
2 answers

I am writing a server participant where the output location is C:\output (for example).
Do you know of any examples of downloading a file from a URL via a server side (participant)?
eg URL =
https://localhost:7443/jazz/web/projects/JP2047#action=com.ibm.team.scm.viewChangeSetItem&contextItemId=&contextItemType=com.ibm.team.scm.Workspace&componentItemId=_TxNZICI0EeW-mdsed6wq4A&itemType=com.ibm.team.filesystem.FileItem&itemId=_QegBcC9JEeW6da1zRid3Tw&stateId=_Qen9RC9JEeW6da1zRid3Tw
When clicking on the Download link, the URL becomes:
https://localhost:7443/jazz/service/com.ibm.team.filesystem.service.internal.rest.IFilesystemContentService/-/_TxNZICI0EeW-mdsed6wq4A/README.doc?itemId=_QegBcC9JEeW6da1zRid3Tw&stateId=_Qen9RC9JEeW6da1zRid3Tw&platformLineDelimiter=CRLF
Using the values obtained from the URL.....
String componentItemID_String = "_TxNZICI0EeW-mdsed6wq4A";
String itemID_String = "_XK9kUC9HEeW6da1zRid3Tw";
String stateID_String = "_Qen9RC9JEeW6da1zRid3Tw";
// createItemHandle(Item ID, State ID)
IItemHandle itemHandle = IComponent.ITEM_TYPE.createItemHandle(UUID.valueOf(itemID_String), UUID.valueOf(stateID_String));
???
How to get the file content?
Thanks!
Comments

All examples are in my blog. There is no server side extension that downloads a file. Download is typically also something that is in the client API. You will have to find out if that is possible on your own.
Please note that for security reasons, the application container also typically limits where a WEB application can write on disk.