8. Tapestry 5 integration

RESThub provides some simple tools to facilitate integration between RESThub and its tools and Tapestry5 Framework. These tools are packaged into a dedicated multi-module.

This multi-module resthub sub-project contains 4 modules related to Tapestry5+RESThub integration.

You can find a complete example of usage of these tools in the sample application : https://github.com/pullrequest/resthub/tree/resthub-1.1/resthub-apps/booking/booking-tapestry5

8.1. Tapestry 5 components

This artefact provides some additional and useful Tapestry5 components and mixins (not directly related to resthub).

For the moment, one unique component :
  • a ZoneUpdater allowing to update dynamically in AJAX a page zone from a form field. See full usage sample here : java class and tml

This artefact can and should hold some other components if needed.

8.1.1. Configuration

To use it, add to your pom dependencies :

<dependency>
   <groupId>org.resthub</groupId>
   <artifactId>resthub-tapestry5-components</artifactId>
   <version>1.1</version>
</dependency>

8.2. Tapestry 5 JPA

This artefact provides some advanced features related to tapestry5 and jpa integration, one of the core resthub tool. This artefact is based on the Tynamo Tapestry5 JPA integration

It allows, for example, to manage JPA entities objects in page and components parameters while seeing only id in url. This is allowed by the fact that the artifact maintains a opened session and wrap calls to serialization and deserialization in order to retrieve an object from its id. Sample here

This artefact provides also a complete integration between JPAEntityManager managed by Tapestry and those defined by Spring, another core tool of resthub. This is made possible by a dedicated configuration Tapestry 5 Module injecting the entityManagerFactory bean, considered as already defined by Spring.

You can provide your own module in your application and complete or override this one in case of specific configurations.

8.2.1. Configuration

To use it, add to your pom dependencies :

<dependency>
   <groupId>org.resthub</groupId>
   <artifactId>resthub-tapestry5-jpa</artifactId>
   <version>1.1</version>
</dependency>

8.3. Tapestry 5 spring security

This artefact provides some advanced features related to tapestry5 and spring security integration. This artefact is based on the localhost.nu Tapestry5 Spring Security integration.

It allows to integrate Tapestry5 and Spring authentication and authorization mechanisms and provide some helpers and dedicated services in order to manage in Tapestry5 pages :

  • login :

    wrap login methods and allow to perform a programmatic login : samples here and here (see Authenticator)

  • signin :

    wrap signin methods and allow to perform a programmatic signin : Sample

  • logout :

    wrap logout methods and allows to perform a programmatic logout : Sample

This artifact provides also some security components to use in your tml (see here).

This is configured by a dedicated Tapestry5 Spring Security configuration that you have to add to your application (see here for a sample). This configuration file defines all options fo spring security integration.

8.3.1. Configuration

To use it, add to your pom dependencies :

<dependency>
   <groupId>org.resthub</groupId>
   <artifactId>resthub-tapestry5-spring-security</artifactId>
   <version>1.1</version>
</dependency>

8.4. Tapestry 5 integration

This artifact is a simple wrapper to integrate other Resthub Tapestry5 contributions to make things easier.

It provides a global Tapestry5 configuration module to integrate tapestry-jpa and tapestry-components modules.

This artifact also include the configuration for Tapestry5 and BeanValidation integration : see here.

This inclusion is possible thanks to the @SubModule annotation.

This artifact does not integrate tapestry-spring-security to not force its usage.

You can configure the integration of this artifact by providing in your application a dedicated Tapestry5 module and/or overriding these modules (see sample).

8.4.1. Configuration

To use it, add to your pom dependencies :

<dependency>
   <groupId>org.resthub</groupId>
   <artifactId>resthub-tapestry5-integration</artifactId>
   <version>1.1</version>
</dependency>