This is an automated email from the ASF dual-hosted git repository.

ahuber pushed a commit to branch spring6
in repository https://gitbox.apache.org/repos/asf/isis.git

commit 36c84d4ed7427ee8665d762b5b97a04fd066e74c
Author: Andi Huber <[email protected]>
AuthorDate: Mon Nov 14 15:25:02 2022 +0100

    ISIS-3275: [Incubating] Migrate from Spring 5.x to Spring 6.x
---
 core/pom.xml                                       |   7 +-
 viewers/restfulobjects/jaxrs-resteasy-4/pom.xml    | 134 --------------------
 .../conneg/RestfulObjectsJaxbWriterForXml.java     |  79 ------------
 .../webmodule/WebModuleJaxrsResteasy4.java         | 139 ---------------------
 viewers/restfulobjects/jaxrs-resteasy/pom.xml      |   2 +-
 .../conneg/RestfulObjectsJaxbWriterForXml.java     |  11 +-
 .../webmodule/WebModuleJaxrsResteasy4.java         |  17 ++-
 7 files changed, 15 insertions(+), 374 deletions(-)

diff --git a/core/pom.xml b/core/pom.xml
index 1244365429..f8b2fa5003 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -623,13 +623,8 @@
                        </dependency>
                        <dependency>
                                <groupId>org.apache.causeway.viewer</groupId>
-<<<<<<< HEAD
-                               
<artifactId>causeway-viewer-restfulobjects-jaxrsresteasy4</artifactId>
-                               <version>3.0.0-SNAPSHOT</version>
-=======
                                
<artifactId>causeway-viewer-restfulobjects-jaxrsresteasy</artifactId>
-                               <version>2.0.0-SNAPSHOT</version>
->>>>>>> refs/remotes/origin/master
+                               <version>3.0.0-SNAPSHOT</version>
                        </dependency>
                        <dependency>
                                <groupId>org.apache.causeway.viewer</groupId>
