SlideShare a Scribd company logo
Who's this then?


 Alexander Malfait

 Enjoying Rails since 2007

 Tallest employee at CAT Solutions
JRuby on Rails, Flying Saucer
Wait, didn't we
hate Java?
 JVM is fast

 JVM is everywhere, corporate approved

 Tons of useful & widely used libraries

 Runs great on Windows
Running Rails


 jruby -S gem install glassfish

 jruby -S glassfish -e production

 config.threadsafe!

 Works on other app servers (.war file)
Hiding behind Apache

<VirtualHost *:80>
  ServerName my.awesome.app.be

  RewriteEngine On
  ProxyPass / http://localhost:3000/ retry=0
  ProxyPassReverse / http://localhost:3000/

  ErrorDocument 503 "<b>Come back in 10 seconds</b>"
</VirtualHost>


 http://blog.headius.com/2009/04/apache-jruby-rails-glassfish-easy.html
Talking to Java


 Just create java objects like Ruby objects

 Extend Java classes in Ruby

 Require jars from Ruby without mucking
 about with the JVM ClassPath
Ruby Style Java


 java.lang.System.current_time_millis

 x.setSomething(var) => x.something = var

 button = javax.swing.JButton.new "Press me!"

 button.add_action_listener do |event|
   event.source.text = "You did it!"
 end
Flying Saucer


 Renders XHTML/CSS3 to PDF (very well!)

 Written in Java

 Handles any reporting problem you can
 throw at it
acts_as_flying_saucer


  Rails apps produce HTML

  You know HTML

  Report to PDF using HTML
Cocktail Reporting

 class DrinksController < ApplicationController
   acts_as_flying_saucer

  def mojito
    @ingredients = [
      "4.0 cl White Rum",
      "3.0 cl Fresh lime juice",
      "3 sprigs of Mint",
      "2 teaspoons Sugar",
      "Soda Water"
    ]

     render_pdf :send_file => { :filename => "tasty.pdf" }
   end
 end
Cocktail Reporting

 <h1 style="color: green;">Mojito!</h1>

 <ul>
    <% @ingredients.each do |ingredient| %>
       <li><%=h ingredient %></li>
    <% end %>
 </ul>




                         render_pdf
I want my mojito NOW!


  Rendering drinks/mojito

  Completed in 16ms

  ~62 mojitos/second
Larger documents


  Rendering the holy bible

  4.5MB of HTML

  Resulting PDF: 1134 pages

  Completed in 22500ms
Real Example
Typical Reporting
Problems
  Repeating headers / footers

  Paginating/nesting tables

  Lots of data

  Maintaining uniform reporting style

  All covered by the flying saucer!
Script anything!


  JFreeChart: powerful charting

  Apache POI: read & write Excel files

  JODConvertor: convert (almost) anything
  to anything using OpenOffice.org

  Swing

  Hundreds more...
References

  http://github.com/alexandermalfait/acts_as_flying_saucer

  http://bosmeeuw.wordpress.com/

  http://www.catsolutions.be/

More Related Content

PPTX
My journey and learnings using mule esb 2
PDF
FROM LOCAL TO LIVE: EXPORTING WORDPRESS FROM MAMP
KEY
Introduction to php
PDF
CoffeeScript Design Patterns
PPTX
Tutorial sederhana netbeans & xampp
PDF
Scaling WordPress
PPTX
Introduction to Coffeescript
PDF
Be Happy With Ruby on Rails - Ecosystem
My journey and learnings using mule esb 2
FROM LOCAL TO LIVE: EXPORTING WORDPRESS FROM MAMP
Introduction to php
CoffeeScript Design Patterns
Tutorial sederhana netbeans & xampp
Scaling WordPress
Introduction to Coffeescript
Be Happy With Ruby on Rails - Ecosystem

What's hot (20)

KEY
End to-End CoffeeScript
PDF
10x Command Line Fu
ODP
A Toda Maquina Con Ruby on Rails
PPTX
Ruby on Rails - An overview
PDF
Integration Test Cucumber + Webrat + Selenium
 
