hi mike, i understand you perfectly and what you said makes sense. the problem is that, without followRedirects set to true, the URL I got from httpPostMethod.getURI().toString() (httpPostMethod is an instance of PostMethod) is the same as the one I pass to the PostMethod constructor while creating httpPostMethod. In other words:
String url1 = "http://..."; PostMethod httpPostMethod = new PostMethod(url1); httpPostMethod.addParameter("...", "..."); httpClient.executeMethod(httpPostMethod); String url2a = httpPostMethod.getURI().toString(); url1 is equal to url2, and I need to obtain the *redirected* url2. Any tip? Thank you again, <[EMAIL PROTECTED] /> On Tue, 2003-08-26 at 18:49, Michael Becke wrote: > Hi Santos, > > There's no way to make PostMethod automatically redirect, other than > subclassing and overriding setFollowRedirects(). > > I question if this is what you want though. Generally a redirect on > post indicates that the post succeeded and that the response is to be > read from the redirected page. So you would perform a POST to > http://somehost/form and be redirected to http://somehost/response. You > would then want to do a GET on http://somehost/response. > > In either case it is also possible to handle the redirect manually by > checking the response code and getting the location header. > > Mike > > Santos wrote: > > > Hi all, > > > > I writing to ask you if there's any chance to setFollowRedirects(true) > > to an instance of PostMethod. I've read in the source that "Entity > > enclosing requests cannot be redirected without user intervention", but > > I really need a way to get around this limitation. I know that this is > > probably due to the HTTP POST spec itself, but I need to invoke an HTTP > > POST that performs redirection. > > > > Thank you, > > <[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] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
