更新时间:2021-06-26 23:02:44
我为此找到了解决方案..我扩展了该网址..及其工作原理。 。
I found solution for this .. i expand that URL.. and its working ..
public static String expandUrl(String shortenedUrl) {
URL url;
String expandedURL = "";
try {
url = new URL(shortenedUrl);
// open connection
HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection(Proxy.NO_PROXY);
// stop following browser redirect
httpURLConnection.setInstanceFollowRedirects(false);
// extract location header containing the actual destination URL
expandedURL = httpURLConnection.getHeaderField("Location");
httpURLConnection.disconnect();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return expandedURL;
}