Monday, June 18, 2007

Spring + JRuby on Rails

I've only been threatening to do this for a year, but I finally added the necessary stuff to have JRuby on Rails talking to Spring. There's a lot more to come here, but this controller code demonstrates being able to get ahold of a Spring WebApplicationContext in a Ruby on Rails controller.

class TestservletController < ApplicationController
include Java
import javax.servlet.ServletContext
import org.springframework.web.context.WebApplicationContext
import org.springframework.web.context.support.WebApplicationContextUtils

def showcontext
app_context = WebApplicationContextUtils.getWebApplicationContext($servlet_context)
render_text app_context.display_name
end
end


In order for this to work, you'll have to use the very latest goldspike-snapshot plugin from SVN trunk. I just checked in the code to expose $servlet_context earlier today. Obviously this code will only work using a servlet container, and you'll need to have Spring and necessary deps in WEB-INF/lib and have the Spring context loader listener in your web.xml. From here, my next step is some metaprogramming to allow you to add spring bean accessors into your controllers.

21 comments:

Adrian Marti said...

jruby/ruby newbie here.. i'm guessing the usual command for getting goldspike is not going to pull your patch correct?

script/plugin install svn://rubyforge.org/var/svn/jruby-extras/trunk/rails-integration/plugins/goldspike

if not, could you let me know the correct command?

thanks!

Adrian Marti said...

that should be

script/plugin install svn://rubyforge.org/var/svn
... /jruby-extras/trunk
... /rails-integration/plugins
... /goldspike

Ryan Platte said...

Tyler Jennings got this running outside a servlet container:

Spring IOC in JRuby - life outside the container

gfutfy said...

This momentousdecree wow gold came as a great beacon gold in wow light of hope buy wow gold to millions of negroslaves wow gold kaufen who had been seared in the flames of withering injustice.maplestory mesos it came as a joyous daybreak to end the long night ofcaptivity.but one hundred years later,maplestory money we must face the tragic fact thatthe negro is still not free.maple money one hundred years later,sell wow gold the lifeof the negro is still sadly crippled by the manacles ofsegregation and the chains of discrimination. one hundred yearslater,maple story money the negro lives on a lonely island of poverty in themidst of a vast ocean of material prosperity.wow powerleveling one hundred yearslater,maple story power leveling the negro is still languishing in the corners of americansociety and finds himself an exile in his own land. so we havecome here today to dramatize wow powerleveln an appalling condition.in a ms mesos sense we have come to our nation''s capital to cash a check.when the architects of our republic wow powerleveln wrote the magnificent wordsof the constitution and the declaration of independence, theywere signing a promissory note maplestory power leveling to which every american was tofall heir.

wow gold said...

Weekends to peopleig2tmean that they can have a two-day wowgold4europe good rest. For example, people gameusdcan go out to enjoy themselves or get meinwowgoldtogether with relatives and friends to talk with each storeingameother or watch interesting video tapes with the speebiewhole family.
Everyone spends agamegoldweekends in his ownmmoflyway. Within two days,some people can relax themselves by listening to music, reading novels,or watchingogeworld films. Others perhaps are more active by playing basketball,wimming ormmorpgvipdancing. Different people have different gamesavorrelaxations.
I often spend weekends withoggsalemy family or my friends. Sometimes my parents take me on a visit to their old friends. Sometimesgamersell I go to the library to study or borrow some books tommovirtexgain much knowledge. I also go to see various exhibition to broadenrpg tradermy vision. An excursion to seashore or mountain resorts is my favorite way of spending weekends. Weekends are always enjoyable for me.
igxe swagvaultoforu wowgold-usaignmax wowgoldlivebrogame thsaleGoldRockU

Adi said...

Find Internet Marketing resource hare Online Marketing Strategy Internet Marketing Tools Online Marketing Campaign Online Marketing Business Online Marketing System Online Business Online Home Business Online Business Tips Internet Marketing Online Online Marketing Affiliate Marketing Online Marketing Success Selling Online Free Online Marketing Online Marketing Tools Online Marketing Blog

nike said...

