编写一个Firefox插件,并从Java应用程序访问它 [英] Write a firefox plugin and access it from a java application
问题描述
插件将不得不通知Java应用程序正在加载的网页/网址。
java应用程序将负责其余的部分。
任何帮助或指针都将非常感激。
我已经编写了几个Firefox插件,正是这个要求。
一个策略是使用JavaScript- Firefox中的Java桥,允许使用Java RMI。我发现这种方法缓慢和不稳定,多线程是痛苦的。
我目前的解决方案是打开一个 I want to write a firefox plugin which will communicate with a java application.
The plugin will have to notify the java application of the web page/ url being loaded.
The java application will take care of the rest. Any help or pointers will be much appreciated. I have authored a couple Firefox plugins with precisely this requirement. One strategy is to use the JavaScript-to-Java bridge in Firefox, which permits the use of Java RMI. I found this approach slow and unstable, and the multithreading is painful. My current solution is to open a The source code to one plugin I wrote (for Firefox and Eclipse) is available under the X11 aka MIT license: Firedoclipse source. Under the 这篇关于编写一个Firefox插件,并从Java应用程序访问它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!本地主机
套接字并使用文本协议进行通信。请参阅套接字上的XULPlanet开发人员指南了解如何使用套接字打开和读取/写入Firefox JavaScript,并且在Java套接字上有一个 Sun教程。
我编写的一个插件(用于Firefox和Eclipse)的源代码可以在X11或MIT许可证下找到: Firedoclipse来源。在 lib目录下有一个名为
jsjr
的组件,有几个Java类和一个JavaScript XPCOM对象实现了远程方法的调用在Java和JavaScript之间。 test
目录包含一些单元测试。这种远程方法的调用将会过度,只能向一个方向发送一种消息,但是您可能会发现代码很有用。 localhost
socket and use a textual protocol to communicate. See the XULPlanet developer guide on sockets for how to open and read/write with sockets in Firefox JavaScript, and there's a Sun tutorial on sockets in Java.lib
directory is a component called jsjr
, with several Java classes and a JavaScript XPCOM object that implement remote method invocation between Java and JavaScript. The test
directory contains some unit tests. This remote method invocation would be overkill for sending only one kind of message in one direction, but you might find the code helpful.