KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > TryIt


1 /*********************************************
2      (c) 2001/2002 by Daniel Matuschek
3  *********************************************/

4
5 import java.net.URL JavaDoc;
6 import java.util.Random JavaDoc;
7
8 import javax.swing.text.html.HTMLDocument JavaDoc;
9
10 import net.matuschek.html.HtmlDocument;
11 import net.matuschek.http.HttpConstants;
12 import net.matuschek.http.HttpDoc;
13 import net.matuschek.http.HttpTool;
14
15 import org.apache.log4j.BasicConfigurator;
16
17 /**
18  * TryIt.java
19  * Created: Wed Feb 21 18:38:00 2001
20  *
21  * temporary class to try new developed things
22  *
23  * @author Daniel Matuschek
24  * @version $Revision: 1.19 $
25  */

26
27
28
29
30 public class TryIt {
31
32   static Random JavaDoc rand = new Random JavaDoc();
33
34   public static String JavaDoc randomString() {
35     Integer JavaDoc i = new Integer JavaDoc(rand.nextInt(20000));
36     return i.toString();
37   }
38   
39   public static void main(String JavaDoc[] args)
40     throws Exception JavaDoc
41   {
42     BasicConfigurator.configure();
43     
44     HttpTool tool = new HttpTool();
45     HttpDoc doc = tool.retrieveDocument(new URL JavaDoc("http://usul27:a1rrakis@www.atkpremium.com/members/styles/standard/pages/index.php?thispage=modelupdate&thisupdate=083735&thismodel=len004"),
46                     HttpConstants.GET,null);
47     HtmlDocument html=new HtmlDocument(new URL JavaDoc("http://localhost"), doc.getContent());
48     for (URL JavaDoc u: html.getLinks()) {
49         System.out.println(u);
50     }
51     
52     // System.out.println(doc);
53
}
54   
55 } // TryIt
56
Popular Tags