Towards Rack 2.0

12 views
Skip to first unread message

Christian Neukirchen

unread,
Apr 1, 2009, 9:51:18 AM4/1/09
to Rack Development

While the coming Rack 1.0 has been proven useful for small sites, it
is by no means sufficient for the requirements of today's Enterprise.
I therefore propose Rack 2.0, where we adopt several important design
decisions from J2EE:

* Rack applications now need to subclass from
Org::Chneukirchen::Rack::AbstractApplication and implement these
methods: #init, #service, #destroy. Instead of getting an env hash
and returning a tuple, #service now gets two opaque objects,
instances of Org::Chneukirchen::Rack::AbstractRequest and
Org::Chneukirchen::Rack::AbstractResponse. To generate output,
simply run response.getWriter.println("foo"). Imperative
programmers will love it! Don't forget to #close the writer, though.

* Rackup, which obviously was just a quick hack, gets converted from a
DSL to a proper XML configuration file, for example:

<?xml version="1.0" encoding="UTF-8"?>
<rackup id="hello-rack" version="2.4" xmlns="http://chneukirchen.org/xml/ns/rackup"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://chneukirchen.org/xml/ns/rackup.xsd">
<display-name>A Rack 2.0 application</display-name>
<filter>
<filter-name>ServletMappedDoFilter_Filter</filter-name>
<filter-class>tests.Filter.DoFilter_Filter</filter-class>
<init-param>
<param-name>attribute</param-name>
<param-value>tests.Filter.DoFilter_Filter.SERVLET_MAPPED</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>ServletMappedDoFilter_Filter</filter-name>
<url-pattern>/DoFilterTest</url-pattern>
<dispatcher>REQUEST</dispatcher>
</filter-mapping>
<listener>
<listener-class>tests.ServletRequestListener.RequestListener</listener-class>
</listener>
<servlet>
<servlet-name>welcome</servlet-name>
<servlet-class>WelcomeServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>ServletErrorPage</servlet-name>
<servlet-class>tests.Error.ServletErrorPage</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>welcome</servlet-name>
<url-pattern>/hello.welcome</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>ServletErrorPage</servlet-name>
<url-pattern>/ServletErrorPage</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>hello.welcome</welcome-file>
</welcome-file-list>
<error-page>
<exception-type>IndexError</exception-type>
<location>/ServletErrorPage</location>
</error-page>
<error-page>
<error-code>404</error-code>
<location>/error404.html</location>
<error-page>
</rackup>

This belongs to WEB-INF/rack.xml in the .rar file (see below).

* To generate Rack application sceletons, a new tool called "raven" is
introduced. Creating a new Rack application is as simple as

rvn archetype:create -U \
-DarchetypeGroupId=org.chneukirchen.rack \
-DarchetypeArtifactId=rack-archetype-basic \
-DarchetypeVersion=1.0 \
-DremoteRepositories=http://chneukirchen.org/repos/rack \
-DgroupId=org.chneukirchen.rack.hello -DartifactId=hello-rack

* For deployment, we now use .rar files that contain Rubygems and the
stuff generated by raven. Just stuff everything in there and pay
people to deploy it to you. This will create a whole new Ruby
industry.

I hope you'll enjoy these new features and Rack 2.0 will become
popular in The Enterprise.

--
Christian Neukirchen <chneuk...@gmail.com> http://chneukirchen.org

Adrian Madrid

unread,
Apr 1, 2009, 10:03:14 AM4/1/09
to rack-...@googlegroups.com
Good one! Don't forget XSL transformations!

Adrian Madrid
My eBiz, Developer
3082 W. Maple Loop Dr
Lehi, UT 84043
801-341-3824

sbfaulkner

unread,
Apr 1, 2009, 10:49:34 AM4/1/09
to Rack Development
snicker snicker

Michael Frawley

unread,
Apr 1, 2009, 5:40:45 PM4/1/09
to rack-...@googlegroups.com
+1 on the fluent interface provided by that custom xml dsl.  Much safer than executing ruby code, especially considering it could be used to override methods on built in classes.

I know its early, but maybe we should start thinking about rack 3.0 development.  I think automatic deployment in the cloud should be the focus, preferably on the azure platform, which is built on top of the rock-solid .NET framework.  The browsers are the cloud!

˙∆˚ 

spicyj

unread,
Apr 2, 2009, 7:05:59 PM4/2/09
to Rack Development
(In case someone comes along later reading this, notice the date on
the message!)

Christian Neukirchen

unread,
Apr 3, 2009, 10:53:19 AM4/3/09
to rack-...@googlegroups.com
spicyj <spicyj...@gmail.com> writes:

> (In case someone comes along later reading this, notice the date on
> the message!)

Or look in the headers. ;-)

Reply all
Reply to author
Forward
0 new messages