Expand Shortened Link using Java

By Abhijit Ghosh on Oct 22, 2013 11:32:36 AM

Nowadays we use different URL shortening services (like bit.ly, TinyURL, Google URL Shortener etc.) to shorten long URL to fit in micro-blogging sites (like Twitter), to beautify a link, view analytics on link clicks, make a link manageable for sharing (in SMS or printed hard copy, book, magazine etc.) or obscure the underlying address. But large portion of shortened links are used just to disguise spam or bad-sites containing malware, spyware, XSS attacks etc. So for safe browsing, sometimes revealing the destination of shortened link is necessary too.

Here, we'll discuss one programmatic approach (using java.net.HttpURLConnection) to expand shortened links.


About this 'Hello World' site

This site is mainly developed to share coding and technology learning experiences on java / j2ee based technologies.

Simple tutorials / codes have been shared to learn a new technology. Full source code is also available for download.