diff --git a/viewers/restfulobjects/jaxrs-resteasy-4/pom.xml 
b/viewers/restfulobjects/jaxrs-resteasy-4/pom.xml
deleted file mode 100644
index 9f7e75efab..0000000000
--- a/viewers/restfulobjects/jaxrs-resteasy-4/pom.xml
+++ /dev/null
@@ -1,134 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Licensed to the Apache Software Foundation (ASF) under one or more 
contributor 
-       license agreements. See the NOTICE file distributed with this work for 
additional 
-       information regarding copyright ownership. The ASF licenses this file 
to 
-       you under the Apache License, Version 2.0 (the "License"); you may not 
use 
-       this file except in compliance with the License. You may obtain a copy 
of 
-       the License at http://www.apache.org/licenses/LICENSE-2.0 Unless 
required 
-       by applicable law or agreed to in writing, software distributed under 
the 
-       License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 
CONDITIONS 
-       OF ANY KIND, either express or implied. See the License for the 
specific 
-       language governing permissions and limitations under the License. -->
-<project xmlns="http://maven.apache.org/POM/4.0.0";
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
-       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
-       <modelVersion>4.0.0</modelVersion>
-
-       <parent>
-               <groupId>org.apache.causeway.viewer</groupId>
-               <artifactId>causeway-viewer-restfulobjects</artifactId>
-               <version>3.0.0-SNAPSHOT</version>
-       </parent>
-
-       <artifactId>causeway-viewer-restfulobjects-jaxrsresteasy4</artifactId>
-
-       <name>Apache Causeway Viewer - RO (JAX-RS Resteasy v4)</name>
-       <description>
-        JAX-RS plugin using jboss resteasy.
-    </description>
-
-       <properties>
-               
<jar-plugin.automaticModuleName>org.apache.causeway.viewer.restfulobjects.jaxrsresteasy4</jar-plugin.automaticModuleName>
-               
<git-plugin.propertiesDir>org/apache/causeway/viewer.restfulobjects/jaxrsresteasy4</git-plugin.propertiesDir>
-       </properties>
-
-       <build>
-               <resources>
-                       <resource>
-                               <filtering>false</filtering>
-                               <directory>src/main/resources</directory>
-                       </resource>
-                       <resource>
-                               <filtering>false</filtering>
-                               <directory>src/main/java</directory>
-                               <includes>
-                                       <include>**</include>
-                               </includes>
-                               <excludes>
-                                       <exclude>**/*.java</exclude>
-                               </excludes>
-                       </resource>
-               </resources>
-       </build>
-
-       <dependencies>
-
-               <!-- COMPILE DEPENDENCIES -->
-
-               <dependency>
-                       <groupId>org.apache.causeway.viewer</groupId>
-                       
<artifactId>causeway-viewer-restfulobjects-rendering</artifactId>
-                       <exclusions>
-                               <exclusion>
-                                       <groupId>org.jboss.logging</groupId>
-                                       <artifactId>jboss-logging</artifactId>
-                               </exclusion>
-                       </exclusions>
-               </dependency>
-
-               <dependency>
-                       <groupId>org.apache.causeway.viewer</groupId>
-                       
<artifactId>causeway-viewer-restfulobjects-viewer</artifactId>
-                       <scope>compile</scope>
-               </dependency>
-
-
-               <!-- RestEasy -->
-               <dependency>
-                       <groupId>org.jboss.resteasy</groupId>
-                       <artifactId>resteasy-spring-boot-starter</artifactId>
-                       <exclusions>
-                               <exclusion>
-                                       <!-- don't bring in Spring's backlog, 
we use log4j-2 instead -->
-                                       
<groupId>org.springframework.boot</groupId>
-                                       
<artifactId>spring-boot-starter-logging</artifactId>
-                               </exclusion>
-                               <exclusion>
-                                       <groupId>org.jboss.logging</groupId>
-                                       <artifactId>jboss-logging</artifactId>
-                               </exclusion>
-                               <!-- transitively provided by 
causeway-jdk-supplemental -->
-                               <exclusion>
-                                       <groupId>org.ow2.asm</groupId>
-                                       <artifactId>asm</artifactId>
-                               </exclusion>
-                       </exclusions>
-               </dependency>
-
-               <dependency>
-                   <groupId>org.jboss.resteasy</groupId>
-                   <artifactId>resteasy-jaxb-provider</artifactId>
-                   <exclusions>
-                       <exclusion>
-                               <groupId>org.jboss.logging</groupId>
-                               <artifactId>jboss-logging</artifactId>
-                       </exclusion>
-                       <exclusion>
-                               <groupId>org.glassfish.jaxb</groupId>
-                               <artifactId>jaxb-runtime</artifactId>
-                       </exclusion>
-                   </exclusions>
-               </dependency>
-               
-               <!-- TESTING -->
-
-               <dependency>
-                       <groupId>org.apache.causeway.viewer</groupId>
-                       
<artifactId>causeway-viewer-restfulobjects-testing</artifactId>
-                       <scope>test</scope>
-               </dependency>
-
-               <!-- JDO API -->
-               <dependency>
-                       <!-- v3.2 not available yet, use datanucleus staging 
for now -->
-                       <!-- <groupId>javax.jdo</groupId> -->
-                       <!-- <artifactId>jdo-api</artifactId> -->
-                       <groupId>org.datanucleus</groupId>
-                       <artifactId>javax.jdo</artifactId>
-                       <scope>test</scope>
-               </dependency>
-
-       </dependencies>
-
-
-</project>
diff --git 
a/viewers/restfulobjects/jaxrs-resteasy-4/src/main/java/org/apache/causeway/viewer/restfulobjects/jaxrsresteasy4/conneg/RestfulObjectsJaxbWriterForXml.java
 
b/viewers/restfulobjects/jaxrs-resteasy-4/src/main/java/org/apache/causeway/viewer/restfulobjects/jaxrsresteasy4/conneg/RestfulObjectsJaxbWriterForXml.java
deleted file mode 100644
index d48702fd04..0000000000
--- 
a/viewers/restfulobjects/jaxrs-resteasy-4/src/main/java/org/apache/causeway/viewer/restfulobjects/jaxrsresteasy4/conneg/RestfulObjectsJaxbWriterForXml.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-package org.apache.causeway.viewer.restfulobjects.jaxrsresteasy4.conneg;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-
-import jakarta.inject.Inject;
-import jakarta.ws.rs.Produces;
-import jakarta.ws.rs.core.MediaType;
-import jakarta.ws.rs.ext.Provider;
-import jakarta.xml.bind.Marshaller;
-
-import org.jboss.resteasy.plugins.providers.jaxb.JAXBXmlRootElementProvider;
-import org.springframework.stereotype.Component;
-
-import org.apache.causeway.applib.jaxb.PersistentEntityAdapter;
-import org.apache.causeway.applib.services.inject.ServiceInjector;
-
-import lombok.val;
-
-/**
- * @since 1.x {@index}
- */
-@Component
-@Provider
-@Produces({"application/xml", "application/*+xml", "text/*+xml"})
-public class RestfulObjectsJaxbWriterForXml extends JAXBXmlRootElementProvider 
{
-
-    @Inject private ServiceInjector serviceInjector;
-
-    @Override
-    protected boolean isReadWritable(
-            final Class<?> type,
-            final Type genericType,
-            final Annotation[] annotations,
-            final MediaType mediaType) {
-
-        return super.isReadWritable(type, genericType, annotations, mediaType) 
&&
-                hasXRoDomainTypeParameter(mediaType);
-    }
-
-    @Override
-    protected Marshaller getMarshaller(
-            final Class<?> type,
-            final Annotation[] annotations,
-            final MediaType mediaType) {
-
-        val adapter = serviceInjector.injectServicesInto(new 
PersistentEntityAdapter());
-
-        val marshaller = super.getMarshaller(type, annotations, mediaType);
-        marshaller.setAdapter(PersistentEntityAdapter.class, adapter);
-        return marshaller;
-    }
-
-    // HELPER
-
-    private static boolean hasXRoDomainTypeParameter(final MediaType 
mediaType) {
-        final boolean retval = 
mediaType.getParameters().containsKey("x-ro-domain-type");
-        return retval;
-    }
-
-}
diff --git 
a/viewers/restfulobjects/jaxrs-resteasy-4/src/main/java/org/apache/causeway/viewer/restfulobjects/jaxrsresteasy4/webmodule/WebModuleJaxrsResteasy4.java
 
