I'm writing a program that will download pfd files and collate them. However the urls I get are a bit weird. They look like this:
http://links.ealert.nature.com/ctt?kn=105&m=34136651&r=MjA1NzczMzM4NgS2&b=0&j=NTkwOTY5NjQS1&mt=1&rt=0
I'm using URLConnection and BufferedInputStream, but no data is read from the stream (read() returns -1 at the first try). If they are embedded in a webpage like this:
<a href="http://links.ealert.nature.com/ctt?kn=105&m=34136651&r=MjA1NzczMzM4NgS2&b=0&j=NTkwOTY5NjQS1&mt=1&rt=0">pdf</a>
then the browser resolves this url to a direct url:
http://www.nature.com/nature/journal/v461/n7265/pdf/461697a.pdf
How can I do it in a Java program? I suspect there's some sort of link server involved there, but I don't know how to communicate with it.