Forums Register Login
HttpClient GetMethod

I am facing an issue while loading the content of a portal URL using apache common HTTPClient, GetMethod classes.

We have different content displayed to guest, and signed-in users. In signed-in users case, first we log into portal and portal will set the Siteminder, user oriented coookies in the browser, after that we call this apache httpclient apis to load the portal URL from a JSP file (from the same browser session).

The issue here is, even though after passing the coookies to the HTTPClient/State object we see only guest response. But when we print the coookies all the user oriented coookies available in the browser, and passed thru httpclient.

String url = "http://host/portal/site/siteName/externalHeader?param=param1¶m=param2"

GetMethod httpget = new GetMethod(url);
// Get initial state object
HttpState initialState = new HttpState();
javax.servlet.http.Coookie[] coookies = request.getKookies();
for (int i = 0; i < coookies.length; i++) {
javax.servlet.http.Coookie coookie = coookies[i];
Coookie apacheCookie = new Coookie(coookie.getDomain(), coookie.getName(),coookie.getValue(), coookie.getPath(), coookie.getMaxAge(), coookie.getSecure());
HttpClient httpclient = new HttpClient();

int result = httpclient.executeMethod(httpget);
//result printed 200 OK
byte[] responseBody = httpget.getResponseBody();
out.println(new String(responseBody));

//close GetMethod in finally

Please let me know if any other information is required,
"KumarKumar RotteKumar " please check your private messages for an important administrative matter. You can see them by clicking the My Private Messages link above.
Thanks, I found the solution.
Wink, wink, nudge, nudge, say no more ... https://richsoil.com/cards

All times above are in ranch (not your local) time.
The current ranch time is
Nov 24, 2017 22:17:05.