Add server executer based on htmlunit.
This commit is contained in:
parent
205fcbef01
commit
a57aa30957
@ -12,7 +12,7 @@ CSS_COMPILER = utils/yuicompressor --type css
|
|||||||
|
|
||||||
.PHONY: all clean
|
.PHONY: all clean
|
||||||
|
|
||||||
all: $(JS_MIN) $(CSS_MIN)
|
all: $(JS_MIN) $(CSS_MIN) utils/ServerExecute.class
|
||||||
|
|
||||||
%.min.js: %.js
|
%.min.js: %.js
|
||||||
@echo "Compiling javascript" $<
|
@echo "Compiling javascript" $<
|
||||||
@ -30,6 +30,13 @@ $(CSS_MIN): $(CSS_MIN_FILES)
|
|||||||
@echo "Assembling compiled stylesheets"
|
@echo "Assembling compiled stylesheets"
|
||||||
@cat $^ > $@
|
@cat $^ > $@
|
||||||
|
|
||||||
|
empty :=
|
||||||
|
space := $(empty) $(empty)
|
||||||
|
classpath := $(subst $(space),:,$(wildcard utils/htmlunit-2.8/*.jar))
|
||||||
|
utils/ServerExecute.class: utils/ServerExecute.java
|
||||||
|
@echo "Building HtmlUnit wrapper."
|
||||||
|
@javac -classpath $(classpath) -d utils $^
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@rm -fv $(JS_MIN) $(JS_MIN_FILES) $(CSS_MIN) $(CSS_MIN_FILES)
|
@rm -fv $(JS_MIN) $(JS_MIN_FILES) $(CSS_MIN) $(CSS_MIN_FILES)
|
||||||
|
|
||||||
|
1
web/utils/.gitignore
vendored
Normal file
1
web/utils/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
*.class
|
19
web/utils/ServerExecute.java
Normal file
19
web/utils/ServerExecute.java
Normal 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
BIN
web/utils/htmlunit-2.8/apache-mime4j-0.6.jar
Normal file
BIN
web/utils/htmlunit-2.8/apache-mime4j-0.6.jar
Normal file
Binary file not shown.
BIN
web/utils/htmlunit-2.8/commons-codec-1.4.jar
Normal file
BIN
web/utils/htmlunit-2.8/commons-codec-1.4.jar
Normal file
Binary file not shown.
BIN
web/utils/htmlunit-2.8/commons-collections-3.2.1.jar
Normal file
BIN
web/utils/htmlunit-2.8/commons-collections-3.2.1.jar
Normal file
Binary file not shown.
BIN
web/utils/htmlunit-2.8/commons-io-1.4.jar
Normal file
BIN
web/utils/htmlunit-2.8/commons-io-1.4.jar
Normal file
Binary file not shown.
BIN
web/utils/htmlunit-2.8/commons-lang-2.4.jar
Normal file
BIN
web/utils/htmlunit-2.8/commons-lang-2.4.jar
Normal file
Binary file not shown.
BIN
web/utils/htmlunit-2.8/commons-logging-1.1.1.jar
Normal file
BIN
web/utils/htmlunit-2.8/commons-logging-1.1.1.jar
Normal file
Binary file not shown.
BIN
web/utils/htmlunit-2.8/cssparser-0.9.5.jar
Normal file
BIN
web/utils/htmlunit-2.8/cssparser-0.9.5.jar
Normal file
Binary file not shown.
BIN
web/utils/htmlunit-2.8/htmlunit-2.8.jar
Normal file
BIN
web/utils/htmlunit-2.8/htmlunit-2.8.jar
Normal file
Binary file not shown.
BIN
web/utils/htmlunit-2.8/htmlunit-core-js-2.8.jar
Normal file
BIN
web/utils/htmlunit-2.8/htmlunit-core-js-2.8.jar
Normal file
Binary file not shown.
BIN
web/utils/htmlunit-2.8/httpclient-4.0.1.jar
Normal file
BIN
web/utils/htmlunit-2.8/httpclient-4.0.1.jar
Normal file
Binary file not shown.
BIN
web/utils/htmlunit-2.8/httpcore-4.0.1.jar
Normal file
BIN
web/utils/htmlunit-2.8/httpcore-4.0.1.jar
Normal file
Binary file not shown.
BIN
web/utils/htmlunit-2.8/httpmime-4.0.1.jar
Normal file
BIN
web/utils/htmlunit-2.8/httpmime-4.0.1.jar
Normal file
Binary file not shown.
BIN
web/utils/htmlunit-2.8/nekohtml-1.9.14.jar
Normal file
BIN
web/utils/htmlunit-2.8/nekohtml-1.9.14.jar
Normal file
Binary file not shown.
BIN
web/utils/htmlunit-2.8/sac-1.3.jar
Normal file
BIN
web/utils/htmlunit-2.8/sac-1.3.jar
Normal file
Binary file not shown.
BIN
web/utils/htmlunit-2.8/serializer-2.7.1.jar
Normal file
BIN
web/utils/htmlunit-2.8/serializer-2.7.1.jar
Normal file
Binary file not shown.
BIN
web/utils/htmlunit-2.8/xalan-2.7.1.jar
Normal file
BIN
web/utils/htmlunit-2.8/xalan-2.7.1.jar
Normal file
Binary file not shown.
BIN
web/utils/htmlunit-2.8/xercesImpl-2.9.1.jar
Normal file
BIN
web/utils/htmlunit-2.8/xercesImpl-2.9.1.jar
Normal file
Binary file not shown.
BIN
web/utils/htmlunit-2.8/xml-apis-1.3.04.jar
Normal file
BIN
web/utils/htmlunit-2.8/xml-apis-1.3.04.jar
Normal file
Binary file not shown.
3
web/utils/serverexecute
Executable file
3
web/utils/serverexecute
Executable 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 $@
|
Loading…
Reference in New Issue
Block a user