Child: [r4] (diff)

Download this file

Test.java    62 lines (50 with data), 2.0 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/**
* SPDXVersion: SPDX-1.1 Creator: Person: Nuno Brito (nuno.brito@triplecheck.de)
* Creator: Organization: TripleCheck (http://triplecheck.de) Created:
* 2013-12-08T00:00:00Z LicenseName: NOASSERTION FileName: Test.java FileType:
* SOURCE FileCopyrightText: <text> Copyright (c) 2013 Nuno Brito, TripleCheck
* </text>
* FileComment: <text> </text>
*/
package main;
/**
*
* @author Nuno Brito, 8th of December 2013 in Darmstadt, Germany.
*/
public class Test {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
String test = utils.html.redirect("/basic/status", 0);
//System.out.println(test);
String URL = "";
String delay = "";
String beacon = "http-equiv=\"refresh\"";
String beacon2 = "content=\"";
String beacon3 = "url=";
String text = test.toLowerCase();
if(text.contains(beacon)){
// get the beginning of the text
int pos1 = text.indexOf(beacon);
String s1 = text.substring(pos1 + beacon.length());
int pos2 = s1.indexOf(beacon3);
int pos3 = s1.indexOf("\">");
String s2 = s1.substring(pos2 + beacon3.length(), pos3);
// // get the beginning of the text
// int pos1 = text.indexOf(beacon);
// String s1 = text.substring(pos1 + beacon.length());
// // get the delay
// int pos2 = s1.indexOf(beacon2);
// String s2 = s1.substring(pos2 + beacon2.length());
// int pos3 = s2.indexOf(";");
// delay = s2.substring(0, pos3);
// // get the URL
// pos1 = s2.indexOf(beacon3);
// pos2 = s2.indexOf("\">");
// URL = s2.substring(pos1 + beacon3.length(), pos2);
System.out.println(delay +"->" + URL + "\n" + s2);
}
}
}