b/viewers/restfulobjects/jaxrs-resteasy-4/src/main/java/org/apache/causeway/viewer/restfulobjects/jaxrsresteasy4/webmodule/WebModuleJaxrsResteasy4.java
deleted file mode 100644
index b24d587ada..0000000000
--- 
a/viewers/restfulobjects/jaxrs-resteasy-4/src/main/java/org/apache/causeway/viewer/restfulobjects/jaxrsresteasy4/webmodule/WebModuleJaxrsResteasy4.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-package org.apache.causeway.viewer.restfulobjects.jaxrsresteasy4.webmodule;
-
-import jakarta.inject.Inject;
-import jakarta.inject.Named;
-import jakarta.servlet.ServletContext;
-import jakarta.servlet.ServletContextListener;
-import jakarta.servlet.ServletException;
-
-import org.jboss.resteasy.core.providerfactory.ResteasyProviderFactoryImpl;
-import org.jboss.resteasy.spi.ResteasyProviderFactory;
-import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.stereotype.Service;
-
-import org.apache.causeway.applib.annotation.PriorityPrecedence;
-import org.apache.causeway.applib.services.inject.ServiceInjector;
-import org.apache.causeway.commons.collections.Can;
-import org.apache.causeway.core.config.CausewayConfiguration;
-import org.apache.causeway.core.config.RestEasyConfiguration;
-import org.apache.causeway.core.webapp.modules.WebModuleAbstract;
-import org.apache.causeway.core.webapp.modules.WebModuleContext;
-import 
org.apache.causeway.viewer.restfulobjects.applib.CausewayModuleViewerRestfulObjectsApplib;
-import 
org.apache.causeway.viewer.restfulobjects.viewer.webmodule.CausewayRestfulObjectsInteractionFilter;
-import 
org.apache.causeway.viewer.restfulobjects.viewer.webmodule.auth.AuthenticationStrategyBasicAuth;
-
-import lombok.Getter;
-import lombok.val;
-
-/**
- * WebModule that provides the RestfulObjects Viewer.
- *
- * @since 2.0 {@index}
- *
- * @implNote CDI feels responsible to resolve injection points for any Servlet 
or Filter
- * we register programmatically on the ServletContext.
- * As long as injection points are considered to be resolved by Spring, we can 
workaround this fact:
- * By replacing annotations {@code @Inject} with {@code @Autowire} for any 
Servlet or Filter,
- * that get contributed by a WebModule, these will be ignored by CDI.
- *
- */
-@Service
-@Named(CausewayModuleViewerRestfulObjectsApplib.NAMESPACE + 
".WebModuleJaxrsRestEasy4") // CAUTION: SwaggerServiceMenu refers to this name
[email protected](PriorityPrecedence.MIDPOINT - 80)
-@Qualifier("JaxrsRestEasy4")
-public final class WebModuleJaxrsResteasy4 extends WebModuleAbstract {
-
-    private static final String INTERACTION_FILTER_NAME = 
"CausewayRestfulObjectsInteractionFilter";
-
-    private final CausewayConfiguration causewayConfiguration;
-    private final RestEasyConfiguration restEasyConfiguration;
-
-    private final String restfulPath;
-    private final String urlPattern;
-
-    @Inject
-    public WebModuleJaxrsResteasy4(
-            final CausewayConfiguration causewayConfiguration,
-            final RestEasyConfiguration restEasyConfiguration,
-            final ServiceInjector serviceInjector) {
-        super(serviceInjector);
-        this.causewayConfiguration = causewayConfiguration;
-        this.restEasyConfiguration = restEasyConfiguration;
-        this.restfulPath = 
this.restEasyConfiguration.getJaxrs().getDefaultPath() + "/";
-        this.urlPattern = this.restfulPath + "*";
-    }
-
-    @Getter
-    private final String name = "JaxrsRestEasy4";
-
-    @Override
-    public void prepare(WebModuleContext ctx) {
-
-        // forces RuntimeDelegate.getInstance() to be provided by RestEasy
-        // (and not by eg. the JEE container if any)
-        ResteasyProviderFactory.setInstance(new ResteasyProviderFactoryImpl());
-
-        super.prepare(ctx);
-
-        if(!isApplicable(ctx)) {
-            return;
-        }
-
-        ctx.addProtectedPath(urlPattern);
-    }
-
-    @Override
-    public Can<ServletContextListener> init(ServletContext ctx) throws 
ServletException {
-
-        val authenticationStrategyClassName = causewayConfiguration.getViewer()
-                .getRestfulobjects().getAuthentication().getStrategyClassName()
-                .orElse(AuthenticationStrategyBasicAuth.class.getName());
-
-        registerFilter(ctx, INTERACTION_FILTER_NAME, 
CausewayRestfulObjectsInteractionFilter.class)
-        .ifPresent(filterReg -> {
-            // this is mapped to the entire application;
-            // however the CausewayRestfulObjectsInteractionFilter will
-            // "notice" if the session filter has already been
-            // executed for the request pipeline, and if so will do nothing
-            filterReg.addMappingForUrlPatterns(
-                    null,
-                    true,
-                    this.urlPattern);
-
-            filterReg.setInitParameter(
-                    "authenticationStrategy",
-                    authenticationStrategyClassName);
-            filterReg.setInitParameter(
-                    "whenNoSession", // what to do if no session was found ...
-                    "auto"); // ... 401 and a basic authentication challenge 
if request originates from web browser
-            filterReg.setInitParameter(
-                    "passThru",
-                    String.join(",",
-                            this.restfulPath + "swagger",
-                            this.restfulPath + "health"));
-
-        } );
-
-        return Can.empty(); // registers no listeners
-    }
-
-
-}
diff --git a/viewers/restfulobjects/jaxrs-resteasy/pom.xml 
b/viewers/restfulobjects/jaxrs-resteasy/pom.xml
index 129448815c..a8d93a2b9b 100644
--- a/viewers/restfulobjects/jaxrs-resteasy/pom.xml
+++ b/viewers/restfulobjects/jaxrs-resteasy/pom.xml
@@ -17,7 +17,7 @@
        <parent>
                <groupId>org.apache.causeway.viewer</groupId>
                <artifactId>causeway-viewer-restfulobjects</artifactId>
