Add server executer based on htmlunit.

This commit is contained in:
Jason A. Donenfeld
2011-05-09 07:00:06 -04:00
parent 205fcbef01
commit a57aa30957
22 changed files with 31 additions and 1 deletions

1
web/utils/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.class

View File

@ -0,0 +1,19 @@
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
public class ServerExecute {
public static void main(String[] args) {
if (args.length != 1) {
System.err.println("You must give a url as an argument.");
return;
}
try {
final WebClient webClient = new WebClient();
HtmlPage page = webClient.getPage(args[0]);
webClient.waitForBackgroundJavaScript(2000);
System.out.println(page.asXml());
} catch (Exception e) {
e.printStackTrace();
}
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

3
web/utils/serverexecute Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
cd $(dirname $0)
java -classpath $(for i in htmlunit-2.8/*; do echo $i; done|tr '\n' ':') ServerExecute $@