Applets in plugin

3 messages Options
Embed this post
Permalink
michael.couck

Applets in plugin

Reply Threaded More More options
Print post
Permalink
Hi,

Has anyone tried to put an applet in a plugin. Tricky thing is the Jelly/Stapler intergration. The applet tag goes in the Jelly, but Stapler catches the requests of course, and the browser is looking for the class and the JAR if necessary. Could the action serve the class as a byte[], I am reaching here but i have been on this for a while now.

Thanks in advance.

Michael
Kohsuke Kawaguchi-2

Re: Applets in plugin

Reply Threaded More More options
Print post
Permalink
michael.couck wrote:
> Hi,
>
> Has anyone tried to put an applet in a plugin. Tricky thing is the
> Jelly/Stapler intergration. The applet tag goes in the Jelly, but Stapler
> catches the requests of course, and the browser is looking for the class and
> the JAR if necessary. Could the action serve the class as a byte[], I am
> reaching here but i have been on this for a while now.

You can certainly write such an method, but I think it'd be better if
you have one Maven module that creates an applet, integrate that as a
binary jar into your plugin, and place it in your webapp resource.

>
> Thanks in advance.
>
> Michael


--
Kohsuke Kawaguchi
Sun Microsystems                   http://weblogs.java.net/blog/kohsuke/


smime.p7s (4K) Download Attachment
michael.couck

Re: Applets in plugin

Reply Threaded More More options
Print post
Permalink
Hi Kohsuke,

Thanks for the reply. I just don't like that solution now that I have had time to reflect, streaming the byte[] for the applet to the browser. I tried a couple of things including that but playing with the browser functionality is only going to get me into trouble later, I am sure.

In any event I found a reasonable solution. In the case of Hudson running on a server like Tomcat, Hudson will have a folder in the webapps. If the applet is in the base folder then I can reference it by http://localhost/hudson/serenity.jar. This lets the browser do it's thing naturally. Of course the user then has to copy the jar to the Hudson folder. I can write the applet jar to the Hudson folder in the Publisher, the first time a build is done, which saves the user doing any other configuration.

I also put the jar on my server and linked to it. In that case the applet can't go back to the Hudson server unless it is signed and that is a pain. And the data sent to the applet needs to be completely on the client. I serialized the data model to base64 and JavaScripted it to the applet which worked ok, but the solution is ugly, and I avoid JavaScript wherever possible. So I discarded that direction.

As it stands the applet is in the Hudson folder, Tomcat and Winstone(and whatever other server, still to be tested of course), the applet gets invoked with JavaScript to reload the model, goes to a Jelly script where the model is still serialized to base64(which I still don't like), deserializes it and updates the graph. I would like the applet to go directly to a 'Servlet' and get the data model as an object, EJB style.

So I am still fiddling around with possible solutions.

Otherwise it is coming along nicely, I hope to have a stable first version by the end of the year.

See ya,
Michael


Kohsuke Kawaguchi-2 wrote:
michael.couck wrote:
> Hi,
>
> Has anyone tried to put an applet in a plugin. Tricky thing is the
> Jelly/Stapler intergration. The applet tag goes in the Jelly, but Stapler
> catches the requests of course, and the browser is looking for the class and
> the JAR if necessary. Could the action serve the class as a byte[], I am
> reaching here but i have been on this for a while now.

You can certainly write such an method, but I think it'd be better if
you have one Maven module that creates an applet, integrate that as a
binary jar into your plugin, and place it in your webapp resource.

>
> Thanks in advance.
>
> Michael


--
Kohsuke Kawaguchi
Sun Microsystems                   http://weblogs.java.net/blog/kohsuke/