|Re: [jetty-users] How do you get the final redirect URL from Jetty HttpClient 9.0?|
Hi, On Thu, May 23, 2013 at 10:43 PM, jhwallingford <jhwallingford@xxxxxxxxx> wrote: > If I use HttpClient to do a HTTP GET request for http://myco.com and the > server does a 301 (Moved Perm) to http://www.myco.com, how do I get the > final URL? HttpClient will follow the redirect(s) but when I get the > onComplete with the result I see know way to get the final URL after all > redirects. Is there a way to do this? I introduced HttpRedirector in 9.1 which will help you out for this use case. You still need to do redirects manually, but it's a while loop of few lines. See http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/tree/jetty-client/src/main/java/org/eclipse/jetty/client/HttpRedirector.java?h=jetty-9.1. -- Simone Bordet ---- http://cometd.org http://webtide.com http://intalio.com Developer advice, training, services and support from the Jetty & CometD experts. Intalio, the modern way to build business applications.
Back to the top