Tuesday, May 7, 2013

Convert the relative path into absolute url

When we download the image in the website with java, the src in the img is relative, how could we download the image based on this relative?

We can try to convert the relative path into absolute url, then we save the img like writing one file.

 URL pageUrl = new URL(pageurl);
 URL imgurl1 = new URL(pageUrl, relativepath);

No comments:

Post a Comment