Wednesday, July 30, 2008

How to setup a web project for Vroom Framework?

Well the detailed procedure is available at http://en.wikipedia.org/wiki/Vroom_Framework#Installation_and_Configuration

In order to setup a web project to work with Vroom Framework, you need to do the following:

  1. Download the latest distribution from Project's website and extract it in the folder you normally use for CLASSPATH or Java Libraries. In my case, I use C:\ClassPath (Windows) and /home/ijazfx/classpath (Linux) for my Java Libraries so I've the library available at C:\ClassPath\Vroom-2.1.4
  2. Create a web project if it's not already there.
  3. Copy the contents under C:\ClassPath\Vroom-2.1.4\WEB-INF\ to project's \WEB-INF\ folder.
  4. Define VroomFilter and VroomController in the web.xml as follows and you're done with the setup:

<filter>
    <filter-name>VroomFilter</filter-name>
    <filter-class>net.openkoncept.vroom.VroomFilter</filter-class>
    <init-param>
        <param-name>config-file</param-name>
        <param-value>/WEB-INF/vroom-config.xml</param-value>
    </init-param>
</filter>
<filter-mapping>
    <filter-name>VroomFilter</filter-name>
    <url-pattern>*.jsp</url-pattern>
</filter-mapping>
<servlet>
    <servlet-name>VroomController</servlet-name>
    <servlet-class>net.openkoncept.vroom.VroomController</servlet-class>
    <init-param>
        <param-name>upload-file-size-threshold</param-name>
        <param-value>1024000</param-value>
    </init-param>
    <init-param>
        <param-name>upload-file-temp-folder</param-name>
        <param-value>/WEB-INF/temp</param-value>
    </init-param>
</servlet>
<servlet-mapping>
    <servlet-name>VroomController</servlet-name>
    <url-pattern>/vroom</url-pattern>
</servlet-mapping>

If you want to use Vroom Framework with your Struts or JSF application, add additional filter-mapping to intercept *.do or *.faces requests as follows:

For Struts Application:

<filter-mapping>
    <filter-name>VroomFilter</filter-name>
    <url-pattern>*.do</url-pattern>
</filter-mapping>

For JSF Application:

<filter-mapping>
    <filter-name>VroomFilter</filter-name>
    <url-pattern>*.faces</url-pattern>
</filter-mapping>



About the framework

The framework has potential to address almost any possible need of a J2EE web application. However, it solely depends upon how it has been configured and if not properly configured, you may get frustrated and quit using the framework. Which in fact will be a great loss on your side because it is actually quite simple to address complex issues in few minutes with this framework, which may take hours otherwise. Web application issues such as automatic log out, redirecting based on browser locale, protecting resources using custom security etc don't need to be pondered upon anymore.

Please visit Vroom Framework at Wikipedia to know about the framework.