Roland, Thanks for the help. That was what I had gathered yesterday by reading the spec but I wasn't sure how to handle it. I now have a better understand and with your suggestion, I think I can get this to work. I'll keep you all posted. Take care, Jeremy
On 9/9/05, Roland Weber <[EMAIL PROTECTED]> wrote: > > Hi Jeremy, > > > If I turn on post redirects, the code doesn't run. > > It's not allowed to run, in compliance with RFC 2616, > sections 10.3.2, 10.3.3 and 10.3.8: > > <quote> > If the 30? status code is received in response to a request other > than GET or HEAD, the user agent MUST NOT automatically redirect the > request unless it can be confirmed by the user, since this might > change the conditions under which the request was issued. > </quote> > > But your application can simply check the response for a > 301, 302 or 307 response code, then read the "Location:" > response header, and generate a followup request. Either > a POST or a GET, as appropriate. Probably a GET. > > hope that helps, > Roland > > > It errors out. When they > > are off, here is the content I get a page from BEA saying that the > resource > > has moved. The HTML is irrelevant so here is the debugging information > from > > the HttpClient logging: > > > > http://www.rafb.net/paste/results/kGUsCS28.html > > > > If I didn't log enough or logged the wrong things, let me know. Other > than > > that...if you see anything I can do differently to get around this > hurdle I > > would be greatly appreciative. Take care and thanks for your help thus > far, > > Jeremy > > > > On 9/8/05, Gustavo Hexsel <[EMAIL PROTECTED]> wrote: > > > > > > I know there is some limitation about POST redirects, which seems to > be > > > the case. But you are in the right path. Have you tried monitoring > which > > > intermediate steps happen after authentication (using Mozilla's tool)? > You > > > should probably disable followsRedirect, see what comes back, and > create > > > another POST step that mimicks that. I could take a look, but you'll > have > > > to send the relevant parts of the wire log (the headers that are > comming > > > back just before the "java.lang.IllegalArgumentException: Entity > enclosing > > > requests cannot be > > > redirected without user intervention"). > > > > > > []s Gus > > > > > > > > > > > > -----Original Message----- > > > From: Jeremy Whitlock [mailto:[EMAIL PROTECTED] > > > Sent: September 8, 2005 5:26 PM > > > To: HttpClient User Discussion > > > Subject: Re: POST Form Session Expired > > > > > > > > > Gustavo, > > > I have already tried this before to get yet another error. But just to > > > > make > > > sure I am doing what you are saying, here is my updated code: > > > > > > http://www.rafb.net/paste/results/1g6i0M37.html > > > > > > Upon running this, I get the following: > > > > > > Sep 8, 2005 5:21:44 PM > > > org.apache.commons.httpclient.HttpMethodDirectorisRedirectNeeded > > > INFO: Redirect requested but followRedirects is disabled > > > > > > I cannot do post.setFollowRedirects(true) because it then complains > about: > > > > > > java.lang.IllegalArgumentException: Entity enclosing requests cannot > be > > > redirected without user intervention > > > at > > > > > > > > org.apache.commons.httpclient.methods.EntityEnclosingMethod.setFollowRedirec > > > ts > > > (EntityEnclosingMethod.java:221) > > > at com.jwhitlock.http.client.HttpClientTutorial.main( > > > HttpClientTutorial.java > > > :192) > > > Exception in thread "main" > > > > > > I've not found a working solution but I'm sure we can figure this out. > > > > Take > > > care, Jeremy > > > > > > On 9/8/05, Gustavo Hexsel <[EMAIL PROTECTED]> wrote: > > > > > > > > About the POST problem, can you post that part of the wire log? > > > > > > > > > > > > > > > > -----Original Message----- > > > > From: Gustavo Hexsel [mailto:[EMAIL PROTECTED] > > > > Sent: September 8, 2005 4:53 PM > > > > To: 'HttpClient User Discussion' > > > > Subject: RE: POST Form Session Expired > > > > > > > > > > > > Cookies. Reuse the HttpClient instance throughout the whole > operation. > > > > > > > > -----Original Message----- > > > > From: Jeremy Whitlock [mailto:[EMAIL PROTECTED] > > > > Sent: September 8, 2005 4:48 PM > > > > To: HttpClient-User > > > > Subject: POST Form Session Expired > > > > > > > > > > > > Hey all, > > > > I am doing a GET on a login form, parsing the form for hidden input > and > > > > then > > > > > > > > creating a POST with NameValuePair objects corresponding to the > hidden > > > > input > > > > > > > > and the two form input fields. I seem to have a minor problem with > my > > > > approach as I always get a "Session Expired" from the server I'm > logging > > > > into. Can someone give me a pseudo flow of how this goes? Here is > the > > > > current code: > > > > > > > > http://www.rafb.net/paste/results/mnOMtY87.html > > > > > > > > Can someone see what I'm doing wrong? I have tried a minor spin on > this > > > > where instead of creating an HttpClient for each method I have a > global > > > > one > > > > but then I get a problem with the POST not being able to redirect. > > > Thanks, > > > > Jeremy > > > > -- > > > > He who listens well, speaks well. > > > > > > > > > --------------------------------------------------------------------- > > > > 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] > > > > > > > > > > > > > > > > > -- > > > He who listens well, speaks well. > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: > [EMAIL PROTECTED] > > > > > > > > > > > > -- > > He who listens well, speaks well. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- He who listens well, speaks well.
