Redian新闻
>
怎样才能Firefox add-on和java程序之间传递数据
avatar
怎样才能Firefox add-on和java程序之间传递数据# Java - 爪哇娇娃
s*y
1
譬如说在Firefox上面加一个自定义的button, 当click button后, URL 栏里面的地址
可以传递给另外一个stand-alone的java程序, 在其GUI界面上(e.g. jTextArea)显示
出Firefox当前URL的值。
请问哪位大侠知道J2SE里面怎么实现么? 谢谢了
谢谢
avatar
g*e
2
socket

地址
显示

【在 s*******y 的大作中提到】
: 譬如说在Firefox上面加一个自定义的button, 当click button后, URL 栏里面的地址
: 可以传递给另外一个stand-alone的java程序, 在其GUI界面上(e.g. jTextArea)显示
: 出Firefox当前URL的值。
: 请问哪位大侠知道J2SE里面怎么实现么? 谢谢了
: 谢谢

avatar
g*g
3
I don't know much about FF plugin, but I think it's just a native
program which can do anything on your OS.
So you certainly can launch a command like
java ShowUrl your_url
pass your_url into ShowUrl class and display it.

地址
显示

【在 s*******y 的大作中提到】
: 譬如说在Firefox上面加一个自定义的button, 当click button后, URL 栏里面的地址
: 可以传递给另外一个stand-alone的java程序, 在其GUI界面上(e.g. jTextArea)显示
: 出Firefox当前URL的值。
: 请问哪位大侠知道J2SE里面怎么实现么? 谢谢了
: 谢谢

avatar
c*t
4
Used to be called LiveConnect for firefox 1.x, but for 2.0, there
is a new API.
http://developer.mozilla.org/en/docs/Gecko_Plugin_API_Reference:Scripting_plugins
It only works for applets though.
For standalone app, you try monitor the clip board (not sure if there
is an event) and use JavaScript to copy text to clipboard (works for
IE, not sure about FireFox).

地址
显示

【在 s*******y 的大作中提到】
: 譬如说在Firefox上面加一个自定义的button, 当click button后, URL 栏里面的地址
: 可以传递给另外一个stand-alone的java程序, 在其GUI界面上(e.g. jTextArea)显示
: 出Firefox当前URL的值。
: 请问哪位大侠知道J2SE里面怎么实现么? 谢谢了
: 谢谢

avatar
g*e
5
I think he wanted to pass some data to another running program. I have a
project doing similar thing so I's like to hear you guys ideas too.

【在 g*****g 的大作中提到】
: I don't know much about FF plugin, but I think it's just a native
: program which can do anything on your OS.
: So you certainly can launch a command like
: java ShowUrl your_url
: pass your_url into ShowUrl class and display it.
:
: 地址
: 显示

avatar
g*g
6
One simple way would be listening on socket, and write data into it.
You can also share some file and write into it, the other program check
the file periodly.

【在 g******e 的大作中提到】
: I think he wanted to pass some data to another running program. I have a
: project doing similar thing so I's like to hear you guys ideas too.

avatar
g*e
7
Thanks. Socket is my first thought too.
My project is a bit different. The data(command) being passed is pretty
complex so I may need to define a set of protocol for that. My other thought
is to pass data directly from server (we only use browser as a UI and the
data is actually on the server side) so that I can skip the browser plugin (
the part I don't like).

【在 g*****g 的大作中提到】
: One simple way would be listening on socket, and write data into it.
: You can also share some file and write into it, the other program check
: the file periodly.

avatar
g*g
8
Sure, if data is already captured on server, then there's no point to
use a plugin. And you don't need to define protocol yourself, if you are
java to java, mark your data transfer object serializable would be enough,
either writeObject on socket, or use web service / Hessian.
If it's another language to Java, you can still use web service.

thought
(

【在 g******e 的大作中提到】
: Thanks. Socket is my first thought too.
: My project is a bit different. The data(command) being passed is pretty
: complex so I may need to define a set of protocol for that. My other thought
: is to pass data directly from server (we only use browser as a UI and the
: data is actually on the server side) so that I can skip the browser plugin (
: the part I don't like).

avatar
s*y
9
那请问firefox怎么建立socket呢?

【在 g*****g 的大作中提到】
: One simple way would be listening on socket, and write data into it.
: You can also share some file and write into it, the other program check
: the file periodly.

avatar
g*e
10
Most likely they will be in different languages and platforms so I will
consider soap (or lighter protocol like json). One other thing makes it
tricky is the server side may have to push the data to the client side since
only server knows when the data is ready. Anybody knows about some Java
reference implementation of push server (client)?

【在 g*****g 的大作中提到】
: Sure, if data is already captured on server, then there's no point to
: use a plugin. And you don't need to define protocol yourself, if you are
: java to java, mark your data transfer object serializable would be enough,
: either writeObject on socket, or use web service / Hessian.
: If it's another language to Java, you can still use web service.
:
: thought
: (

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。