friends;
+ if (corsFriends == null || corsFriends.isEmpty()) {
+ friends = Collections.emptySet();
+ } else {
+ friends = Arrays.stream(corsFriends.split(";"))
+ .map(String::trim)
+ .filter(s -> !s.isEmpty())
+ .collect(Collectors.toSet());
+ }
+ return new LyoAppConfiguration(baseUrl, "services", friends);
+ }
+
+ @Produces
+ @Singleton
+ public ResourcesFactory produceResourcesFactory() {
+ return new ResourcesFactory(OSLC4JUtils.getServletURI());
+ }
+}
diff --git a/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/servlet/ServletListener.java b/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/servlet/ServletListener.java
deleted file mode 100644
index 80864dd3..00000000
--- a/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/servlet/ServletListener.java
+++ /dev/null
@@ -1,219 +0,0 @@
-// Start of user code Copyright
-/*******************************************************************************
- * Copyright (c) 2011, 2012 IBM Corporation and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
- *
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- *
- * Sam Padgett - initial API and implementation
- * Michael Fiedler - adapted for OSLC4J
- * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
- * Andrii Berezovskyi - change URL configuration logic (Bug 509767)
- *
- * This file is generated by org.eclipse.lyo.oslc4j.codegenerator
- *******************************************************************************/
-// End of user code
-
-package co.oslc.refimpl.rm.gen.servlet;
-
-// spotless:off
-import java.net.MalformedURLException;
-import java.util.NoSuchElementException;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Optional;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import jakarta.servlet.ServletContext;
-import jakarta.servlet.ServletContextEvent;
-import jakarta.servlet.ServletContextListener;
-import jakarta.servlet.ServletRegistration;
-import jakarta.ws.rs.core.UriBuilder;
-
-import org.eclipse.lyo.oslc4j.core.OSLC4JUtils;
-import co.oslc.refimpl.rm.gen.RestDelegate;
-
-// Start of user code imports
-import org.apache.jena.sys.JenaSystem;
-// End of user code
-// spotless:on
-
-/**
- * During the initialization of this ServletListener, the base URI for the OSLC resources produced by this server is configured through the OSLC4J method setPublicURI().
- *
- * See getConfigurationProperty() for the different alternatives to set this base URI.
- */
-public class ServletListener implements ServletContextListener {
- private static final Logger logger = LoggerFactory.getLogger(ServletListener.class);
-
- // Start of user code class_attributes
- // End of user code
-
- public ServletListener() {
- super();
- }
-
- @Override
- public void contextInitialized(final ServletContextEvent servletContextEvent)
- {
- //These are fallback defaults. We recommend you do not modify them. Instead, set the 'baseurl' property.
- String basePathKey = "baseurl";
- String fallbackBase = "http://localhost:8080";
- String servletName = "JAX-RS Servlet";
-
- logger.info("""
- \n
- :::::::::: :::::::: ::: ::::::::::: ::::::::: :::::::: :::::::::: ::: ::: ::: ::::::::\s
- :+: :+: :+: :+: :+: :+: :+: :+: :+: :+: :+: :+: :+: :+: :+:\s
- +:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+ \s
- +#++:++# +#+ +#+ +#+ +#++:++#+ +#++:++#++ +#++:++# +#+ +#++: +#+ +:+ \s
- +#+ +#+ +#+ +#+ +#+ +#+ +#+ +#+ +#+ +#+ +#+ \s
- #+# #+# #+# #+# #+# #+# #+# #+# #+# #+# #+# #+# #+# \s
- ########## ######## ######### ########## ### ######## ########## ########## ### ######## \s
- """);
-
- // Start of user code contextInitialized_init
- JenaSystem.init();
- OSLC4JUtils.setLyoStorePagingPreciseLimit(false);
- // End of user code
-
- ServletContext servletContext = servletContextEvent.getServletContext();
- String basePathProperty = getConfigurationProperty(basePathKey, fallbackBase, servletContext, ServletListener.class);
- UriBuilder builder = UriBuilder.fromUri(basePathProperty);
- String baseUrl = builder.path(servletContext.getContextPath()).build().toString();
- String servletUrlPattern = "services/";
- try {
- servletUrlPattern = getServletUrlPattern(servletContext, servletName);
- } catch (Exception e1) {
- logger.error("servletListener encountered problems identifying the servlet URL pattern.", e1);
- }
- try {
- logger.info("Setting public URI: " + baseUrl);
- OSLC4JUtils.setPublicURI(baseUrl);
- logger.info("Setting servlet path: " + servletUrlPattern);
- OSLC4JUtils.setServletPath(servletUrlPattern);
- } catch (MalformedURLException e) {
- logger.error("servletListener encountered MalformedURLException.", e);
- } catch (IllegalArgumentException e) {
- logger.error("servletListener encountered IllegalArgumentException.", e);
- }
-
- logger.info("servletListner contextInitialized.");
-
- // Start of user code contextInitialized_mid
- // TODO Implement code to establish connection to data backbone etc ...
- // End of user code
-
- // Start of user code contextInitialized_final
- // End of user code
- }
-
- @Override
- public void contextDestroyed(ServletContextEvent servletContextEvent)
- {
- // Start of user code contextDestroyed_init
- // End of user code
-
- }
-
- // Start of user code class_methods
- private static Optional getBasePathFromSystemProperties(String basePathContextPropertyKey) {
- String base = System.getProperty(basePathContextPropertyKey);
- if (base == null || base.trim().isEmpty()) {
- return Optional.empty();
- }
- return Optional.of(base);
- }
- // End of user code
-
- /**
- * For a property 'scheme', this is the lookup priority:
- *
- *
- * - LYO_SCHEME env variable
- * - %pkg_name%.scheme JVM property, e.g. org.eclipse.lyo.oslc4j.core.servlet.scheme
- * - %pkg_name%.scheme Servlet Context parameter, e.g. org.eclipse.lyo.oslc4j.core.servlet.scheme
- *
- * @param key property key name
- * @param defaultValue default String value
- * @param klass Class of the ServletListener
- * @return value, if found, from ENV, JVM, or Servlet Context (in this order)
- */
- public static String getConfigurationProperty(String key, String defaultValue, final ServletContext servletContext, Class klass) {
- String value = getConfigurationPropertyFromEnvironment(generateEnvironmentKey(key))
- .orElseGet(() -> getConfigurationPropertyFromSystemProperties(generateFullyQualifiedKey(klass, key))
- .orElseGet(() -> getConfigurationPropertyFromContext(servletContext, generateFullyQualifiedKey(klass, key))
- .orElse(defaultValue)));
- return value;
- }
-
- /**
- * property name 'scheme' would become "org.eclipse.lyo.oslc4j.core.servlet.scheme"
- */
- private static String generateFullyQualifiedKey(Class klass, String key) {
- return klass.getPackage().getName() + '.' + key;
- }
-
- /**
- * web.xml property ending in '.scheme' would become "LYO_SCHEME"
- */
- private static String generateEnvironmentKey(String key) {
- return "LYO_" + key.toUpperCase(Locale.ROOT).replace('.', '_');
- }
-
- private static Optional getConfigurationPropertyFromEnvironment(String basePathEnvKey) {
- final Map env = System.getenv();
- if (!env.containsKey(basePathEnvKey)) {
- logger.debug("ENV variable '{}' not defined", basePathEnvKey);
- return Optional.empty();
- }
- logger.info("Found {} env variable", basePathEnvKey);
- return Optional.of(env.get(basePathEnvKey));
- }
-
- private static Optional getConfigurationPropertyFromSystemProperties(String basePathContextPropertyKey) {
- String value = System.getProperty(basePathContextPropertyKey);
- if (value == null || value.trim().isEmpty()) {
- logger.debug("System (JVM) property '{}' not defined", basePathContextPropertyKey);
- return Optional.empty();
- }
- logger.info("Found {} System (JVM) property", basePathContextPropertyKey);
- return Optional.of(value);
- }
-
- private static Optional getConfigurationPropertyFromContext(final ServletContext servletContext, String basePathContextPropertyKey) {
- String value = servletContext.getInitParameter(basePathContextPropertyKey);
- if (value == null || value.trim().isEmpty()) {
- logger.debug("Servlet Context parameter '{}' not defined", basePathContextPropertyKey);
- return Optional.empty();
- }
- logger.info("Found {} context parameter", basePathContextPropertyKey);
- return Optional.of(value);
- }
-
- static String getServletUrlPattern(final ServletContext servletContext, String servletName) throws Exception {
- ServletRegistration servletRegistration = servletContext.getServletRegistration(servletName);
- if (servletRegistration == null) {
- throw new NoSuchElementException("no servlet with name \"" + servletName + "\" is found.");
- }
- java.util.Collection mappings = servletRegistration.getMappings();
- if (mappings.size() != 1) {
- throw new NoSuchElementException("unable to identify servlet mappings for servlet with name \"" + servletName + "\".");
- }
- String mapping = (String) mappings.toArray()[0];
-
- //url patterns in most cases end with '\*'. But a url-pattern with just '\' may be found for exact matches.
- if (mapping.endsWith("*"))
- mapping = mapping.substring(0, mapping.length()-1);
- return mapping;
- }
-}
-
diff --git a/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/util/ServletUtil.java b/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/util/ServletUtil.java
new file mode 100644
index 00000000..a5e0aae0
--- /dev/null
+++ b/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/util/ServletUtil.java
@@ -0,0 +1,30 @@
+package co.oslc.refimpl.rm.gen.util;
+
+import jakarta.servlet.ServletRequest;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletRequestWrapper;
+
+/**
+ * Utility methods for servlet handling, particularly for Undertow compatibility.
+ */
+public class ServletUtil {
+
+ /**
+ * Unwrap the request to get the original HttpServletRequest.
+ * This is required for Undertow compatibility when forwarding requests.
+ *
+ * Undertow validates that requests passed to RequestDispatcher.forward()
+ * are either the original request or properly wrapped. JAX-RS injected
+ * requests may not meet these criteria, so we unwrap to the original.
+ *
+ * @param request the potentially wrapped request
+ * @return the original unwrapped HttpServletRequest
+ */
+ public static HttpServletRequest unwrapRequest(HttpServletRequest request) {
+ ServletRequest current = request;
+ while (current instanceof HttpServletRequestWrapper) {
+ current = ((HttpServletRequestWrapper) current).getRequest();
+ }
+ return (HttpServletRequest) current;
+ }
+}
diff --git a/src/server-rm/src/main/webapp/static/css/adaptor.css b/src/server-rm/src/main/resources/META-INF/resources/static/css/adaptor.css
similarity index 100%
rename from src/server-rm/src/main/webapp/static/css/adaptor.css
rename to src/server-rm/src/main/resources/META-INF/resources/static/css/adaptor.css
diff --git a/src/server-rm/src/main/webapp/static/js/delegated-ui-helper.js b/src/server-rm/src/main/resources/META-INF/resources/static/js/delegated-ui-helper.js
similarity index 100%
rename from src/server-rm/src/main/webapp/static/js/delegated-ui-helper.js
rename to src/server-rm/src/main/resources/META-INF/resources/static/js/delegated-ui-helper.js
diff --git a/src/server-rm/src/main/webapp/static/js/delegated-ui.js b/src/server-rm/src/main/resources/META-INF/resources/static/js/delegated-ui.js
similarity index 100%
rename from src/server-rm/src/main/webapp/static/js/delegated-ui.js
rename to src/server-rm/src/main/resources/META-INF/resources/static/js/delegated-ui.js
diff --git a/src/server-rm/src/main/webapp/static/js/ui-preview-helper.js b/src/server-rm/src/main/resources/META-INF/resources/static/js/ui-preview-helper.js
similarity index 100%
rename from src/server-rm/src/main/webapp/static/js/ui-preview-helper.js
rename to src/server-rm/src/main/resources/META-INF/resources/static/js/ui-preview-helper.js
diff --git a/src/server-rm/src/main/resources/application.properties b/src/server-rm/src/main/resources/application.properties
new file mode 100644
index 00000000..b5b800a5
--- /dev/null
+++ b/src/server-rm/src/main/resources/application.properties
@@ -0,0 +1,16 @@
+co.oslc.refimpl.rm.gen.servlet.baseurl=http://localhost:8800/
+co.oslc.refimpl.rm.gen.servlet.cors.friends=*
+quarkus.http.port=8800
+quarkus.http.root-path=/
+quarkus.resteasy.path=/
+# Allow all origins for CORS by default if needed, but we use custom CorsFilter
+# quarkus.http.cors=true
+
+# Swagger UI configuration
+quarkus.swagger-ui.always-include=true
+quarkus.swagger-ui.path=/swagger-ui
+
+# Application version information
+app.version=${project.version}
+app.lyo.version=${version.lyo}
+app.quarkus.version=${quarkus.platform.version}
diff --git a/src/server-rm/src/main/resources/templates/index.html b/src/server-rm/src/main/resources/templates/index.html
new file mode 100644
index 00000000..8a98cc99
--- /dev/null
+++ b/src/server-rm/src/main/resources/templates/index.html
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+ RM OSLC Adaptor Home
+
+
+
+
+
+
+
+
+
+
Requirements Management (RM) OSLC Adaptor
+
This is the homepage of the RM OSLC adaptor,
+ migrated to Quarkus framework.
+
+
+ Service Provider Catalog
+
+
Start from the Service Provider Catalog to navigate the adaptor's services and resources.
+ Note: HTML representations have been replaced with Qute templates.
+ The catalog returns RDF/XML by default for programmatic access.
+
+
+ Interactive Swagger UI
+
+
Use Swagger UI to interact with the adaptor services.
+
You can also copy this OpenAPI specification document to a
+ Swagger Editor to generate client SDK code for various languages and
+ platforms.
+
+
The OSLC Root Services document is available at /rootservices
+
+
OSLC Reference Implementation {projectVersion}. Powered by Eclipse Lyo {lyoVersion}
+ and Quarkus {quarkusVersion}
+
+
+
+
+
\ No newline at end of file
diff --git a/src/server-rm/src/main/resources/templates/requirementSelector.html b/src/server-rm/src/main/resources/templates/requirementSelector.html
new file mode 100644
index 00000000..2806aeca
--- /dev/null
+++ b/src/server-rm/src/main/resources/templates/requirementSelector.html
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+ Requirement Selection Dialog
+
+
+
+
+
+
Find a specific resource through a free-text search.
+
+
Pondering your search. Please stand by ...
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/server-rm/src/main/webapp/WEB-INF/web.xml b/src/server-rm/src/main/webapp/WEB-INF/web.xml
deleted file mode 100644
index 1286b620..00000000
--- a/src/server-rm/src/main/webapp/WEB-INF/web.xml
+++ /dev/null
@@ -1,75 +0,0 @@
-
-
- RM
-
- Base URI for the adaptor.
- co.oslc.refimpl.rm.gen.servlet.baseurl
- http://localhost:8800/
-
-
-
-
-
- CORS friends
- co.oslc.refimpl.rm.gen.servlet.cors.friends
-
-
-
- *
-
-
-
-
-
-
- Listener for ServletContext lifecycle changes
- co.oslc.refimpl.rm.gen.servlet.ServletListener
-
-
-
-
-
- JAX-RS Servlet
- org.glassfish.jersey.servlet.ServletContainer
-
- jakarta.ws.rs.Application
- co.oslc.refimpl.rm.gen.servlet.Application
-
- 1
-
-
-
-
-
- JAX-RS Servlet
- /services/*
-
-
- CredentialsFilter
- CredentialsFilter
- co.oslc.refimpl.rm.gen.servlet.CredentialsFilter
-
-
- CredentialsFilter
- /services/*
-
-
-
-
-
-
diff --git a/src/server-rm/src/main/webapp/index.jsp b/src/server-rm/src/main/webapp/index.jsp
deleted file mode 100644
index 4fc8e5af..00000000
--- a/src/server-rm/src/main/webapp/index.jsp
+++ /dev/null
@@ -1,63 +0,0 @@
-<%--To avoid the overriding of any manual code changes upon subsequent code generations, disable "Generate JSP Files" option in the Adaptor model.--%>
-
-<%--
- Copyright (c) 2022 Contributors to the Eclipse Foundation
-
- See the NOTICE file(s) distributed with this work for additional
- information regarding copyright ownership.
-
- This program and the accompanying materials are made available under the
- terms of the Eclipse Distribution License 1.0 which is available at
- http://www.eclipse.org/org/documents/edl-v10.php.
-
- SPDX-License-Identifier: BSD-3-Simple
-
- This file is generated by Lyo Designer (https://www.eclipse.org/lyo/)
---%>
-
-<%@page import="org.eclipse.lyo.oslc4j.core.OSLC4JUtils"%>
-<%@page import="jakarta.ws.rs.core.UriBuilder"%>
-<%@page import="java.net.URI"%>
-
-<%@ page language="java" contentType="text/html; charset=UTF-8"
- pageEncoding="UTF-8"%>
-<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
-
-
-
-
-
- Adaptor home
-
-
-
-
- " rel="stylesheet">
-
-
-
-
-
<%= application.getServletContextName() %>
-
This is a homepage of the RM that was generated using
- Eclipse Lyo Toolchain Designer.
-
-
- " role="button">Service Provider
- Catalog
-
-
Start from the Service Provider Catalog, to navigate your adaptor's services and resources, using the available Query capabilities, Selection and Creation Dialogs.
- Note that these are end-user HTML pages, which is very useful for debugging your adaptor.
-
- " role="button">Interactive Swagger UI
-
-
Use Swagger UI To interact with the adaptor services dedicated for RDF.
-
-
You can also copy ">
- this OpenAPI specification document (yaml file) of this adaptor to a ">Swagger
- Editor to generate client SDK code for a number of languages and platforms.
-
-
The OSLC Root Services document is available at <%= UriBuilder.fromUri(OSLC4JUtils.getServletURI()).path("/rootsevices").build() %>
-
-
-
-
diff --git a/src/server-rm/src/test/resources/application.properties b/src/server-rm/src/test/resources/application.properties
new file mode 100644
index 00000000..9dd1f18e
--- /dev/null
+++ b/src/server-rm/src/test/resources/application.properties
@@ -0,0 +1,3 @@
+# Application configuration
+quarkus.http.port=8800
+co.oslc.refimpl.rm.gen.servlet.baseurl=http://localhost:8800/
diff --git a/src/server-rm/tomcat.Dockerfile b/src/server-rm/tomcat.Dockerfile
deleted file mode 100644
index 431f8048..00000000
--- a/src/server-rm/tomcat.Dockerfile
+++ /dev/null
@@ -1,13 +0,0 @@
-FROM docker.io/library/maven:3-eclipse-temurin-21 AS build
-
-COPY . /src
-WORKDIR /src
-RUN mvn -B --no-transfer-progress -DskipTests clean package -pl server-rm -am -Pwith-jstl-impl
-
-FROM docker.io/library/tomcat:10-jre25
-
-# do not write log files, log everything to the Docker daemon
-COPY --from=build /src/server-rm/config/tomcat-log.properties $CATALINA_BASE/conf/logging.properties
-ENV CATALINA_OUT=/dev/null
-
-COPY --from=build /src/server-rm/target/*.war /usr/local/tomcat/webapps/ROOT.war