SeamFramework.orgCommunity Documentation
The Seam REST module requires a Java EE 6 compliant server such as JBoss Application Server or GlassFish to run on.
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.
Example 1.1. Dependency added to pom.xml
<dependency>
<groupId>org.jboss.seam.rest</groupId>
<artifactId>seam-rest-api</artifactId>
<version>${seam.rest.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.seam.rest</groupId>
<artifactId>seam-rest-impl</artifactId>
<version>${seam.rest.version}</version>
</dependency>
Besides, Seam REST has several transitive dependencies (which are added automatically when using maven). See Table 6.1, “Transitive dependencies” for more details.
The Seam REST module hooks into the exception processing mechanism of JAX-RS by registering
SeamExceptionMapper
. Besides, TemplatingMessageBodyWriter
is registered
to provide templating support.
These components registered by default if classpath scanning
of JAX-RS resources and providers is enabled (an empty javax.ws.rs.coreApplication
is provided).
@ApplicationPath("/api/*")
public class MyApplication extends Application {}
Otherwise, if the Application's getClasses()
method is overriden to select resources and providers explicitly,
SeamExceptionMapper
must be selected as well.
@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;
}
}