Thanks Oleg,
I'll try all of your suggestions. But what's the theory - why the app hangs with no response? Again, the taget form will trigger redirect to the original protected target Bob -----Original Message----- From: Oleg Kalnichevski [mailto:[EMAIL PROTECTED] Sent: Friday, March 18, 2005 2:41 PM To: HttpClient User Discussion Subject: RE: HttpClient and SiteMinder On Fri, 2005-03-18 at 11:00 -0800, Stone, Robert wrote: > Oh, yeah, another thing. When it goes to limbo it completely ignores the > timeout settings, Well, I seriously doubt that is the case. Please make sure that you set a socket timeout (not to be confused with connection timeout or connection manager timeout). Judging by the code snippet you have posted you seem to set connection manager timeout only. Oleg > 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] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
