?
Solved

relative links

Posted on 2005-04-11
3
Medium Priority
?
233 Views
Last Modified: 2010-03-31
Hi,

I am trying to extract links from webpages. I need a solution to convert the relative links to absolute links so that they can also be followed.

Any code is appreciated. I am doing this in java.

Thanks.
0
Comment
Question by:sumantedla
  • 2
3 Comments
 
LVL 4

Expert Comment

by:danny_ebbers
ID: 13756714
Hi sumantedla,

Here you go: http://javaalmanac.com/egs/java.io/GetAbs.html?l=rel

Best regards,
Danny Ebbers
0
 

Author Comment

by:sumantedla
ID: 13756773
But how can i do that for links in webpages. When I extract the urls in a webpage, some of them are relative and someof them are absolute. I want to make the relative links absolute so that they can also be visited by connecting to that page.
0
 
LVL 4

Accepted Solution

by:
danny_ebbers earned 2000 total points
ID: 13756906
sumantedla,

Converting and URL from relative to absolute , you need to know the BASEURL, if you know the base url
you could use the URL object

you can do this in various ways:
here it will show you some samples: http://xarch.tu-graz.ac.at/publ/tutorial/java/tutorials/5120/Java554.htm
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses
Course of the Month16 days, 8 hours left to enroll

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question