Jakartize & cleanup after 2.x merge Signed-off-by: jansupol <jan.supol@oracle.com>
diff --git a/docs/src/main/docbook/appendix-properties.xml b/docs/src/main/docbook/appendix-properties.xml index f4de1ba..5f91902 100644 --- a/docs/src/main/docbook/appendix-properties.xml +++ b/docs/src/main/docbook/appendix-properties.xml
@@ -1277,7 +1277,7 @@ <entry> <para> If set to &lit.true; then XML root element tag name for collections will - be derived from <literal>javax.xml.bind.annotation.XmlRootElement</literal> + be derived from <literal>jakarta.xml.bind.annotation.XmlRootElement</literal> annotation value and won't be de-capitalized. </para> <para> @@ -1384,12 +1384,12 @@ <entry> <para> If &lit.true;, the &lit.jersey.client.HttpUrlConnector; (if used) will assume the content length - from the value of <literal>javax.ws.rs.core.HttpHeaders#CONTENT_LENGTH</literal> request + from the value of <literal>jakarta.ws.rs.core.HttpHeaders#CONTENT_LENGTH</literal> request header (if present). </para> <para> When this property is enabled and the request has a valid non-zero content length - value specified in its <literal>javax.ws.rs.core.HttpHeaders#CONTENT_LENGTH</literal> request + value specified in its <literal>jakarta.ws.rs.core.HttpHeaders#CONTENT_LENGTH</literal> request header, that this value will be used as an input to the <literal>java.net.HttpURLConnection#setFixedLengthStreamingMode(int)</literal> method call invoked on the underlying <literal>java.net.HttpURLConnection</literal>. @@ -1398,7 +1398,7 @@ </para> <para> Note that the content length value defined in the request header must exactly match - the real size of the entity. If the <literal>javax.ws.rs.core.HttpHeaders#CONTENT_LENGTH</literal> + the real size of the entity. If the <literal>jakarta.ws.rs.core.HttpHeaders#CONTENT_LENGTH</literal> header is explicitly specified in a request, this property will be ignored and the request entity will be still buffered by the underlying <literal>HttpURLConnection</literal> infrastructure. </para>
diff --git a/docs/src/main/docbook/custom-di.xml b/docs/src/main/docbook/custom-di.xml index c1dd265..407cc2e 100644 --- a/docs/src/main/docbook/custom-di.xml +++ b/docs/src/main/docbook/custom-di.xml
@@ -223,7 +223,7 @@ <para> To make the <literal>HttpSession</literal> injection work without using HK2 API, we will need to create a custom supplier that knows how to extract - &lit.jee6.servlet.HttpSession; out of given &lit.jee6.servlet.HttpServletRequest;. + &lit.jee9.servlet.HttpSession; out of given &lit.jee9.servlet.HttpServletRequest;. <programlisting language="java">import java.util.function.Supplier ... @@ -245,7 +245,7 @@ }</programlisting> Once implemented, the supplier can be used in a custom Jersey &jersey.common.internal.inject.AbstractBinder; - to define the new injection binding for &lit.jee6.servlet.HttpSession;. Finally, the implemented binder + to define the new injection binding for &lit.jee9.servlet.HttpSession;. Finally, the implemented binder can be registered in your &jersey.server.ResourceConfig;: <programlisting language="java">import org.glassfish.jersey.internal.inject.AbstractBinder; @@ -435,9 +435,9 @@ </para> <para> The SessionInjectResolver then looks as follows: -<programlisting language="java">import javax.inject.Inject; +<programlisting language="java">import jakarta.inject.Inject; -import javax.servlet.http.HttpSession; +import jakarta.servlet.http.HttpSession; import org.glassfish.jersey.internal.inject.InjectionResolver; @@ -488,14 +488,14 @@ The &jersey.common.internal.inject.InjectionResolver; can be registered in the with Jersey application &lit.jersey.server.ResourceConfig; as follows: -<programlisting language="java">import javax.ws.rs.core.Feature; +<programlisting language="java">import jakarta.ws.rs.core.Feature; import org.glassfish.jersey.InjectionManagerProvider; import org.glassfish.jersey.internal.inject.AbstractBinder; import org.glassfish.jersey.internal.inject.InjectionManager; -import javax.inject.Singleton; +import jakarta.inject.Singleton; ...
diff --git a/docs/src/main/docbook/dependencies.xml b/docs/src/main/docbook/dependencies.xml index 719c3f7..8aeeafd 100644 --- a/docs/src/main/docbook/dependencies.xml +++ b/docs/src/main/docbook/dependencies.xml
@@ -33,20 +33,50 @@ <title>Java SE Compatibility</title> <para> - <emphasis>3.x branch: </emphasis> + <emphasis>3.0.x branch: </emphasis> <itemizedlist> <listitem> - <para>This user guide refers only to version 3 and above of Jersey, its compatibility is described below</para> + <para>This user guide refers only to version 3.0.x of Jersey, its compatibility is described below.</para> </listitem> <listitem> - <para>Since version 3.0.0* all Jersey components are compiled with Java SE 1.8 target. - It means, that you will need at least Java SE 1.8 to be able to compile and run your application - which uses the latest Jersey 3.x. - All modules however are fully compatible with JDK 11 and above. So, it's possible to use JDK 11+ to - build your app. + <para>Jersey 3.0.x components are compiled with Java SE 1.8 target. + It means, that you will need at least Java SE 1.8 to be able to compile and run your application + which uses the latest Jersey 3.0.x. All modules are also fully compatible with JDK 11 and above - depending on Jersey version. </para> </listitem> </itemizedlist> + <table pgwide="1" frame='all' xml:id="jersey-jdk-compatibility"> + <title>Jersey 3.0.x JDK compatibility</title> + <tgroup cols='3' align='center' colsep='1' rowsep='1'> + <colspec colname='c1'/> + <colspec colname='c2'/> + <colspec colname='c3'/> + <thead> + <row> + <entry>Jersey version</entry> + <entry>JDK min version</entry> + <entry>JDK max version</entry> + </row> + </thead> + <tbody> + <row><entry>3.0.0</entry><entry>1.8</entry><entry>16</entry></row> + <row><entry>3.0.1</entry><entry>1.8</entry><entry>16</entry></row> + <row><entry>3.0.2</entry><entry>1.8</entry><entry>17</entry></row> + <row><entry>3.0.3</entry><entry>1.8</entry><entry>18</entry></row> + <row><entry>3.0.4</entry><entry>1.8</entry><entry>18</entry></row> + <row><entry>3.0.5</entry><entry>1.8</entry><entry>19</entry></row> + <row><entry>3.0.6</entry><entry>1.8</entry><entry>19</entry></row> + <row><entry>3.0.7</entry><entry>1.8</entry><entry>19</entry></row> + <row><entry>3.0.8</entry><entry>1.8</entry><entry>19</entry></row> + <row><entry>3.0.9</entry><entry>1.8</entry><entry>20</entry></row> + <row><entry>3.0.10</entry><entry>1.8</entry><entry>20</entry></row> + <row><entry>3.0.11</entry><entry>1.8</entry><entry>21</entry></row> + <row><entry>3.0.12</entry><entry>1.8</entry><entry>22</entry></row> + <row><entry>3.0.13</entry><entry>1.8</entry><entry>23</entry></row> + <row><entry>3.0.14</entry><entry>1.8</entry><entry>23</entry></row> + </tbody> + </tgroup> + </table> </para> </section> <section>
diff --git a/docs/src/main/docbook/jersey.ent b/docs/src/main/docbook/jersey.ent index 06d9737..6c285ea 100644 --- a/docs/src/main/docbook/jersey.ent +++ b/docs/src/main/docbook/jersey.ent
@@ -60,7 +60,7 @@ <!ENTITY jaxrs.release.uri "https://github.com/eclipse-ee4j/jaxrs-api"> <!ENTITY jaxrs.javadoc.uri "https://jakartaee.github.io/rest/apidocs/&jax-rs.version;/jakarta/ws/rs"> <!ENTITY jaxrs21.javadoc.uri "https://jakartaee.github.io/rest/apidocs/&jax-rs21.version;/javax/ws/rs"> -<!ENTITY jsonb.javadoc.uri "https://javaee.github.io/javaee-spec/javadocs/javax/json/bind"> +<!ENTITY jsonb.javadoc.uri "https://jakarta.ee/specifications/jsonb/2.0/apidocs/jakarta/json/bind"> <!ENTITY jersey.documentation.uri "https://eclipse-ee4j.github.io/jersey.github.io"> <!ENTITY jersey.ext.bean-validation.deps.link "<link xlink:href='&jersey.project-info.uri.prefix;/jersey-bean-validation/dependencies.html'>jersey-bean-validation</link>" >
diff --git a/docs/src/main/docbook/modules.xml b/docs/src/main/docbook/modules.xml index 5981ced..3236c43 100644 --- a/docs/src/main/docbook/modules.xml +++ b/docs/src/main/docbook/modules.xml
@@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright (c) 2013, 2021 Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2013, 2024 Oracle and/or its affiliates. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v. 2.0, which is available at @@ -485,6 +485,14 @@ <entry>Jersey extension module providing support for Mustache templates.</entry> </row> <row> + <entry> + <link xlink:href="https://eclipse-ee4j.github.io/jersey.github.io/project-info/&version;/jersey/project/jersey-mvc-thymeleaf/dependencies.html"> + jersey-mvc-thymeleaf + </link> + </entry> + <entry>Jersey extension module providing support for Thymeleaf templates.</entry> +</row> +<row> <entry> <link xlink:href="https://eclipse-ee4j.github.io/jersey.github.io/project-info/&version;/jersey/project/jersey-proxy-client/dependencies.html"> jersey-proxy-client
diff --git a/ext/spring6/src/test/java/org/glassfish/jersey/server/spring/filter/SpringRequestContextFilterTest.java b/ext/spring6/src/test/java/org/glassfish/jersey/server/spring/filter/SpringRequestContextFilterTest.java new file mode 100644 index 0000000..3e08125 --- /dev/null +++ b/ext/spring6/src/test/java/org/glassfish/jersey/server/spring/filter/SpringRequestContextFilterTest.java
@@ -0,0 +1,69 @@ +/* + * Copyright (c) 2024 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package org.glassfish.jersey.server.spring.filter; + +import org.glassfish.jersey.internal.inject.AbstractBinder; +import org.glassfish.jersey.internal.inject.InjectionManager; +import org.glassfish.jersey.internal.inject.Injections; +import org.glassfish.jersey.server.spring.scope.RequestContextFilter; +import org.junit.jupiter.api.Test; +import org.springframework.context.ApplicationContext; +import org.springframework.web.context.WebApplicationContext; + +import jakarta.ws.rs.container.ContainerRequestContext; +import jakarta.ws.rs.container.ContainerResponseContext; +import java.io.IOException; +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Method; +import java.lang.reflect.Proxy; + +public class SpringRequestContextFilterTest { + @Test + public void testMissingAttributes() throws IOException { + WebApplicationContext webAppCtx = (WebApplicationContext) Proxy.newProxyInstance( + WebApplicationContext.class.getClassLoader(), + new Class[]{WebApplicationContext.class}, + new InvocationHandler() { + @Override + public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { + return null; + } + }); + + InjectionManager injectionManager = Injections.createInjectionManager(); + injectionManager.register(new AbstractBinder() { + @Override + protected void configure() { + bind(webAppCtx).to(ApplicationContext.class); + } + }); + injectionManager.completeRegistration(); + + ContainerRequestContext requestContext = (ContainerRequestContext) Proxy.newProxyInstance( + ContainerRequestContext.class.getClassLoader(), + new Class[]{ContainerRequestContext.class}, + new InvocationHandler() { + @Override + public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { + return null; + } + }); + + RequestContextFilter filter = new RequestContextFilter(injectionManager); + filter.filter(requestContext, (ContainerResponseContext) null); + } +}