PPTX
Initialize database in Mule part2
PDF
Testumgebungen für WordPress
PDF
Happy Programming with CoffeeScript
PPTX
Accessing Mule variables in groovy
PDF
WP Weekend #2 - Corcel, aneb WordPress přes Laravel
ODP
Making dynamic sites scale like static sites
PDF
CakePHP SessionAcl Component
ODP
Remove web calls and scale your site like crazy !
PDF
Drupal + selenium
PDF
Being a jsp
PPTX
Mule esb first http connector
PDF
Tutorial on joomla transfer moffatmn
PPTX
PDF
Ch. 11 deploying
PPTX
BDD / cucumber /Capybara
End to-End CoffeeScript
10x Command Line Fu
A Toda Maquina Con Ruby on Rails
Ruby on Rails - An overview
Integration Test Cucumber + Webrat + Selenium
 
Initialize database in Mule part2
Testumgebungen für WordPress
Happy Programming with CoffeeScript
Accessing Mule variables in groovy
WP Weekend #2 - Corcel, aneb WordPress přes Laravel
Making dynamic sites scale like static sites
CakePHP SessionAcl Component
Remove web calls and scale your site like crazy !
Drupal + selenium
Being a jsp
Mule esb first http connector
Tutorial on joomla transfer moffatmn
Ch. 11 deploying
BDD / cucumber /Capybara
Ad

Viewers also liked (7)

PDF
Jaspersoft Studioチュートリアル1 - レポートの作成
PPTX
Jasper Report - Lesson
PDF
A Short Intorduction to JasperReports
PDF
Study: The Future of VR, AR and Self-Driving Cars
PDF
3 Things Every Sales Team Needs to Be Thinking About in 2017
PDF
Hype vs. Reality: The AI Explainer
PDF
How to Become a Thought Leader in Your Niche
Jaspersoft Studioチュートリアル1 - レポートの作成
Jasper Report - Lesson
A Short Intorduction to JasperReports
Study: The Future of VR, AR and Self-Driving Cars
3 Things Every Sales Team Needs to Be Thinking About in 2017
Hype vs. Reality: The AI Explainer
How to Become a Thought Leader in Your Niche
Ad

Similar to JRuby on Rails, Flying Saucer (20)

PDF
Getting Started with Rails on GlassFish (Hands-on Lab) - Spark IT 2010
PDF
Mojolicious lite
PDF
JRuby, Ruby, Rails and You on the Cloud
PDF
Mojito@nodejstw
PDF
Consegi 2010 - Dicas de Desenvolvimento Web com Ruby
PDF
Born_ruby_on_rails
PDF
Born_ruby_on_rails
ODP
DiUS Computing Lca Rails Final
PDF
GlassFish and NetBeans: Develop with pleasure, Deploy with Fun for a better R...
PDF
Developing Brilliant and Powerful APIs in Ruby & Python
PDF
Fisl 11 - Dicas de Desenvolvimento Web com Ruby
PDF
Making and Breaking Web Services with Ruby
 
PDF
Strangers In The Night: Ruby, Rack y Sinatra - Herramientas potentes para con...
PPTX
Cocktails – Shaken, Not Stirred @osdc.tw
PDF
Google Developer Day 2007 - Nestoria: From Mash-up To Business
PDF
APIs for mobile
PDF
Ruby On Rails Basics
PDF
Dynamic Languages & Web Frameworks in GlassFish
PDF
Mojolicious
PDF
Rails - getting started
Getting Started with Rails on GlassFish (Hands-on Lab) - Spark IT 2010
Mojolicious lite
JRuby, Ruby, Rails and You on the Cloud
Mojito@nodejstw
Consegi 2010 - Dicas de Desenvolvimento Web com Ruby
Born_ruby_on_rails
Born_ruby_on_rails
DiUS Computing Lca Rails Final
GlassFish and NetBeans: Develop with pleasure, Deploy with Fun for a better R...
Developing Brilliant and Powerful APIs in Ruby & Python
Fisl 11 - Dicas de Desenvolvimento Web com Ruby
Making and Breaking Web Services with Ruby
 
