how-to obtain attachment data via OSLC
I'm trying to write a utility to fix-up work items after a export->import migration from one RTC system to another. But when I process attachments I am unable to obtain the actual attachment data (re: <rtc_cm> ) via the obtained rdf:resource reference.
When I do a get on the rdf:resource URI instead of the content data, I get HTML with the text:
"You have followed a direct link to content hosted in a Jazz server. This page has been presented to ensure that a malicious website cannot use cleverly crafted content to circumvent security. If you would like to access the content, please use the link below."
Anyone know what I maybe doing wrong or a way around the injected HTML?
Thanks in advance!
When I do a get on the rdf:resource URI instead of the content data, I get HTML with the text:
Anyone know what I maybe doing wrong or a way around the injected HTML?
public String getAttachmentDataByReference( TeamConcertRepository repo, WorkItemAttachment wia )
{
StringBuffer data = new StringBuffer( ">>>no data retreived<<<" );
String dataReference = wia.getContentReference();
GetMethod method = new GetMethod( dataReference );
method.addRequestHeader( "Accept", wia.getFormat() );
method.addRequestHeader( "Content-type", wia.getFormat() );
method.setFollowRedirects( true );
int statusCode;
try
{
statusCode = repo.getClient().executeMethod( method );
System.err.println( "status from get is[" + statusCode + "]" );
InputStream stream = method.getResponseBodyAsStream();
.
.
.
Thanks in advance!
One answer
As far as I am aware, there is no officially supported and documented way to download attachments with OSLC/REST. We had the situation several times in the past and the developers suggested to use the API instead as described here: https://rsjazz.wordpress.com/2012/09/21/downloading-attachments-from-work-items/
Having said that, I am aware some users have traced the communication during a download and were able to rebuild the mechanism.
Having said that, I am aware some users have traced the communication during a download and were able to rebuild the mechanism.
Comments
Mike Shkolnik
Nov 07 '13, 6:55 p.m.Scott, did you ever get this problem resolved? I am getting the same error.
Scott Russell
Nov 11 '13, 10:39 a.m.I personally never found a way but right after we did our migration I was in contact with someone who said they were able to do it. They added: