Skip to content

Commit

Permalink
Issue #10688 add Jetty 12.0.x ee8 osgi (#10711)
Browse files Browse the repository at this point in the history
* Add OSGi for ee8 environment

Signed-off-by: Olivier Lamy <olamy@apache.org>
Co-authored-by: Jan Bartel <janb@webtide.com>
Co-authored-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
  • Loading branch information
3 people authored Oct 27, 2023
1 parent 3608d67 commit 8ba5ff1
Show file tree
Hide file tree
Showing 62 changed files with 3,033 additions and 46 deletions.
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def mavenBuild(jdk, cmdline, mvnName) {
buildCache = useBuildCache()
if (buildCache) {
echo "Using build cache"
extraArgs = " -Dmaven.build.cache.restoreGeneratedSources=false -Dmaven.build.cache.remote.url=dav:http://nginx-cache-service.jenkins.svc.cluster.local:80 -Dmaven.build.cache.remote.enabled=true -Dmaven.build.cache.remote.save.enabled=true -Dmaven.build.cache.remote.server.id=remote-build-cache-server "
extraArgs = " -Dmaven.build.cache.restoreGeneratedSources=false -Dmaven.build.cache.remote.url=http://nginx-cache-service.jenkins.svc.cluster.local:80 -Dmaven.build.cache.remote.enabled=true -Dmaven.build.cache.remote.save.enabled=true -Dmaven.build.cache.remote.server.id=remote-build-cache-server -Daether.connector.http.supportWebDav=true "
} else {
// when not using cache
echo "Not using build cache"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public Object addingBundle(Bundle bundle, BundleEvent event)
{
try
{
String serverName = (String)bundle.getHeaders().get(OSGiServerConstants.MANAGED_JETTY_SERVER_NAME);
String serverName = bundle.getHeaders().get(OSGiServerConstants.MANAGED_JETTY_SERVER_NAME);

if ((StringUtil.isBlank(serverName) && _managedServerName.equals(OSGiServerConstants.MANAGED_JETTY_SERVER_DEFAULT_NAME)) ||
(!StringUtil.isBlank(serverName) && (serverName.equals(_managedServerName))))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ public void lifeCycleStarted(LifeCycle event)
{
Files.deleteIfExists(_filePath);
writer.write(((ServerConnector)event).getLocalPort());
writer.close();
}
catch (Exception e)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledOnOs;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.api.parallel.Isolated;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsInAnyOrder;
Expand All @@ -70,6 +71,7 @@
import static org.junit.jupiter.api.condition.OS.WINDOWS;

@ExtendWith(WorkDirExtension.class)
@Isolated("Access static FileSystemPool.INSTANCE.mounts()")
public class FileSystemResourceTest
{

Expand Down
2 changes: 1 addition & 1 deletion jetty-ee8/jetty-ee8-annotations/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
<configuration>
<instructions>
<Import-Package>${osgi.slf4j.import.packages},org.objectweb.asm;version="[$(version;==;${asm.version}),$(version;+;${asm.version}))",*</Import-Package>
<Require-Capability>osgi.extender; filter:="(osgi.extender=osgi.serviceloader.registrar)", osgi.serviceloader; filter:="(osgi.serviceloader=jakarta.servlet.ServletContainerInitializer)";resolution:=optional;cardinality:=multiple, osgi.extender; filter:="(osgi.extender=osgi.serviceloader.processor)";resolution:=optional</Require-Capability>
<Require-Capability>osgi.extender; filter:="(osgi.extender=osgi.serviceloader.registrar)", osgi.serviceloader; filter:="(osgi.serviceloader=javax.servlet.ServletContainerInitializer)";resolution:=optional;cardinality:=multiple, osgi.extender; filter:="(osgi.extender=osgi.serviceloader.processor)";resolution:=optional</Require-Capability>
<Provide-Capability>osgi.serviceloader; osgi.serviceloader=org.eclipse.jetty.ee8.webapp.Configuration</Provide-Capability>
</instructions>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,14 @@
<Export-Package>!org.example*</Export-Package>
<!-- the test webapp is configured via a jetty xml file
in order to add the security handler. -->
<Web-ContextPath>/</Web-ContextPath>
<Web-ContextPath>/ee8-demo-jetty</Web-ContextPath>
<!-- in fact the '.' must not be there
but Felix-BND has a bug:
http://www.mail-archive.com/users@felix.apache.org/msg04730.html
https://issues.apache.org/jira/browse/FELIX-1571
-->
<Bundle-ClassPath>.,WEB-INF/classes</Bundle-ClassPath>
<Jetty-Environment>ee8</Jetty-Environment>
</instructions>
</configuration>
</plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,23 @@ directory, additional configuration may be specified and hot deployments
detected.
===================================================================== -->

<Configure class="org.eclipse.jetty.ee9.webapp.WebAppContext">
<Configure class="org.eclipse.jetty.ee8.webapp.WebAppContext">

<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Required minimal context configuration : -->
<!-- + contextPath -->
<!-- + war OR baseResource -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<Set name="contextPath">/</Set>
<Set name="war"><SystemProperty name="jetty.home" default="."/>/webapps/ee9-demo-jetty.war</Set>
<Set name="war"><SystemProperty name="jetty.home" default="."/>/webapps/ee8-demo-jetty.war</Set>

<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Optional context configuration -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<Set name="extractWAR">true</Set>
<Set name="copyWebDir">false</Set>
<Set name="defaultsDescriptor"><SystemProperty name="jetty.home" default="."/>/etc/webdefault-ee9.xml</Set>
<Set name="overrideDescriptor"><SystemProperty name="jetty.base" default="."/>/etc/ee9-demo-override-web.xml</Set>
<Set name="defaultsDescriptor"><SystemProperty name="jetty.home" default="."/>/etc/webdefault-ee8.xml</Set>
<Set name="overrideDescriptor"><SystemProperty name="jetty.base" default="."/>/etc/ee8-demo-override-web.xml</Set>

<!-- virtual hosts
<Set name="virtualHosts">
Expand Down
4 changes: 3 additions & 1 deletion jetty-ee8/jetty-ee8-demos/jetty-ee8-demo-jsp-webapp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,12 @@
<supportedProjectType>war</supportedProjectType>
</supportedProjectTypes>
<instructions>
<Import-Package>javax.servlet.jsp.*;version="[3,4)",org.eclipse.jetty.*;version="[$(version;===;${parsedVersion.osgiVersion}),$(version;==+;${parsedVersion.osgiVersion}))",*</Import-Package>
<!--Import-Package>javax.servlet.jsp.*;version="[2,3)",org.eclipse.jetty.*;version="[$(version;===;${parsedVersion.osgiVersion}),$(version;==+;${parsedVersion.osgiVersion}))",*</Import-Package-->
<Import-Package>javax.servlet.jsp;version="[2.2.0,4.1)",javax.servlet.jsp.tagext;version="[2.2.0,4.1)",java.io,java.lang,java.text,java.util,javax.servlet;version="[4.0.0,5)",javax.servlet.http;version="[4.0.0,5)"</Import-Package>
<Export-Package>!org.example.*</Export-Package>
<Web-ContextPath>/ee8-demo-jsp</Web-ContextPath>
<Bundle-ClassPath>.,WEB-INF/classes</Bundle-ClassPath>
<Jetty-Environment>ee8</Jetty-Environment>
</instructions>
</configuration>
</plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<Bundle-SymbolicName>org.eclipse.jetty.ee8.demos.ee8-demo-mock-resources</Bundle-SymbolicName>
<Bundle-Description>Mock resources used for testing</Bundle-Description>
<Export-Package>org.example;version="${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}"</Export-Package>
<Import-Package>javax.sql, jakarta.transaction;version="1.3.3"</Import-Package>
<Import-Package>javax.sql, javax.transaction;version="1.3.3"</Import-Package>
<_nouses>true</_nouses>
</instructions>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<Bundle-SymbolicName>org.eclipse.jetty.ee8.demos.ee8-demo-servlet-container-initializer;singleton:=true</Bundle-SymbolicName>
<Bundle-Description>A bundle containing a ServletContainerInitializer for testing</Bundle-Description>
<Require-Capability>osgi.extender; filter:="(osgi.extender=osgi.serviceloader.registrar)"</Require-Capability>
<Provide-Capability>osgi.serviceloader; osgi.serviceloader=jakarta.servlet.ServletContainerInitializer</Provide-Capability>
<Provide-Capability>osgi.serviceloader; osgi.serviceloader=javax.servlet.ServletContainerInitializer</Provide-Capability>
<Export-Package>org.example.initializer;version="${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}"</Export-Package>
<_nouses>true</_nouses>
</instructions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,13 @@
<instructions>
<Bundle-Description>Test Webapp for Servlet 5.0 Features</Bundle-Description>
<!-- TODO Add 'org.eclipse.jetty.util;version="[9.4.19,9.4.20)",' below, once 9.4.19 is released with a fix for #3726 -->
<Import-Package>jakarta.transaction*;version="2.0.0", jakarta.servlet*;version="[5,6)", org.eclipse.jetty*;version="[$(version;===;${parsedVersion.osgiVersion}),$(version;==+;${parsedVersion.osgiVersion}))", org.eclipse.jetty.webapp;version="[$(version;===;${parsedVersion.osgiVersion}),$(version;==+;${parsedVersion.osgiVersion}))";resolution:="optional", org.eclipse.jetty.plus.jndi;version="[$(version;===;${parsedVersion.osgiVersion}),$(version;==+;${parsedVersion.osgiVersion}))";resolution:="optional", org.example;version="${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}", *</Import-Package>
<Import-Package>javax.transaction*;version="[1.1,2.0)", javax.servlet*;version="[2.6,4.1)", org.eclipse.jetty*;version="[$(version;===;${parsedVersion.osgiVersion}),$(version;==+;${parsedVersion.osgiVersion}))", org.eclipse.jetty.webapp;version="[$(version;===;${parsedVersion.osgiVersion}),$(version;==+;${parsedVersion.osgiVersion}))";resolution:="optional", org.eclipse.jetty.plus.jndi;version="[$(version;===;${parsedVersion.osgiVersion}),$(version;==+;${parsedVersion.osgiVersion}))";resolution:="optional", org.example;version="${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}", *</Import-Package>
<_nouses></_nouses>
<Export-Package>org.example.test;version="${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}";-noimport:=true</Export-Package>
<Web-ContextPath>/</Web-ContextPath>
<Bundle-ClassPath>.,WEB-INF/classes,WEB-INF/lib</Bundle-ClassPath>
<Jetty-ContextFilePath>/META-INF/plugin-context.xml</Jetty-ContextFilePath>
<Jetty-ContextFilePath>META-INF/plugin-context.xml</Jetty-ContextFilePath>
<Jetty-Environment>ee8</Jetty-Environment>
</instructions>
</configuration>
</plugin>
Expand Down
2 changes: 1 addition & 1 deletion jetty-ee8/jetty-ee8-jndi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<extensions>true</extensions>
<configuration>
<instructions>
<Import-Package>${osgi.slf4j.import.packages},jakarta.mail.*;resolution:=optional,*</Import-Package>
<Import-Package>${osgi.slf4j.import.packages},javax.mail.*;resolution:=optional,*</Import-Package>
</instructions>
</configuration>
</plugin>
Expand Down
Loading

0 comments on commit 8ba5ff1

Please sign in to comment.