我需要从grails服务调用一个phantom.js脚本来创建一个我可以缓存的PNG图像.
我用幻像和grails看到的所有例子都涉及使用幻像进行测试,所以我不确定如何从服务中管理它.
从grails服务调用脚本时最好的做法是什么?
它使用自定义脚本根据传入的URL创建图像.
这将是命令行上的equivelant:
./phantomjs createImage.js http://www.toBeConcerted.com output.png
这与从Java或Groovy调用可执行文件相同.
Groovy文档有针对此主题的特定页面.你也可以查看这个相关的SO问题.
def command = """phantomjs createImage.js http://www.toBeConcerted.com output.png"""// Create the String
def proc = command.execute() // Call *execute* on the string
proc.waitFor() // Wait for the command to finish
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
941 次 |
最近记录: |