-               <version>2.0.0-SNAPSHOT</version>
+               <version>3.0.0-SNAPSHOT</version>
        </parent>
 
        <artifactId>causeway-viewer-restfulobjects-jaxrsresteasy</artifactId>
diff --git 
a/viewers/restfulobjects/jaxrs-resteasy/src/main/java/org/apache/causeway/viewer/restfulobjects/jaxrsresteasy4/conneg/RestfulObjectsJaxbWriterForXml.java
 
b/viewers/restfulobjects/jaxrs-resteasy/src/main/java/org/apache/causeway/viewer/restfulobjects/jaxrsresteasy4/conneg/RestfulObjectsJaxbWriterForXml.java
index d99ef10b13..fb4f36e56e 100644
--- 
a/viewers/restfulobjects/jaxrs-resteasy/src/main/java/org/apache/causeway/viewer/restfulobjects/jaxrsresteasy4/conneg/RestfulObjectsJaxbWriterForXml.java
+++ 
b/viewers/restfulobjects/jaxrs-resteasy/src/main/java/org/apache/causeway/viewer/restfulobjects/jaxrsresteasy4/conneg/RestfulObjectsJaxbWriterForXml.java
@@ -21,18 +21,17 @@ package 
org.apache.causeway.viewer.restfulobjects.jaxrsresteasy4.conneg;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Type;
 
