Oh, yeah, another thing. When it goes to limbo it completely ignores the timeout settings, I'm actually fine with it timing out and throwing exception that I can catch and do something. Never happens.
Thanks, Robert S. -----Original Message----- From: Stone, Robert [mailto:[EMAIL PROTECTED] Sent: Thursday, March 17, 2005 2:56 PM To: [email protected] Subject: HttpClient and SiteMinder Hi all, I'm trying to execute POST method on SiteMinder login.fcc page. The way it works - when user hits the SM protected page, SM agent intercepts the request and forward is to the login page. That page contains few form fields and has its action set to "<somehost>/sm/forms/login.fcc". I'm trying to do this last POST programmatically using HttpClient Problem is that once I do httpClient.executeMethod(postMethod) I never get response back and program hangs until the session timeout. That, I understand is due to the fact that instead of replying to POST request, SM agent does it thing and redirects to the original targeted page. So what I need is to execute POST method end exit without waiting for the response to come. Is it possible and if yes can someone tell me how to do it? Here's method that will never pass executeMethod line * @param command * @param errors */ public void processLogin(HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) { HttpClientParams params = client.getParams(); params.setParameter(HttpClientParams.ALLOW_CIRCULAR_REDIRECTS, new Boolean(true)); params.setParameter(HttpClientParams.CONNECTION_MANAGER_TIMEOUT, new Long(3000)); params.setParameter(HttpClientParams.REJECT_RELATIVE_REDIRECT, new Boolean(false)); client.setParams(params); UserData userData = (UserData) command; PostMethod post = new PostMethod(smPath); post.addParameter("SMAUTHREASON", "0"); // getting right back at ya post .addParameter("TARGET", "$SM$" + request.getRequestURL().toString()); post.addParameter("USER", userData.getUserName()); post.addParameter("PASSWORD", userData.getUserPassword()); try { if (logger.isInfoEnabled()) logger.info("Making POST request to " + smPath); client.executeMethod(post); post.releaseConnection(); if (logger.isInfoEnabled()) logger.info("Back from executing post"); if (post.getStatusCode() == HttpStatus.SC_OK) { List headers = Arrays.asList(post.getResponseHeaders()); for (Iterator i = headers.iterator(); i.hasNext();) { processResponseHeaders(errors, i); } if (logger.isInfoEnabled()) if (!errors.hasErrors()) logger.info("Successful login for user " + userData.getUserName()); } else { errors.rejectValue("userName", "errors.logging.failed", new String[] { post.getStatusText() }, post .getStatusText()); } } catch (Exception e) { logger.error(e); errors.rejectValue("userName", "errors.logging.final", new String[] { e.getMessage() }, e.getMessage()); } } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
