您可以使用 JSoup 读取位置。
真实例子
Connection.Response response = Jsoup
.connect("http://tvnwarszawa.pl/d")
.method(Connection.Method.POST)
.followRedirects(false)
.execute();
System.out.println(response.header("Location"));
Run Code Online (Sandbox Code Playgroud)
输出
http://tvnwarszawa.tvn24.pl/d
Run Code Online (Sandbox Code Playgroud)
阅读有关位置的更多信息:http : //en.wikipedia.org/wiki/HTTP_location
也许您对 url() 感兴趣?
System.out.println(response.url());
Run Code Online (Sandbox Code Playgroud)