It's all about the answers!

Ask a question

[CLOSED]:OSLC: How to process '|' character in HttpRequest


Timur Markunin (6495156144) | asked Apr 03 '13, 12:59 p.m.
edited Apr 05 '13, 10:50 a.m.
Hello,
I'm trying to get resources allocation info using this URI:
https://clm.local:9443/ccm/rpt/repository/apt?fields=apt/workResourceDetails/(contributor/name|assignment|startDate|endDate)

I observed that while httpClient.execute() returns valid HttpResponse for https://clm.local:9443/ccm/rpt/repository/apt?fields=apt/workResourceDetails/(contributor/name)
it returns bad response for https://clm.local:9443/ccm/rpt/repository/apt?fields=apt/workResourceDetails/(contributor/name|assignment) because I use URLEncoder.encode() in order to make safe HttpGet.

Any ideas?

-thanks in advance

Accepted answer


permanent link
Ralph Schoon (55.5k23642) | answered Apr 05 '13, 2:13 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Timur,

I suspect you need to encode the pipe symbol as any other special symbols, if you want to use them in an URL. I used https://www.google.de/search?q=html+special+characters+pipe+symbol
and found for example http://www.tutorialspoint.com/html/html_url_encoding.htm and http://en.wikipedia.org/wiki/Vertical_bar stating  pipe: 124 7c | %7c So I would try to replace the pipe with %7c.

Timur Markunin selected this answer as the correct answer

Comments
Timur Markunin commented Apr 05 '13, 11:06 a.m.

Hi Ralph,

Thanks a lot for your response!

It was my mistake.

I used:

safeURL = URLEncoder.encode("https://clm.local:9443/ccm/rpt/repository/apt?fields=apt/workResourceDetails/(contributor/name|assignment)" , "UTF-8");

and it didn't work.

I tried:

safeUrl = URLEncoder.encode("|assignment|startDate|endDate)", "UTF-8");
String rootServices = server + "/rpt/repository/apt?fields=apt/workResourceDetails/(contributor/name"  +  safeUrl;

and it works OK.

Your answer


Register or to post your answer.