If you are using a compatible implementation, other than Eclipse Jersey 3.1, please consult documentation which may contain additional details specific for that implementation.
Appendix B: Rebuild Rules |
Previous | Contents |
If you are using a compatible implementation, other than Eclipse Jersey 3.1, please consult documentation which may contain additional details specific for that implementation.
The Jakarta REST 3.1 specification specifies how Jakarta REST applications are to be published in a Java SE environment, Jakarta REST endpoint, or Servlet–compliant Web container.
The Jakarta REST TCK comes with prebuilt test WAR files for
deployment on Jakarta EE 10 CI, Eclipse GlassFish 6.1,
which provides a Servlet–compliant Web
container. The WAR files are Eclipse Jersey 3.1-specific, with Eclipse Jersey 3.1’s servlet
class and Eclipse Jersey 3.1’s servlet defined in the web.xml
deployment
descriptor. To run the TCK tests against the VI in a Servlet–compliant
Web container, the tests need to be repackaged to include the
VI-specific servlet, and the VI-specific servlet must be defined in the
deployment descriptor.
The Jakarta REST TCK makes it easier for the vendor by including template WAR files that contain all of the necessary files except for the VI-specific servlet adaptor class. The Jakarta REST TCK provides a tool to help with the repackaging task.
This appendix contains the following sections:
The classes that ship with the Jakarta REST TCK were built using the Eclipse GlassFish 6.1, Compatible Implementation. The archives for tests are built and deployed in the runtime.
All resource and application class files are already compiled.
All tests also come with a web.xml.template
file that is used
for generating deployment descriptor files.
Each test that has a Jakarta REST resource class to publish, comes with a
template deployment descriptor file. For example, the file
ee/jakarta/tck/ws/rs/ee/rs/get/web.xml.template
contains the following elements:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="5.0" xmlns="https://jakarta.ee/xml/ns/jakartaee" \
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" \
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee \
https://jakarta.ee/xml/ns/jakartaee/web-app_5_0.xsd">
<servlet>
<servlet-name>CTSJAX-RSGET</servlet-name>
<servlet-class>servlet_adaptor</servlet-class>
<init-param>
<param-name>jakarta.ws.rs.core.Application</param-name>
<param-value>ee.jakarta.tck.ws.rs.ee.rs.get.TSAppConfig</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>CTSJAX-RSGET</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
</web-app>
In this example, the <servlet-class>
element has a value of
servlet_adaptor
, which is a placeholder for the
implementation-specific Servlet class. A Eclipse Jersey 3.1-specific
deployment descriptor also comes with the Jakarta REST TCK,
and has the values for the
org.glassfish.jersey.servlet.ServletContainer
:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="5.0" xmlns="https://jakarta.ee/xml/ns/jakartaee" \
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" \
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee \
https://jakarta.ee/xml/ns/jakartaee/web-app_5_0.xsd">
<servlet>
<servlet-name>CTSJAX-RSGET</servlet-name>
<servlet-class>
org/glassfish/jersey/servlet/ServletContainer
</servlet-class>
<init-param>
<param-name>jakarta.ws.rs.core.Application</param-name>
<param-value>ee.jakarta.tck.ws.rs.ee.rs.get.TSAppConfig</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>CTSJAX-RSGET</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
</web-app>
Set the VI Servlet class property.
Set the servlet_adaptor
property as System property. This property
will be used to set the value of the <servlet-class>
element in the
deployment descriptor before packaging and deploying the archive.
Previous | Contents |