Over a million developers have joined DZone.

Vroom Request Dispatcher 1.0.0 Released

DZone's Guide to

Vroom Request Dispatcher 1.0.0 Released

Free Resource

Vroom Request Dispatcher or VRD is a light weight API that helps you write java web applications with simplicity. No need to write servlets that require web.xml configurations. You can use any java method (static or non-static) to provide service.

Using VRD, you maintain a simple configuration file which is used to map url patterns to java methods. The concept is similar to python. Here is the sample:

Following definition blocks access of the web application on Saturday and Sunday

<request pattern=".*" exclude="/access-denied.html">
<invocation method-name="java.util.Date.toString" var="dt" scope="application">
<result pattern="(Sat|Sun).*">
<response url="/access-denied.html"/>

Vroom Request Dispatcher 1.0.0 is released with Scripting Language Extension too. This enables developers to write server side code using their favorite scripting language. Right now there are four scripting languages supported by VRD.

  1. JavaScript - Using net.openkoncept.vroom.vrd.javascript.JavaScriptRequestDispatcher.dispatch
  2. Groovy - Using net.openkoncept.vroom.vrd.groovy.GroovyRequestDispatcher.dispatch
  3. Jython - Using net.openkoncept.vroom.vrd.jython.JythonRequestDispatcher.dispatch
  4. JRuby - Using net.openkoncept.vroom.vrd.jruby.JRubyRequestDispatcher.dispatch

Here is how you configure VRD to provide support for Groovy for example:

<request pattern="/sss/groovy/.*">
<invocation method-name="net.openkoncept.vroom.vrd.groovy.GroovyRequestDispatcher.dispatch"/>

The above configuration dispatches all groovy scripts available at /sss/groovy/ path to GroovyRequestDispatcher.dispatch method. The script must have an entry point defined as a method named vrd_main() as follows:


def vrd_main() {

The java request and response objects become available in the script automatically with names "vrd_hreq" for "request" and "vrd_hres" for "response".

If you use JRuby the you need to use $bsf.lookupBean('vrd_hreq') and $bsf.lookupBean('vrd_hres') methods to lookup these objects. Below is the another example using jruby.

<request pattern="/sss/rb/.*">
<invocation method-name="net.openkoncept.vroom.vrd.jruby.JRubyRequestDispatcher.dispatch">
<result pattern="login_succeed">
<response url="#{contextPath}/welcome.jsp" redirect="true"/>
<result pattern="login_failed">
<response url="/login.jsp"/>

The above configuration dispatches all jruby scripts available at /sss/rb/ path to JRubyRequestDispatcher.dispatch method. The script must have an entry point defined as a method named vrd_main() as follows:


def vrd_main()
vrd_hreq = $bsf.lookupBean('vrd_hreq')
vrd_hres = $bsf.lookupBean('vrd_hres')
email = vrd_hreq.getParameter('email')
password = vrd_hreq.getParameter('password')
if email == password
return "login_succeed"
return "login_failed"

It's fun to write java web applications using these scripting languages for writing servlets. You can use any or all of them together in an application.

Visit the project website to download and use VRD and VRD-SLE (Scripting Language Extensioin) API:


I'll be uploading more learning material soon.














Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}