java重定向到另一个页面 JAVA怎么才能获取重定向的地址?

JAVA怎么才能获取重定向的地址?/***获取重定向地址*@param path*@return*@throws exception*/private string getredirecturl(st

JAVA怎么才能获取重定向的地址?

/***获取重定向地址*@param path*@return*@throws exception*/private string getredirecturl(string path)throws exception{httpurlconnection conn=(httpurlconnection)new URL(path)。打开连接()连接设置实例(错误)连接设置连接超时(5000)退货康涅狄格海德菲尔德(“位置“)}