- Revision
- 583
- Author
- paul
- Date
- 2008-02-06 15:05:06 -0600 (Wed, 06 Feb 2008)
Log Message
as per Peter Kovac's suggestion
Modified Paths
Diff
Modified: trunk/waffle-distribution/src/site/content/ruby-controllers.html (582 => 583)
--- trunk/waffle-distribution/src/site/content/ruby-controllers.html 2008-02-04 16:19:30 UTC (rev 582) +++ trunk/waffle-distribution/src/site/content/ruby-controllers.html 2008-02-06 21:05:06 UTC (rev 583) @@ -1,15 +1,37 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html> -<head> -<title>Ruby Controllers</title> -</head> -<body> +<html><head> +<title>Ruby Controllers</title></head> - -<h2>Fill me in Mike?</h2> - -say something in release notes too - ERB is mentioned but not Ruby controllers per se, or when. - -</body> - -</html> +<body>Ever wish you could utilize Ruby from your Java based web applications?<br /><br />Waffle, +a Java based Web Framework, now provides built in support for JRuby. +This will allow you to easily write your Controllers in Ruby. The +integration is simple and straightforward, taking advantage of +functionality Waffle provides (without being a Rails clone). <br /><br />A +key feature of Waffle has always been its pluggable architecture. From +the beginning we believed that the default behavior defined by the +Waffle team might not be suitable for every situation. Therefor Waffle +was built following an Interface driven approach. Practically all of +Waffle's built-in functionality can easily be extended or replaced. +This design made integrating JRuby support quite easy. The next 3 steps +give a brief overview of how to integrate JRuby support into your +Waffle based applications.<br /><br />Step 1 - configure Waffle to be "Ruby Aware"<br /><br />Waffle +avoids XML like the plague but we still need to have a web.xml for our +applications. This web.xml is where we can take advantage of Waffle's +pluggability. The following three context-param nodes need to be added +to your applications web.xml. This alerts Waffle that a few of its +foundational components should be replaced with alternate +implementations.<br /><br /><context-param><br /> <param-name>org.codehaus.waffle.context.ContextContainerFactory</param-name><br /> <param-value>org.codehaus.waffle.context.pico.RubyAwarePicoContextContainerFactory</param-value><br /></context-param><br /><context-param><br /> <param-name>org.codehaus.waffle.bind.DataBinder</param-name><br /> <param-value>org.codehaus.waffle.bind.RubyDataBinder</param-value><br /></context-param><br /><context-param><br /> <param-name>org.codehaus.waffle.controller.ControllerDefinitionFactory</param-name><br /> <param-value>org.codehaus.waffle.controller.RubyControllerDefinitionFactory&l t;/param-value><br /></context-param><br /><br />Step +2 - Your application's Registrar should extended +AbstractRubyAwareRegistrar. This exposes a new registration method to +use within your Registrar ... registerRubyScript(String key, String +className). See the example below: <br />public class MyRegistrar extends AbstractRubyAwareRegistrar {<br /><br /> public MyRegistrar(Registrar delegate) {<br /> super(delegate);<br /> }<br /> <br /> @Override<br /> public void application() {<br /> registerRubyScript("foobar", "FooBar");<br /> }<br /> ...<br />}<br /><br />In +this example the Ruby class named 'FooBar' will be exposed as a +Controller under the name 'foobar' (e.g. +http://localhost:8080/jruby/foobar.waffle).<br /><br />Step 3 - Write +your Ruby Controller class. Notice in the following example that your +class does not need to extend or include anything.<br />class FooBar<br /><br /> def index # This is the default action<br /> "<h1>Hello World</h1>"<br /> end<br /> <br />end<br /><br />And +that is all the steps required to integrate JRuby within your Waffle +Applications. In my next post I will uncover details on how to access +registered components from your Ruby based controllers as well as +explain the built in conventions that make writing Ruby controllers so +easy.</body></html> \ No newline at end of file
To unsubscribe from this list please visit:
