It's all about the answers!

Ask a question

Getting a Rational Team Concert work item as html.

Patrick Bray (11) | asked Feb 16 '17, 3:56 p.m.
edited Feb 17 '17, 12:53 a.m. by Geoffrey Clemm (30.1k23035)

 I can get a printable html version of a Rational Team Concert work item by putting the following URL in my browser:

<o:p> </o:p>

https://<server>:<port>/ccm/resource/itemName/<work item number>?_mediaType=text/html&_selector=hover <o:p> </o:p>

This works fine. I can save the browser contents as an html file and parse the html with JSoup. <o:p> </o:p>

The problem occurs when I try to do a get of the URL in JSoup. Rather than the html I expect I get a “Loading…” page which isn’t visible when it gets rendered it in the browser (it goes by too quickly) but is definitely the first post when I do the get. <o:p> </o:p>

My question is, is there a way to turn off the “Loading…” page or another URL that will allow me to get directly to the html? Having to save this to a file seems like a very clunky step to have to go through. <o:p> </o:p>

<o:p>  RTC Version 6.0.3. </o:p>

<o:p>   </o:p>

<o:p>   </o:p>

One answer

permanent link
Donald Nong (14.4k314) | answered Feb 16 '17, 7:54 p.m.

Before you GET the HTML resource, have you logged on to RTC within JSoup? The only time I see the "Loading..." message is when the log on page needs to be loaded. As far as I can see in the network trace, once logged on, only one request is sent to the server and there is no redirecting.

Why not just use XML format? Adding _mediaType=application/xml in the URL, or add a HTTP header "Accept: application/xml" will give you this. The URL that you currently use shows the Inline Editor presentation of the work item, which may not necessarily contain all the information you  need.

Patrick Bray commented Feb 20 '17, 4:48 p.m.

 Thanks for the answer Donald. I have tried logging in with something equivelent to this:

Document document =
 .data("cookieexists", "false") .data("username", "32007702")
 .data("login", "Login") .cookies(loginForm.cookies()) .post();

But with no luck. I'll continue trying the login route, but so far I still get the "Loading..." page. I'm using the html becuase all I really want to do is modify the html by removing tables. That part works well.

Donald Nong commented Feb 20 '17, 6:18 p.m.

I'm talking about logging in to CCM, not your own application. Whatever the script/application you use, you should have a login sequence similar to the below one.

Your answer

Register or to post your answer.