11Utility components

Registering optional components

VRaptor has some optional components, inside package br.com.caelum.vraptor.util. For registering them you can add their packages on web.xml:

<context-param>
    <param-name>br.com.caelum.vraptor.packages</param-name>
    <param-value>
        br.com.caelum.vraptor.util.one.package,
        br.com.caelum.vraptor.util.other.package
    </param-value>
</context-param>

Or you can create a custom provider:

Localized Converters

There are some converters for Numbers that are localized, i.e, that consider your current Locale in order to convert request parameters. You can register them by adding the package br.com.caelum.vraptor.converter.l10n to your web.xml:

<context-param>
    <param-name>br.com.caelum.vraptor.packages</param-name>
    <param-value>
        br.com.caelum.vraptor.util.other.packages...,
        br.com.caelum.vraptor.converter.l10n
    </param-value>
</context-param>

Parameters Instantiator: IOGI x OGNL

VRaptor uses IOGI by default as parameter instantiator. If you want to use OGNL you can remove IOGI jar and adding OGNL jars to your application.

ExtJS Integration

There is a View that generates some ExtJS JSON formats. Use:

result.use(ExtJSJson.class).....serialize();

Integration with JPA and Hibernate

There are three sub projects for persistence integrations. For each one you need only to add the jar in your classpath without any other configuration.

The vraptor-jpa project is released without any provider. If you want to use then, you need to declare a provider as you prefer.

To use Hibernate as provider:

  <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-entitymanager</artifactId>
        <version>4.0.1.Final</version>
    </dependency>

To use Eclipselink as provider:

  <dependency>
        <groupId>org.eclipse.persistence</groupId>
        <artifactId>javax.persistence</artifactId>
        <version>2.0.0</version>
    </dependency>