A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Java in General
Extract absolute URL from Relative
Joined: Oct 05, 2005
Jan 25, 2010 06:01:04
I am using Apache HTTPClient. I need to get the absolute path from the relative image src urls.
Is there any apis in Apache HTTPs?
For ex: if you do google in IE view source logo will display the relative path. If you right click -> properities it is showing the absoulte path.
Joined: Oct 27, 2005
Jan 25, 2010 07:29:51
Use the URL constructor that takes a base URL. For instance:
URL base = new URL("http://www.coderanch.com/"); URL thread = new URL(base, "/t/480096/Java-General/java/Extract-absolute-URL-from-Relative"); System.out.println(thread);
If you don't have the base URL then there is nothing you can do though. After all, relative to what?
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions
How To Answer Questions
I agree. Here's the link:
subject: Extract absolute URL from Relative
Absolute path , Relative Path
doubt on absolute path and relative path
plz help me
relative and absolute path
Not able to find a File in servlet
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013