Nike shoes
puma shoes
Cheap nike shoes
NIKE’s headquartered in Beaverton, Oregon.Nike may be one of the youngest of the major brands, but it is the dominant brand around the world.In 1963-1964 when University of Portland track coach, Bill Bowerman, and Phil Knight, a mid-distance runner joined forces to import and provide low-cost, high tech running shoes from Japan in order to provide alternatives to the German-dominated athletic shoe market.
Discount nike shoes
Wholesale nike shoes
Nike shox r4
Operating under the name Blue Ribbon Sports, Bowerman and Knight began to sell the Japanese Onitsuke Tiger (Nike SB) running shoes. Jeff Johnson, a former rival of Knight, joins the company in 1965 as their first full-time salesperson and sells shoes from the back of his van at local and regional track meets until opening Blue Ribbon Sports’ first retail outlet at 3107 Pico Blvd, Santa Monica California.
nike shox shoes
nike air max
nike running shoes
The Superstar is one of the first designs the Adidas manufactured.The tongue is leather on the outside and cloth of the inside and is thick enough to feel padded, but thin enough to not feel like an obstruction. The heel of the shoe holds up well the curve of the front is great for any kind of feet.
cheap puma shoes
discount puma shoes
nike air max tn
Therefore, Adidas is a collection of trust and respect. Product and marketing initiatives at Adidas primarily focus on five global priorities: football, running, training, basketball and Adidas Originals sneakers. Adidas sports the recognizable logo of three slanted parallel bars of ascending height.
puma mens shoes
puma running shoes
wholesale puma shoes
Everybody like beauty, which is quite commen, especailly womens. Welcom to our store which is focused on sellingghd hair straighteners mk4and hair straightners. For women, especially the young girls, this ghd iv styler hair straightener is the best choice. ghd hair straightners is famouse for the pretty outlook and the top quality. The price of this cheap ghd hair straighteners is acceptable and rational. Ed Hardy Jeans, Ed Hardy Hoodies ed hardy shirts ed hardy clothes ed hardy clothing
ed hardy trousers

Adi said...

Oes Tsetnoc one of the ways in which we can learn seo besides Mengembalikan Jati Diri Bangsa. By participating in the Oes Tsetnoc or Mengembalikan Jati Diri Bangsa we can improve our seo skills. To find more information about Oest Tsetnoc please visit my Oes Tsetnoc pages. And to find more information about Mengembalikan Jati Diri Bangsa please visit my Mengembalikan Jati Diri Bangsa pages. Thank you So much.
Oes Tsetnoc | Semangat Mengembalikan Jati Diri Bangsa

jimmychooshoes said...

mcqueen shoes
alexander mcqueen heels
Alexander McQueen Store
Jimmy Choo sale
Replica jimmy choo shoes
manolo blahnik online store
manolo shoes
manolo blahnik sale
replica christian louboutin shoes
discount christian louboutin shoes
alexander mcqueen shoes
jimmy choo outlet
jimmy choos
jimmy shoes
Manolo Blahnik Shoes
christian shoes
Christian Louboutin Alta Perla Strass 100 sandals
Christian Louboutin - Declic leather pumps
Manolo Blahnik Something Blue Satin Pump
Manolo Blahnik Satin Jeweled d'Orsay Pump

aiya said...

Office 2010is powerful!
Microsoft Office 2010is the best software in the world.
Microsoft wordis so great!
Office 2007makes life great!
Many people likeMicrosoft Office.
Microsoft Office 2007is welcomed by the whole world.
Office 2007 keyis available here.
Office 2007 downloadis on sale now!
Office 2007 Professionalbring me so much convenience.
Outlook 2010 make life wonderful!
Microsoft outlook is my love.
Microsoft outlook 2010 is convenient!
Windows 7 is convenient!

2010 Wedding Dresses said...

thanks for your sharing! great helpful!!!Thank you
Louboutin Shoes 
Christian Louboutin Shoes
Christian Louboutin Pumps 
louboutin
Christian Louboutin Boots 
Christian Louboutin Pumps
Christian Louboutin Heels 
Christian Louboutin Sandal
Pigalle Christian Louboutin 
fur boots
christian louboutin fur boots
louboutin pumps
louboutin fur boots
coyote fur boots
christian louboutin heels
silver strappy sandals
christian louboutin toundra
loubitan studded bow peep
Wedding Dress Shops
vintage wedding dresses 
wedding dresses
cheap mobile phone
Wedding Dress Shops
Wedding Dresses 2011
Wedding Dress Shops
Off the Shoulder Wedding Dresses
bridal jackets
wedding jackets
bridal jackets
halter neck wedding dresses
off the shoulder wedding dresses
vintage wedding dresses
wedding dresses with sleeves
wedding jackets for the bride

Friday said...

The louboutin heels is designed for the ladies. Since the pumps was born, the ladies life become colorful. The christian louboutin thong sandals are the god's masterwork. Who invited thechristian louboutin pumps? Seldom people knew, but I think every lady would be grateful for him. Among the countless pumps, the christian louboutin platforms is the most outstanding ones. The elegant pattern, the delicate style all mold the ladies perfect leg profile. Flowers in the spring of 2011 creeping, up from hair to clothes continue to footwear, have had a brilliant up. In such a glamor, spring and summer flowers now here. Romance is a woman's mood, exquisite flowers just right of expression in our gestures, the woman, how can we not love the romantic temperament so that they distributed the flowers do? 2011 flowers bloom will enjoy different poses!The christian louboutin wedges also can adds the hright of the ladies, it bring surprise to the short lady. Especially the red sole of the louboutin heels, magic and sexy, many ladies are crazy. The red sole, the first feature of the Christian Louboutin stroe.

