Re: java callbackks

From: Andrew Harrison <a.b.harrison_at_cs.cardiff.ac.uk>
Date: Tue, 20 Dec 2005 21:14:10 +0000

David,

Thanks for your prompt response!

My extension aims at making Firefox a peer in a P2P sense. So I need
to get arbitrary messages received by the back-end Java peer into
Firefox. This will be queries for resources/uris (I've mentioned this
before - PiggyBank data) received from the P2P network, but a simple
chat window is my current proof-of-concept. So I don't know when the
messages will arrive. I'm just wondering if I can cobble something
together with JNI but that's going to be messy because currently I
get Java using your sly technique from JS, but JNI needs to go (in my
experience) via the Java plug-in. Not quite sure how these different
access methods to the JVM would affect things...hmmm

cheers,

Andrew


On 20 Dec 2005, at 20:54, David Huynh wrote:

> Andrew,
>
> Unfortunately I think you're trying the impossible, at least at the
> moment, because I have tried for the same thing and failed twice
> before (on Windows). Perhaps with more native support for Java in
> Firefox, we can hope to have callbacks.
>
> If you can tell me more specifically why you need the Java backend
> to send messages back to the frontend, perhaps I can suggest a user
> interface solution that does not require the callback.
>
> David
>
>
> Andrew Harrison wrote:
>> Hi,
>>
>> I apologise in advance for sending this message to this list
>> because it's not a PiggyBank question. But there are few places
>> that have as much expertise with Firefox and Java. And I'm stuck...
>>
>> So I'm trying to add a JS Object that is invoked from XUL as a
>> listener to a back-end Java class, in order for the Java class to
>> send messages into Firefox. The Java class has a method:
>>
>> void addJSListener(JSObject jsobject);
>>
>> The JS Object calls on the Javascript-Java 'bridge' component in
>> the extension to invoke this Java method, giving itself as a
>> parameter ('this'). But when the component arrives in Java it's
>> null - the JSObject.toString() returns 'null'. If I try and print
>> the JSObject parameter I get a null pointer exception. If I invoke
>> a method on the JSObject like eval or call I don't get an
>> exception, but nothing happens, which is frustrating.
>>
>> Most of the documentation I can find on JSObject presumes the Java
>> side object is an Applet, which mine isn't.
>>
>> So the question is, am I trying to do the impossible (i.e. use
>> JSObject not from an Applet)? Also I'm using a Mac (with Firefox
>> 1.5)- could this be an issue? Or am I just missing something stupid?
>>
>> Optimistically thanks in advance,
>>
>> Andrew
>>
>>
>
Received on Tue Dec 20 2005 - 21:06:58 EST

This archive was generated by hypermail 2.3.0 : Thu Aug 09 2012 - 16:39:18 EDT