# Charts and Java servers

**URL:** <https://www.ruby-forum.com/t/charts-and-java-servers/55966>\
**Category:** Rails\
**Created:** [March 26, 2006, 9:37am UTC](https://www.ruby-forum.com/t/charts-and-java-servers/55966 "2006-03-26T09:37:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![seanb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c0e974/32.png) [@seanb](https://www.ruby-forum.com/u/seanb)\
**Post date:** [March 26, 2006, 9:37am UTC](https://www.ruby-forum.com/t/charts-and-java-servers/55966/1 "2006-03-26T09:37:22Z")

</div>

Hi,

As a long time Java/J2EE exponent I wanted to give Rails a fair crack of  
the  
whip and after we evaluated it for several weeks I have to say I like  
it.

The installation process for the base system/framework is  
straightforward on  
the two platforms we’ve tried (Windows and Mac OS X). However, the  
charting  
components available, relying on ImageMagick or GraphicsMagick seem less  
clear cut. OS X was no problem - but Windows XP proved tricky. The other  
option we considered was using a Java servlet on Tomcat to provide the  
charts (using JChart or something). Is there a way within a Rails  
controller  
(for example) to proxy a call to another server (on port 8080 in this  
case)  
within the firewall, to return a resource (a generated image). Obviously  
we  
don’t want to embed an ![]() link to something on 8080 since this won’t  
be  
available outside of the firewall. The only thing I can think to do is  
to  
use Apache proxying but we are trying to keep the installation and  
configuration process simple. We did some PHP/J2EE development on a  
previous  
project and the installation process for PHP and Apache got quite exotic  
towards the end.

Sean.

---

<div class="post-metadata">

**Author:** ![seanb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c0e974/32.png) [@seanb](https://www.ruby-forum.com/u/seanb)\
**Post date:** [March 26, 2006, 11:05am UTC](https://www.ruby-forum.com/t/charts-and-java-servers/55966/2 "2006-03-26T11:05:32Z")

</div>

Sean B. wrote:

> proved tricky. The other option we considered was using a Java servlet  
> on Tomcat to provide the charts (using JChart or something). Is there a  
> way within a Rails controller (for example) to proxy a call to another  
> server (on port 8080 in this case) within the firewall, to return a  
> resource (a generated image). Obviously we don’t want to embed an ![]()  
> link to something on 8080 since this won’t be available outside of the  
> firewall. The only thing I can think to do is to use Apache proxying but  
> we are trying to keep the installation and configuration process simple.  
> We did some PHP/J2EE development on a previous project and the  
> installation process for PHP and Apache got quite exotic towards the end.

Hah! I was just working on this… only using a simple servlet running  
in tomcat and using  
batik to transcode an svg to a png. It’s called by a php page.

Anyway, check out the Net::HTTP module:

[http://www.ruby-doc.org/stdlib/libdoc/net/http/rdoc/classes/Net/HTTP.html](http://www.ruby-doc.org/stdlib/libdoc/net/http/rdoc/classes/Net/HTTP.html)

You can use this to make an HTTP connection to the servlet running on  
localhost:8080 and  
pass it the data. The servlet can then write the chart into the  
appropriate image dir and  
the rails response will just find it there.

On the other hand, you might just be fine using gruff:

[http://nubyonrails.topfunky.com/pages/gruff](http://nubyonrails.topfunky.com/pages/gruff)

b

---

<div class="post-metadata">

**Author:** ![seanb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c0e974/32.png) [@seanb](https://www.ruby-forum.com/u/seanb)\
**Post date:** [March 26, 2006, 11:26am UTC](https://www.ruby-forum.com/t/charts-and-java-servers/55966/3 "2006-03-26T11:26:52Z")

</div>

Hi Ben,

I really liked the look of Gruff and as I said, installing the  
pre-requisites (GraphicsMagick via Darwin Ports) was easy on my  
Powerbook  
… less easy on one the developer Windows boxes. I don’t know if  
Instant  
Rails ships with it. I am trying to secure a couple of new projects in  
the  
next few weeks and I’d really like to bring Rails into the mix (with a  
splash of Java services fronted by REST web services). The clients are  
energy traders/brokers and a European government agency and they seem to  
have a bias towards Windows 2003 Server… so I really need a solution  
that  
can be concisely and easily installed on such a server (even though I’d  
much  
prefer to see them use Linux, Solaris 10 or OS X Server!) Charting is a  
key  
component of these projects.

Thanks for the steer on Net::HTTP.

---

<div class="post-metadata">

**Author:** ![seanb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c0e974/32.png) [@seanb](https://www.ruby-forum.com/u/seanb)\
**Post date:** [April 8, 2006, 1:26pm UTC](https://www.ruby-forum.com/t/charts-and-java-servers/55966/4 "2006-04-08T13:26:40Z")

</div>

I have writtn code for charts using easy charts. The only thing we need  
to do is extract jar files such as  
chart.jar,chartserver.jar,chart.ext.jar; and create objects and run the  
code as we run java pgms.  
Now i’m facing with a problem: i’m unable to run this java code using  
tomcat. i would be grateful to u if u help me as i m a final year engg  
student and need the same in regard to my project. waiting for ur reply  
Yours sincerely  
Sarika
