Configuration of Endpoints - 6.2

Talend ESB Service Developer Guide

Talend Data Fabric
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Open Studio for ESB
Talend Real-Time Big Data Platform
Design and Development
Installation and Upgrade
Talend ESB

Providing a custom implementation is the only portable way to register root resource and provider classes and indicate what lifecycle model the individual resources follow. For example:

package server;

import java.util.HashSet;
import java.util.Set;

public class BookApplication extends Application {

   public Set<Class<?>> getClasses() {
      Set<Class<?>> classes = new HashSet<Class<?>>();
      return classes;

   public Set<Object> getSingletons() {
      Set<Object> classes = new HashSet<Object>();
      classes.add(new SearchService());
      classes.add(new BookExceptionMapper());
      return classes;

The BookApplication indicates to the runtime that BookStore root resource has the per-request lifecycle. The SearchService root resource and BookExceptionMapper provider are singletons. In CXF one can register JAX-RS Applications in web.xml using a CXFNonSpringJaxrsServlet:

   <display-name>CXF Servlet</display-name>

Spring users can configure the JAX-RS endpoints using one or more jaxrs:server declarations:

<beans xmlns=""

   <import resource="classpath:META-INF/cxf/cxf.xml"/>
   <import resource=
   <import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>

   <bean class="org.apache.cxf.systest.jaxrs.BookStore" id="serviceBean"/>
   <bean class="org.apache.cxf.systest.jaxrs.provider.JAXBElementProvider"
      <!-- customize the default JAXBElementProvider 
           by setting some of its properties -->
   <jaxrs:server id="bookservice" address="/bookstore">
      <ref bean="serviceBean" />

      <ref bean="jaxbProvider"/>

      <!-- Register CXF features such as FastInfoset or Logging -->
      <!-- Register CXF in interceptors, example, reuse common in 
           interceptors between JAX-WS and JAX-RS endpoints -->
      <!-- Register CXF out interceptors, example, reuse common out 
           interceptors between JAX-WS and JAX-RS endpoints -->

A single JAX-RS endpoint is registered with a jaxrs:server declaration. This declaration may reference multiple root resource beans with jaxrs:serviceBeans and multiple providers using jaxrs:providers. Note a jaxrs:server/@address attribute. It allows for registering multiple jaxrs:server endpoints with all of them referencing the same service beans but using differently configured JAX-RS providers.

The jaxrs:server endpoints can register CXF features, in and out CXF interceptors.