对于VAADIN Java应用程序,当我进入设计的网页时,我创建了一个加载的类。
这个课必须每天凌晨12:00开始,所以我想创建一个bash脚本,它使用curl来请求设计的页面来加载课程并启动所有内容。
他们的问题是,当我尝试使用
获取curl页面时curl http://localhost:8080/Cub2dV725/mailengine
我明白了:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=11;chrome=1">
<style type="text/css">html, body {height:100%;margin:0;}</style>
<link rel="shortcut icon" type="image/vnd.microsoft.icon" href="./VAADIN/themes/reindeer/favicon.ico">
<link rel="icon" type="image/vnd.microsoft.icon" href="./VAADIN/themes/reindeer/favicon.ico">
</head>
<body scroll="auto" class=" v-generated-body">
<div id="Cub2DV725marketingmailengine-730874983" class=" v-app reindeer">
<div class=" v-app-loading"></div>
<noscript>
You have to enable javascript in your browser to use an application built with Vaadin.
</noscript>
</div>
<iframe tabindex="-1" id="__gwt_historyFrame" style="position:absolute;width:0;height:0;border:0;overflow:hidden" src="javascript:false"></iframe>
<script type="text/javascript" src="./VAADIN/vaadinBootstrap.js"></script>
<script type="text/javascript">//<![CDATA[
if (!window.vaadin) alert("Failed to load the bootstrap javascript: .\/VAADIN\/vaadinBootstrap.js");
if (typeof window.__gwtStatsEvent != 'function') {
vaadin.gwtStatsEvents = [];
window.__gwtStatsEvent = function(event) {vaadin.gwtStatsEvents.push(event); return true;};
}
vaadin.initApplication("Cub2DV725marketingmailengine-730874983",{
"heartbeatInterval": 300,
"versionInfo": {
"vaadinVersion": "7.2.5"
},
"vaadinDir": ".\/VAADIN\/",
"authErrMsg": {
"message": "Take note of any unsaved data, and <u>click here<\/u> or press ESC to continue.",
"caption": "Authentication problem"
},
"widgetset": "com.vaadin.DefaultWidgetSet",
"theme": "reindeer",
"debug": true,
"comErrMsg": {
"message": "Take note of any unsaved data, and <u>click here<\/u> or press ESC to continue.",
"caption": "Communication problem"
},
"standalone": true,
"sessExpMsg": {
"message": "Take note of any unsaved data, and <u>click here<\/u> or press ESC key to continue.",
"caption": "Session Expired"
}
});
//]]></script>
</body>
</html>
该类尚未加载(我知道因为有一个system.out.print(&#34;已加载&#34;);在课程开始时。
答案 0 :(得分:0)
我使用PhantomJS
找到了解决方案刚刚用这段代码创建了一个script.js:
var page = require('webpage').create();
page.open('http://localhost:8080/Cub2DV725/mailengine', function() {
phantom.exit();
});
和bash脚本:
这里,/ var / lib / PhantomJs是我提取它的地方
/var/lib/PhantomJs/bin/phantomjs /var/scripts/script.js
现在我只需要添加一个crontab条目来每天凌晨12:00启动脚本