teramoney said...

Tera gold
wow gold

Tera gold
Tera Item
Tera account

buy eden gold
Runescape gold
buy Runescape gold

Adim said...

Great information on your site here. I love this post because we can get some useful information from your blog. I expect more post from you guys.

Advertising Logo

李小 said...

You'll be able to possibly acquire vid step additionallyDiablo 3 Items and also have the initially mention of the springtime coffee bean technique change on its own so that it does not have to experience application_context.get_bean() each time. Undecided GW2 Goldit'd create a big difference, but it is a choice.

AntoL-Nyo said...

HD kaliteli porno izle ve boşal.
Bayan porno izleme sitesi.
Bedava ve ücretsiz porno izle size gelsin.
Liseli kızların ve Türbanlı ateşli hatunların sikiş filmlerini izle.
Siyah karanlık odada porno yapan evli çift.
harika Duvar Kağıtları bunlar
tamamen ithal duvar kağıdı olanlar var

shorry june said...

Love this! Sure makes biking
android phone cheap look fun! :)

Ada Bush said...

Since I have studied this poems, I knowed best cheap android phones that wirting a great poems is difficult. Also I think the techology is so important~

AntoL-Nyo said...

Ben istanbuldan selda 22 yaşında konfeksiyon içşisiyim Amatör Porno sizleri bekletmeden hemen hikayeme geçiyorum.. Biz 5 katlı bir binanın en üst katında yaşıyorduk ve bir öğlen paydosunda sevgilim beni Anal Sikiş aradı evdeydim çünkü evle iş yerim arasında 2 dakika bile yoktu.. Bende Asyalı Porno sevgilime benden telefon beklemesini söyledikten sonra evin durumuna baktım evde kardeşlerim ve annemin Esmer Porno birkaçtane arkadaşı vardı bu iş imkansızdı tekrardan düşündüm ve çatı katı aklıma geldi sevgilime telefon açıp çatıya çıkmasını ve Fantazi Porno beni beklemesini söyledikten sonra telefonu bir süre elime almadım anneme işe gidiyorum dedikten sonra Gay Porno hemen üst kata çatıya çıkıp sevgilimin
dudaklarına yumuldum az bir süremiz Götten Sikiş vardı ve çok istiyordum onu hemen önünde diz çöküp sikini çıkardım kocaman olmuştu bile... Özlemişti beni HD Porno bitanem başladım sikini yalamaya kafasını öpüyor onu çıldırtıyordum sevgilim saçlarımdan tutmuş ağzımı keyifle sikerken çatı katının kapısı açıldı toparlanamadan Lezbiyen Porno komşunun şişman oğlu efecan gelmişti ben dizlerimin üzerinde sevgilimin Liseli Porno siki ağzımda yakalanmıştım hemen bu halimizi gören komşu oğlu Sarışın Sikiş kaçarcasına gitti.. Sevgilim bir süre güldükten Türbanlı Porno sonra bu şişko neden kaçtı korktu herhalde onu sikicem sandı galiba dedikten sonra bir kahkaha daha attı ben sevgilimin Türk Porno sikine deli gibi saldırıyor yalıyor emiyordum boşalmasını istiyor Zenci Porno sütünü içmek istiyordum sevgilim ağzımı sike sike boşaldı hepsini yuttum bir damlasını ziyan Porno etmedim ve sevgilimle vedalaşıp ayrıldık... Ben her defasında sikiş yapmadan önce yazporno diye olan türkçe siteden Porno izle bölümüne girip seyrediyorum azdıktan sonra şahane sikiş ile gözleri kamaştırıyorum.

Jessica Colin said...

Sometimes I get so sick of the way women present themselves online, and flatter their way into relationships with perfect strangers on social media in order to increase their own popularity, that I want to puke. I envision writing a whole post on the subject someday, but since that’s probably not gonna happen cause I’m

www.wv-medical-negligence-lawyer.com |

automotive-law |

http://www.butgem-programcilik-egitimi.com |

www.customsoftwaremasters.com |

findabusinessaddress.com |

im16 |

http://www.moleculareconomics.com |

www.qrgl-technology.org |

subito2.co.uk |

yonsetravel |

Amna Khan said...

Hi. You have given such an interesting account of the events. The reaction would have certainly proved some of the communities. But personally I feel that you made the right decision. You just need to give it some time to settle down
resourcesworkforce.com |

http://www.camorhino.com |

studentsfirstmi.com |

http://www.apron2apronsisters.com |

adamoagency.com |