File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a license for
this week in the
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 - OCEEJBD 6
How To Ask Questions
How To Answer Questions
It is sorta covered in the
JavaRanch Style Guide
subject: Extract absolute URL from Relative
Not able to find a File in servlet
doubt on absolute path and relative path
plz help me
Absolute path , Relative Path
relative and absolute path
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013