6 public Query(GlobalString hostname, GlobalString path, int depth) {
7 this.hostname = global new GlobalString(hostname);
8 this.path = global new GlobalString(path);
12 public int getDepth() {
16 public GlobalString getHostName() {
20 public GlobalString getPath() {
24 public GlobalString getHostName(GlobalString page) {
25 GlobalString http = global new GlobalString("http://");
26 if (page.indexOf(http) == -1) {
29 int beginindex = page.indexOf(http) + http.length();
30 int endindex = page.indexOf('/',beginindex+1);
31 if ((beginindex == -1)) {
32 System.printString("ERROR");
35 endindex = page.length();
36 return page.subString(beginindex, endindex);
41 public GlobalString getPathName(GlobalString page) {
42 GlobalString http = global new GlobalString("http://");
43 if (page.indexOf(http) == -1) {
44 GlobalString path = getPath();
45 int lastindex = path.lastindexOf('/');
49 GlobalStringBuffer sb = global new GlobalStringBuffer(path.subString(0,lastindex+1));
51 return sb.toGlobalString();
53 int beginindex = page.indexOf(http)+http.length();
54 int nextindex = page.indexOf('/',beginindex+1);
55 if ((beginindex == -1) || (nextindex == -1))
56 return global new GlobalString("index.html");
57 return page.subString(nextindex+1, page.length());