HttpURLConnection based rest_v2 GET cookie based authentication erro

I am using a HttpURLConnection  (con) object and trying to  do:  con.setRequestProperty("Cookie", cookie); [Note: cookie is a plain string that I got from a different method written to return cookie in the prescribed format as a string like $Version=0; JSESSIONID=5598BB8D8B4F2F69A3D8AA16677EE534; $Path=/jasperserver-pro]

Constantly hitting 403 error :(

Any pointers will be really helpful.

devopam.mittra's picture
Joined: Jul 8 2013 - 5:05am
Last seen: 7 years 11 months ago

2 Answers:

I was able to resolve the same. Problem : I was also trying to put the "Cookie: " in front of $Version, while trying to set the cookie via setRequestProperty

devopam.mittra's picture
Joined: Jul 8 2013 - 5:05am
Last seen: 7 years 11 months ago

Actually the jaspersessionid value should be set in the header of the request, not as a property. Also, I'm writting COOKIE instead of Cookie, and I don't use the $Version property, and I don't use the '$' character before the 'Path' property.

felipegdr's picture
108
Joined: Apr 20 2012 - 3:51am
Last seen: 6 years 5 months ago
Feedback
randomness