java - WebRenderer Swing 和服务器版

标签 java browser

我正在使用WebRenderer将 HTML5 页面导出为服务器上的图像。问题是唯一支持HTML5的版本是swing版本。但是,我可以使用 swing 版本中的 jar 文件并创建一个新的 IMozillaBrowserCanvas 对象,而不将其链接到 JFrame/JPanel 并让它在没有 GUI 的情况下转换 html5 页面。

仅使用IMozillaBrowserCanvas时,swing版本和服务器版本有什么区别吗?我能找到的唯一信息是:

The WebRenderer Server Edition 4.0 scales better in server and headless environments than any other Java browser SDK due to the fact that rendering is not performed on the Swing Thread. Keeping rendering off the Swing Thread, and multi-threading the rendering leads to major improvements in scalability. [Source]

此外,当从 BrowserFactory 类调用 spawnMozilla() 方法时,后端发生了什么?据我所知,这只是一个纯java浏览器,并没有在后台运行xserver。

最佳答案

我已经联系了WebRenderer的开发者。他说:

There are mostly internal architectural differences between the Server and Swing Editions of WebRenderer. The Server Edition was designed primarily for creating images of pages, whereas the Swing Edition is a fully functional browser. However, this does not prevent the Swing Edition from being used efficiently to generate page images.

The API is similar, although the Server has convenience methods for different sizes/types of image generation, and the Swing Edition has more features available. The version of the underlying Mozilla browser is much more recent in the Swing Edition, so it is capable of rendering pages that make use of technologies such as HTML5.

While the rendering is all done in Java, the Mozilla component needs to be handled natively for each platform. It does not run an xserver, but the spawnMozilla() call will set up these native components, they are extracted to the .webrendererswing6 directory in the user home directory by default.

关于java - WebRenderer Swing 和服务器版,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11362300/

相关文章:

java - 为什么双括号初始化要求 SerialVersionUID?

browser - 启动 ClojureScript 浏览器 REPL

Android,如何以编程方式在任何浏览器中阻止 URL?

javascript - 如何始终获得良好的页面源格式?

java - Android 上的 FTP 上传和下载

java - 从点云创建多边形

java - Maven 聚合两个不同的 Pom?

java - java中如何将名字的第一个字母大写?

javascript - 如何为网站创建临时身份验证?

http - 为什么 Firefox 忽略缓存 header 并在刷新时重新验证?