|
From: Wayne <way...@ho...> - 2017-03-30 18:13:48
|
Hi,
I’m new to the alias and this may be an old topic. When I retrieve a page using htmlunit, there are usually some level of redirections. I would like to get the full redirection chain. One suggestion is the overwrite the HttpWebConnection. However, all I have is a WebRequest and WebResponse.
public WebResponse getResponse(WebRequest request) throws IOException {
super(request);
}
I have 2 problems:
1. It’s hard for me to tell if the web request is the original entry page. Or is it from loading a resource in the middle of parsing a non-entry page. I’m missing the “enclosed page” that triggered the http connection.
2. In the response, I could try to parse and get the href. But I wonder if the redirect response is not well formatted, how do I guarantee the href I got is the page the parse is going to visit.
Wonder if anybody has been successful in retrieving the redirect chain.
Thanks a lot.
-Wayne
|