SeamFramework.orgCommunity Documentation

Chapter 35. Installation

35.1. Basics
35.2. Transitive dependencies
35.3. Registering JAX-RS components explicitly

The Seam REST module runs only on Java EE 6 compliant servers such as JBoss Application Server or GlassFish.

To use the Seam REST module, add seam-rest and seam-rest-api jars into the web application. If using Maven, add the following dependency into the web application's pom.xml configuration file.


Besides, Seam REST has several transitive dependencies (which are added automatically when using maven). Refer to Table 40.1, “Transitive dependencies” for more details.

The Seam REST module registers SeamExceptionMapper to hook into the exception processing mechanism of JAX-RS and TemplatingMessageBodyWriter to provide templating support.

These components are registered by default if classpath scanning of JAX-RS resources and providers is enabled (an empty javax.ws.rs.core.Application subclass is provided).

@ApplicationPath("/api/*")

public class MyApplication extends Application {}

Otherwise, if the Application's getClasses() method is overriden to select resources and providers explicitlyy add SeamExceptionMapper and TemplatingMessageBodyWriter.

@ApplicationPath("/api/*")

public class MyApplication extends Application
{
   @Override
   public Set<Class<?>> getClasses()
   {
      Set<Class<?>> classes = new HashSet<Class<?>>();
      ...
      ...
      ...
      classes.add(SeamExceptionMapper.class);
      classes.add(TemplatingMessageBodyWriter.class);
      return classes;
   }
}