Jakarta RESTful Web Services Adapter

Tip

This function was called “JAX-RS Adapter” until Nablarch5. However, as Java EE was transferred to the Eclipse Foundation and the specification name changed, the name was changed to “Jakarta RESTful Web Services Adapter”.

Only the name has changed, there is no functional difference.

For other features renamed in Nablarch 6, see Regarding features that have been renamed in Nablarch 5 and 6.

Provides the following adapter to use in RESTful web service.

Module list

<!-- When using jackson adapter -->
<dependency>
  <groupId>com.nablarch.integration</groupId>
  <artifactId>nablarch-jackson-adaptor</artifactId>
</dependency>

<!-- When using the Jersey adapter -->
<dependency>
  <groupId>com.nablarch.integration</groupId>
  <artifactId>nablarch-jersey-adaptor</artifactId>
</dependency>

<!-- When using RESTEasy adapter -->
<dependency>
  <groupId>com.nablarch.integration</groupId>
  <artifactId>nablarch-resteasy-adaptor</artifactId>
</dependency>

Tip

Tests are conducted using jackson version 2.17.1. When changing the version, test in the project to confirm that there are no problems.

Tip

Due to the vulnerability of Jackson1-based libraries, support for Jackson1-based libraries is discontinued from Nablarch5u16. If you have been using Jackson1-based libraries, you should migrate to Jackson2-based libraries.

[Reference information]

Using RESTful web services under Jersey environment

If the implementation of Jakarta RESTful Web Services(external site) bundled with the web application server is Jersey(external site) , use the adapter for Jersey.

An application of Jersey adapter is shown below.

For JaxRsMethodBinderFactory#setHandlerList, a factory class that constructs a Jersey handler (JerseyJaxRsHandlerListFactory) is factory injected. As a result, the following handler configurations for Jersey are automatically configured.

<component name="packageMapping" class="nablarch.integration.router.RoutesMapping">
  <property name="methodBinderFactory">
    <component class="nablarch.fw.jaxrs.JaxRsMethodBinderFactory">
      <property name="handlerList">
        <!-- Factory injection of Jersey handler queue to the handlerList property -->
        <component class="nablarch.integration.jaxrs.jersey.JerseyJaxRsHandlerListFactory"/>
      </property>
    </component>
  </property>

  <!-- Properties other than the above are omitted  -->
</component>

Tip

If Jackson (external site) is not bundled with the web application server to be used, deploy the Jackson module with the application module as a set.

Using RESTful web services under RESTEasy environment

If the implementation of Jakarta RESTful Web Services (external site) bundled with the web application server is RESTEasy (external site) , use the adapter for RESTEasy.

An application of RESTEasy adapter is shown below.

For JaxRsMethodBinderFactory#setHandlerList, a factory class that constructs a RESTEasy handler (ResteasyJaxRsHandlerListFactory) is factory injected. As a result, the following handler configurations for RESTEasy are automatically configured.

<component name="packageMapping" class="nablarch.integration.router.RoutesMapping">
  <property name="methodBinderFactory">
    <component class="nablarch.fw.jaxrs.JaxRsMethodBinderFactory">
      <property name="handlerList">
        <!-- Factory injection of RESTEasy handler queue to the handlerList property -->
        <component class="nablarch.integration.jaxrs.resteasy.ResteasyJaxRsHandlerListFactory"/>
      </property>
    </component>
  </property>

  <!-- Properties other than the above are omitted -->
</component>

Tip

If Jackson (external site) is not bundled with the web application server to be used, deploy the Jackson module with the application module as a set.

To change (add) the body converter used in each environment

If the MIME to be supported in the project increases, support by implementing JaxRsHandlerListFactory.

For the implementation method, refer to this adapter (JerseyJaxRsHandlerListFactory, ResteasyJaxRsHandlerListFactory).