How do I "render" a Java applet from a controller?


I need to render the results of another program, which are stored in the form of applets, each stored in their own directories.

The applet-related data is referenced in a plain html file, which contains statements like this:

<html>     <head>         <title>XOPmeet Playback</title>     </head>     <body TOPMARGIN=0 BOTTOMMARGIN=0 LEFTMARGIN=0 RIGHTMARGIN=0 MARGINHEIGHT=0 MARGINWIDTH=0 SCROLL="NO">         <applet             code=com.sts.webmeet.client.AWTClient.class

archive="webhuddle_voip.jar,clientproperties.jar,jl1.0.jar"    .........

I can render the above plain html file from my controller with no problems. However, the browser sees that applet tag and then sends in a GET request like this:

   GET /report/play_webrec/com/sts/webmeet/client/AWTClient.class

That "com/...." part of the path is within one of the jar files.

I need to control access to the applets, so I cannot just place the applet related code in the public side of the web site.

How can I send applets from within a Rails controller?



Not sure if this is a problem, but the applet tag is deprecate in favor of the object tag.Check the object tag syntax at

OK..I got it to work much better. It turns out that the browser was requesting the jar file, and if it encountered any error, was trying to request that AWT class file (which is inside the jar file).

I now have another interesting problem. It seems that the browser will request the same jar file multiple times, which I send in my controller, via the send_file helper. Since the browser requests the same file many times (maybe up to 10 times), the applet appears very slow.

I noticed that applets served from the public side of the web server don't have this problem. The web server seems to send some "304 Not Modified". I tried to do this in my controller, but the broswer/applet didn't seem to like it.

Any ideas?