-import javax.inject.Inject;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.ext.Provider;
-import javax.xml.bind.Marshaller;
-
 import org.jboss.resteasy.plugins.providers.jaxb.JAXBXmlRootElementProvider;
 import org.springframework.stereotype.Component;
 
 import org.apache.causeway.applib.jaxb.PersistentEntityAdapter;
 import org.apache.causeway.applib.services.inject.ServiceInjector;
 
+import jakarta.inject.Inject;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.core.MediaType;
+import jakarta.ws.rs.ext.Provider;
+import jakarta.xml.bind.Marshaller;
 import lombok.val;
 
 /**
diff --git 
a/viewers/restfulobjects/jaxrs-resteasy/src/main/java/org/apache/causeway/viewer/restfulobjects/jaxrsresteasy4/webmodule/WebModuleJaxrsResteasy4.java
 
b/viewers/restfulobjects/jaxrs-resteasy/src/main/java/org/apache/causeway/viewer/restfulobjects/jaxrsresteasy4/webmodule/WebModuleJaxrsResteasy4.java
index aabd618734..0163f50566 100644
--- 
a/viewers/restfulobjects/jaxrs-resteasy/src/main/java/org/apache/causeway/viewer/restfulobjects/jaxrsresteasy4/webmodule/WebModuleJaxrsResteasy4.java
+++ 
b/viewers/restfulobjects/jaxrs-resteasy/src/main/java/org/apache/causeway/viewer/restfulobjects/jaxrsresteasy4/webmodule/WebModuleJaxrsResteasy4.java
@@ -18,12 +18,6 @@
  */
 package org.apache.causeway.viewer.restfulobjects.jaxrsresteasy4.webmodule;
 
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletContextListener;
-import javax.servlet.ServletException;
-
 import org.jboss.resteasy.core.providerfactory.ResteasyProviderFactoryImpl;
 import org.jboss.resteasy.spi.ResteasyProviderFactory;
 import org.springframework.beans.factory.annotation.Qualifier;
@@ -40,6 +34,11 @@ import 
org.apache.causeway.viewer.restfulobjects.applib.CausewayModuleViewerRest
 import 
org.apache.causeway.viewer.restfulobjects.viewer.webmodule.CausewayRestfulObjectsInteractionFilter;
 import 
org.apache.causeway.viewer.restfulobjects.viewer.webmodule.auth.AuthenticationStrategyBasicAuth;
 
+import jakarta.inject.Inject;
+import jakarta.inject.Named;
+import jakarta.servlet.ServletContext;
+import jakarta.servlet.ServletContextListener;
+import jakarta.servlet.ServletException;
 import lombok.Getter;
 import lombok.val;
 
@@ -57,7 +56,7 @@ import lombok.val;
  */
 @Service
 @Named(CausewayModuleViewerRestfulObjectsApplib.NAMESPACE + 
".WebModuleJaxrsRestEasy4") // CAUTION: SwaggerServiceMenu refers to this name
[email protected](PriorityPrecedence.MIDPOINT - 80)
[email protected](PriorityPrecedence.MIDPOINT - 80)
 @Qualifier("JaxrsRestEasy4")
 public final class WebModuleJaxrsResteasy4 extends WebModuleAbstract {
 
@@ -85,7 +84,7 @@ public final class WebModuleJaxrsResteasy4 extends 
WebModuleAbstract {
     private final String name = "JaxrsRestEasy4";
 
     @Override
-    public void prepare(WebModuleContext ctx) {
+    public void prepare(final WebModuleContext ctx) {
 
         // forces RuntimeDelegate.getInstance() to be provided by RestEasy
         // (and not by eg. the JEE container if any)
@@ -101,7 +100,7 @@ public final class WebModuleJaxrsResteasy4 extends 
WebModuleAbstract {
     }
 
     @Override
-    public Can<ServletContextListener> init(ServletContext ctx) throws 
ServletException {
+    public Can<ServletContextListener> init(final ServletContext ctx) throws 
ServletException {
 
         val authenticationStrategyClassName = causewayConfiguration.getViewer()
                 .getRestfulobjects().getAuthentication().getStrategyClassName()

Reply via email to