Strangers In The Night: Ruby, Rack y Sinatra - Herramientas potentes para con...
Cocktails – Shaken, Not Stirred @osdc.tw
Google Developer Day 2007 - Nestoria: From Mash-up To Business
APIs for mobile
Ruby On Rails Basics
Dynamic Languages & Web Frameworks in GlassFish
Mojolicious
Rails - getting started

Recently uploaded (20)

PPT
Teaching material agriculture food technology
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Empathic Computing: Creating Shared Understanding
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
Cloud computing and distributed systems.
Teaching material agriculture food technology
Advanced methodologies resolving dimensionality complications for autism neur...
MYSQL Presentation for SQL database connectivity
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Unlocking AI with Model Context Protocol (MCP)
Reach Out and Touch Someone: Haptics and Empathic Computing
The Rise and Fall of 3GPP – Time for a Sabbatical?
Empathic Computing: Creating Shared Understanding
Dropbox Q2 2025 Financial Results & Investor Presentation
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
NewMind AI Weekly Chronicles - August'25 Week I
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Building Integrated photovoltaic BIPV_UPV.pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
MIND Revenue Release Quarter 2 2025 Press Release
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Digital-Transformation-Roadmap-for-Companies.pptx
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Cloud computing and distributed systems.

JRuby on Rails, Flying Saucer

  • 1. Who's this then? Alexander Malfait Enjoying Rails since 2007 Tallest employee at CAT Solutions
  • 3. Wait, didn't we hate Java? JVM is fast JVM is everywhere, corporate approved Tons of useful & widely used libraries Runs great on Windows
  • 4. Running Rails jruby -S gem install glassfish jruby -S glassfish -e production config.threadsafe! Works on other app servers (.war file)
  • 5. Hiding behind Apache <VirtualHost *:80> ServerName my.awesome.app.be RewriteEngine On ProxyPass / http://localhost:3000/ retry=0 ProxyPassReverse / http://localhost:3000/ ErrorDocument 503 "<b>Come back in 10 seconds</b>" </VirtualHost> http://blog.headius.com/2009/04/apache-jruby-rails-glassfish-easy.html
  • 6. Talking to Java Just create java objects like Ruby objects Extend Java classes in Ruby Require jars from Ruby without mucking about with the JVM ClassPath
  • 7. Ruby Style Java java.lang.System.current_time_millis x.setSomething(var) => x.something = var button = javax.swing.JButton.new "Press me!" button.add_action_listener do |event| event.source.text = "You did it!" end
  • 8. Flying Saucer Renders XHTML/CSS3 to PDF (very well!) Written in Java Handles any reporting problem you can throw at it
  • 9. acts_as_flying_saucer Rails apps produce HTML You know HTML Report to PDF using HTML
  • 10. Cocktail Reporting class DrinksController < ApplicationController acts_as_flying_saucer def mojito @ingredients = [ "4.0 cl White Rum", "3.0 cl Fresh lime juice", "3 sprigs of Mint", "2 teaspoons Sugar", "Soda Water" ] render_pdf :send_file => { :filename => "tasty.pdf" } end end
  • 11. Cocktail Reporting <h1 style="color: green;">Mojito!</h1> <ul> <% @ingredients.each do |ingredient| %> <li><%=h ingredient %></li> <% end %> </ul> render_pdf
  • 12. I want my mojito NOW! Rendering drinks/mojito Completed in 16ms ~62 mojitos/second
  • 13. Larger documents Rendering the holy bible 4.5MB of HTML Resulting PDF: 1134 pages Completed in 22500ms
  • 15. Typical Reporting Problems Repeating headers / footers Paginating/nesting tables Lots of data Maintaining uniform reporting style All covered by the flying saucer!
  • 16. Script anything! JFreeChart: powerful charting Apache POI: read & write Excel files JODConvertor: convert (almost) anything to anything using OpenOffice.org Swing Hundreds more...
  • 17. References http://github.com/alexandermalfait/acts_as_flying_saucer http://bosmeeuw.wordpress.com/ http://www.catsolutions.be/