Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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?


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!

0 votes

Comments

Scott, did you ever get this problem resolved? I am getting the same error.

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:

addHeader("X-Jazz-CSRF-Prevent", holyGrail);

where holyGrail = the session id in your JSESSIONID. 



One answer

Permanent link
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.

0 votes

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,938

Question asked: Sep 07 '11, 3:14 p.m.

Question was seen: 6,648 times

Last updated: Nov 11 '13, 10:39 a.m.

Confirmation Cancel Confirm