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

**URL:** <https://www.ruby-forum.com/t/how-do-i-render-a-java-applet-from-a-controller/115196>\
**Category:** Rails\
**Created:** [September 21, 2007, 3:59pm UTC](https://www.ruby-forum.com/t/how-do-i-render-a-java-applet-from-a-controller/115196 "2007-09-21T15:59:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [September 21, 2007, 3:59pm UTC](https://www.ruby-forum.com/t/how-do-i-render-a-java-applet-from-a-controller/115196/1 "2007-09-21T15:59:58Z")

</div>

Hi,

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:

 XOPmeet Playback \<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?

Thanks!

David

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [September 21, 2007, 5:30pm UTC](https://www.ruby-forum.com/t/how-do-i-render-a-java-applet-from-a-controller/115196/2 "2007-09-21T17:30:15Z")

</div>

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  
[http://www.w3.org](http://www.w3.org).

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [September 22, 2007, 10:08pm UTC](https://www.ruby-forum.com/t/how-do-i-render-a-java-applet-from-a-controller/115196/3 "2007-09-22T22:08:07Z")

</div>

On Sep 21, 10:29 am, Robert W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > ```
> > <applet
> > 
> > ```
> > 
> > GET /report/play\_webrec/com/sts/webmeet/client/AWTClient.class
> 
> > David

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?

Thanks,

David
