diff --git a/pax-web-spi/pom.xml b/pax-web-spi/pom.xml index e7f3972da0..04a077139a 100644 --- a/pax-web-spi/pom.xml +++ b/pax-web-spi/pom.xml @@ -36,6 +36,7 @@ + org.apache.maven.plugins maven-dependency-plugin @@ -58,6 +59,7 @@ + org.apache.maven.plugins maven-antrun-plugin @@ -86,31 +88,31 @@ - - javax.servlet;version="[3.1,5)", - javax.servlet.annotation;version="[3.1,5)", - javax.servlet.descriptor;version="[3.1,5)", - javax.servlet.http;version="[3.1,5)", - - javax.websocket;version="[1.1,2)";resolution:=optional, - javax.websocket.server;version="[1.1,2)";resolution:=optional, - - - org.osgi.dto;version="[1.0,2)", - org.osgi.framework;version="[1.8,2)", - org.osgi.framework.dto;version="[1.0,2)", + + jakarta.servlet;version="[6,7)", + jakarta.servlet.annotation;version="[6,7)", + jakarta.servlet.descriptor;version="[6,7)", + jakarta.servlet.http;version="[6,7)", + + jakarta.websocket;version="[2.1,3)";resolution:=optional, + jakarta.websocket.server;version="[2.1,3)";resolution:=optional, + + + org.osgi.dto;version="[1.1,2)", + org.osgi.framework;version="[1.10,2)", + org.osgi.framework.dto;version="[1.8,2)", org.osgi.framework.wiring;version="[1.2,2)", org.osgi.util.tracker;version="[1.5,2)", - org.osgi.service.http;version="[1.2,2)", - org.osgi.service.http.context;version="[1.1,2)", - org.osgi.service.http.whiteboard;version="[1.1,2)", - org.osgi.service.http.runtime;version="[1.1,2)", - org.osgi.service.http.runtime.dto;version="[1.1,2)", + org.osgi.service.servlet.context;version="[1.1,2)", + org.osgi.service.servlet.whiteboard;version="[1.1,2)", + org.osgi.service.servlet.runtime;version="[1.1,2)", + org.osgi.service.servlet.runtime.dto;version="[1.1,2)", org.ops4j.pax.web.service;version="${pax-web.osgi.version}", + org.ops4j.pax.web.service.http;version="${pax-web.osgi.version}", org.ops4j.pax.web.service.views;version="${pax-web.osgi.version}", org.ops4j.pax.web.utils;version="${pax-web.osgi.version}", @@ -168,13 +170,18 @@ osgi.core provided + + org.osgi + org.osgi.service.servlet + provided + org.apache.felix org.apache.felix.utils - + jakarta.servlet @@ -187,6 +194,12 @@ provided true + + jakarta.websocket + jakarta.websocket-client-api + provided + true + @@ -197,7 +210,7 @@ org.apache.logging.log4j - log4j-slf4j-impl + log4j-slf4j2-impl test @@ -227,8 +240,13 @@ - junit - junit + org.junit.jupiter + junit-jupiter-api + test + + + org.junit.jupiter + junit-jupiter-engine test diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/ServerController.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/ServerController.java index a41db805c3..fa04bc220b 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/ServerController.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/ServerController.java @@ -17,7 +17,7 @@ package org.ops4j.pax.web.service.spi; import java.net.URL; -import javax.servlet.Servlet; +import jakarta.servlet.Servlet; import org.ops4j.pax.web.service.spi.config.Configuration; import org.ops4j.pax.web.service.spi.model.events.ServerListener; @@ -103,16 +103,16 @@ public interface ServerController { * directory *
  • {@code base} - if the "base" is not an absolute file: directory URL, this parameter will be treated * as prefix for the resource access as defined in Http/Whiteboard Service specifications (access via - * {@link org.osgi.service.http.HttpContext#getResource(String)} or - * {@link org.osgi.service.http.context.ServletContextHelper#getResource(String)}.
  • + * {@link org.ops4j.pax.web.service.http.HttpContext#getResource(String)} or + * {@link org.osgi.service.servlet.context.ServletContextHelper#getResource(String)}. * * * @param urlBase if the "base" is found to be proper, accessible {@code file:} based directory, it is passed * to this creation method and {@code base} can be safely ignored * @param base According to HttpService and Whiteboard specifications, this is the base location for * resource fetching. By default this base is prepended to a path and (combined) used as argument - * to {@link org.osgi.service.http.HttpContext#getResource(String)} or - * {@link org.osgi.service.http.context.ServletContextHelper#getResource(String)}. It should not end with + * to {@link org.ops4j.pax.web.service.http.HttpContext#getResource(String)} or + * {@link org.osgi.service.servlet.context.ServletContextHelper#getResource(String)}. It should not end with * slash ({@code /}) and can be an empty string (meaning root of the bundle). * @return */ diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/WarManager.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/WarManager.java index 084e008326..01b0e844df 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/WarManager.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/WarManager.java @@ -23,7 +23,7 @@ * * @author Hiram Chirino */ -@Review("Extend and integrate with org.osgi.service.http.runtime.HttpServiceRuntime for Karaf commands/services" +@Review("Extend and integrate with org.osgi.service.servlet.runtime.HttpServiceRuntime for Karaf commands/services" + " like org.apache.karaf.web.WebContainerService and org.apache.karaf.http.core.ServletService") public interface WarManager { diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/config/ServerConfiguration.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/config/ServerConfiguration.java index a50aee908a..cf7a481ba2 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/config/ServerConfiguration.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/config/ServerConfiguration.java @@ -23,7 +23,7 @@ public interface ServerConfiguration { /** - * Returns the temporary directory, directory that will be set as {@link javax.servlet.ServletContext#TEMPDIR}. + * Returns the temporary directory, directory that will be set as {@link jakarta.servlet.ServletContext#TEMPDIR}. * * @return the temporary directory */ diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/config/SessionConfiguration.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/config/SessionConfiguration.java index 746e41327f..d06ff0f138 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/config/SessionConfiguration.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/config/SessionConfiguration.java @@ -16,11 +16,11 @@ package org.ops4j.pax.web.service.spi.config; import java.io.File; -import javax.servlet.SessionCookieConfig; +import jakarta.servlet.SessionCookieConfig; /** *

    While some session configuration parameters (those specified in {@code web.xml} and - * {@link javax.servlet.SessionCookieConfig}) can be specified through {@link org.ops4j.pax.web.service.WebContainer} + * {@link jakarta.servlet.SessionCookieConfig}) can be specified through {@link org.ops4j.pax.web.service.WebContainer} * and during WAR deployment, some server-specific options can be configured only globally through * {@link org.ops4j.pax.web.service.PaxWebConstants#PID}.

    * @@ -28,7 +28,7 @@ */ public interface SessionConfiguration { - // --- configuration that matches web.xml and javax.servlet.SessionCookieConfig + // --- configuration that matches web.xml and jakarta.servlet.SessionCookieConfig /** * {@code /} - returns the time in minutes after which an inative settion times out. @@ -85,7 +85,7 @@ public interface SessionConfiguration { */ String getSessionCookieSameSite(); - // --- configuration that's not related to web.xml or javax.servlet.SessionCookieConfig + // --- configuration that's not related to web.xml or jakarta.servlet.SessionCookieConfig /** * Allows configuration of Jetty's SessionHandler.SessionIdPathParameterName. By default it's {@code jsessionid}. diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/context/DefaultHttpContext.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/context/DefaultHttpContext.java index d3b89614b8..f015f64d56 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/context/DefaultHttpContext.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/context/DefaultHttpContext.java @@ -21,16 +21,16 @@ import java.util.LinkedHashSet; import java.util.Objects; import java.util.Set; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.ServletContext; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.ops4j.pax.web.service.PaxWebConstants; import org.ops4j.pax.web.service.WebContainerContext; import org.ops4j.pax.web.service.spi.util.Path; import org.osgi.framework.Bundle; -import org.osgi.service.http.HttpContext; -import org.osgi.service.http.HttpService; +import org.ops4j.pax.web.service.http.HttpContext; +import org.ops4j.pax.web.service.http.HttpService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -172,7 +172,7 @@ public int hashCode() { * @return */ protected URL getResource(Bundle bundle, String name) { - // "name" is passed from javax.servlet.ServletContext.getResource() which always should start with a slash + // "name" is passed from jakarta.servlet.ServletContext.getResource() which always should start with a slash final String normalizedName = Path.normalizeResourcePath(name); LOG.trace("Searching bundle [" + bundle + "] for resource [" + normalizedName + "]"); return bundle.getResource(normalizedName); diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/context/DefaultMultiBundleWebContainerContext.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/context/DefaultMultiBundleWebContainerContext.java index 77a6c38944..856e31c71b 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/context/DefaultMultiBundleWebContainerContext.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/context/DefaultMultiBundleWebContainerContext.java @@ -21,8 +21,8 @@ import java.util.Queue; import java.util.Set; import java.util.concurrent.ConcurrentLinkedQueue; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.ops4j.pax.web.service.MultiBundleWebContainerContext; import org.osgi.framework.Bundle; diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/context/DefaultServletContextHelper.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/context/DefaultServletContextHelper.java index df9cca91ac..b46c9469ec 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/context/DefaultServletContextHelper.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/context/DefaultServletContextHelper.java @@ -18,11 +18,11 @@ import java.io.IOException; import java.net.URL; import java.util.Set; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.osgi.framework.Bundle; -import org.osgi.service.http.context.ServletContextHelper; +import org.osgi.service.servlet.context.ServletContextHelper; /** * Default {@link ServletContextHelper} as specified in "140.2 The Servlet Context". Actually there's no need diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/context/UniqueWebContainerContextWrapper.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/context/UniqueWebContainerContextWrapper.java index 25bbd51383..c8c7392913 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/context/UniqueWebContainerContextWrapper.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/context/UniqueWebContainerContextWrapper.java @@ -18,8 +18,8 @@ import java.io.IOException; import java.net.URL; import java.util.Set; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.ops4j.pax.web.service.WebContainerContext; import org.osgi.framework.Bundle; diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/context/WebContainerContextWrapper.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/context/WebContainerContextWrapper.java index 11ff3f2183..d07a05249c 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/context/WebContainerContextWrapper.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/context/WebContainerContextWrapper.java @@ -18,17 +18,17 @@ import java.io.IOException; import java.net.URL; import java.util.Set; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.ops4j.pax.web.service.WebContainerContext; import org.osgi.framework.Bundle; -import org.osgi.service.http.HttpContext; -import org.osgi.service.http.context.ServletContextHelper; +import org.ops4j.pax.web.service.http.HttpContext; +import org.osgi.service.servlet.context.ServletContextHelper; /** * A simple wrapper to enclose custom {@link HttpContext http contexts} (which gets registered directly to the - * {@link org.osgi.service.http.HttpService}) or {@link ServletContextHelper} (registered via Whiteboard service) + * {@link org.ops4j.pax.web.service.http.HttpService}) or {@link ServletContextHelper} (registered via Whiteboard service) * in an implementation of {@link org.ops4j.pax.web.service.WebContainerContext}. */ public class WebContainerContextWrapper extends DefaultHttpContext { diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/context/package-info.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/context/package-info.java index 5aff4e02b7..0b32dff693 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/context/package-info.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/context/package-info.java @@ -15,7 +15,7 @@ */ /** - *

    This package provides various implementations of {@link org.osgi.service.http.HttpContext} and + *

    This package provides various implementations of {@link org.ops4j.pax.web.service.http.HttpContext} and * {@link org.ops4j.pax.web.service.WebContainerContext} to be used in:

      *
    • Http Service implementation in pax-web-runtime bundle
    • *
    • Whiteboard Service implementation in pax-web-extender-whiteboard bundle
    • @@ -24,7 +24,7 @@ *

      Unique implementations are wrappers for existing instances of * {@link org.ops4j.pax.web.service.WebContainerContext} and * {@link org.ops4j.pax.web.service.MultiBundleWebContainerContext} because Http Service specification says - * that {@link org.osgi.service.http.HttpService#createDefaultHttpContext()} returns new instance on each call, + * that {@link org.ops4j.pax.web.service.http.HttpService#createDefaultHttpContext()} returns new instance on each call, * however we don't want these new instances to refer to different internal representations of the contexts. *

      */ diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/ContextKey.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/ContextKey.java index bb07cc8e88..e8467b32bc 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/ContextKey.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/ContextKey.java @@ -20,7 +20,7 @@ import org.ops4j.pax.web.service.WebContainerContext; import org.ops4j.pax.web.service.spi.context.WebContainerContextWrapper; import org.osgi.framework.Bundle; -import org.osgi.service.http.HttpContext; +import org.ops4j.pax.web.service.http.HttpContext; public class ContextKey { diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/ModelRegistrationException.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/ModelRegistrationException.java index a3c7e4d92e..7ad9ece57a 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/ModelRegistrationException.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/ModelRegistrationException.java @@ -15,9 +15,9 @@ */ package org.ops4j.pax.web.service.spi.model; -import javax.servlet.ServletException; +import jakarta.servlet.ServletException; -import org.osgi.service.http.NamespaceException; +import org.ops4j.pax.web.service.http.NamespaceException; /** * Special {@link RuntimeException} to handle checked exceptions thrown from {@link ModelRegistrationTask} diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/ModelRegistrationTask.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/ModelRegistrationTask.java index 95ba49edf4..65b90f7b43 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/ModelRegistrationTask.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/ModelRegistrationTask.java @@ -15,9 +15,9 @@ */ package org.ops4j.pax.web.service.spi.model; -import javax.servlet.ServletException; +import jakarta.servlet.ServletException; -import org.osgi.service.http.NamespaceException; +import org.ops4j.pax.web.service.http.NamespaceException; /** * A task that can be passed to {@link ServerModel#run(ModelRegistrationTask)} to ensure running it in diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/OsgiContextModel.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/OsgiContextModel.java index b544e619f2..29b075854d 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/OsgiContextModel.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/OsgiContextModel.java @@ -26,12 +26,12 @@ import java.util.Set; import java.util.function.BiFunction; import java.util.function.Function; -import javax.servlet.ServletConfig; -import javax.servlet.ServletContext; -import javax.servlet.SessionCookieConfig; -import javax.servlet.descriptor.JspConfigDescriptor; -import javax.servlet.descriptor.JspPropertyGroupDescriptor; -import javax.servlet.descriptor.TaglibDescriptor; +import jakarta.servlet.ServletConfig; +import jakarta.servlet.ServletContext; +import jakarta.servlet.SessionCookieConfig; +import jakarta.servlet.descriptor.JspConfigDescriptor; +import jakarta.servlet.descriptor.JspPropertyGroupDescriptor; +import jakarta.servlet.descriptor.TaglibDescriptor; import org.ops4j.pax.web.service.PaxWebConstants; import org.ops4j.pax.web.service.WebContainerContext; @@ -48,18 +48,18 @@ import org.osgi.framework.Constants; import org.osgi.framework.FrameworkUtil; import org.osgi.framework.ServiceReference; -import org.osgi.service.http.HttpContext; -import org.osgi.service.http.context.ServletContextHelper; -import org.osgi.service.http.runtime.dto.DTOConstants; -import org.osgi.service.http.runtime.dto.FailedServletContextDTO; -import org.osgi.service.http.runtime.dto.ServletContextDTO; -import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; +import org.ops4j.pax.web.service.http.HttpContext; +import org.osgi.service.servlet.context.ServletContextHelper; +import org.osgi.service.servlet.runtime.dto.DTOConstants; +import org.osgi.service.servlet.runtime.dto.FailedServletContextDTO; +import org.osgi.service.servlet.runtime.dto.ServletContextDTO; +import org.osgi.service.servlet.whiteboard.HttpWhiteboardConstants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** *

      This class represents OSGi-specific {@link HttpContext}/{@link ServletContextHelper} - * and points to single, server-specific {@link javax.servlet.ServletContext} and (at model level) to single + * and points to single, server-specific {@link jakarta.servlet.ServletContext} and (at model level) to single * {@link ServletContextModel}. It maps directly 1:1 to an OSGi service registered by user:

        *
      • {@link HttpContext} with legacy Pax Web servier registration properties
      • *
      • {@link ServletContextHelper} with standard properties and/or annotations
      • @@ -109,7 +109,7 @@ *

      * *

      Shadowing {@link OsgiContextModel} (see - * {@link org.osgi.service.http.runtime.dto.DTOConstants#FAILURE_REASON_SHADOWED_BY_OTHER_SERVICE}) can happen + * {@link org.osgi.service.servlet.runtime.dto.DTOConstants#FAILURE_REASON_SHADOWED_BY_OTHER_SERVICE}) can happen * only when there's name/id conflict, so:

        *
      • When there are two contexts with same name and different context path, one is chosen (using ranking) * - that's the way to override {@code default} context, for example by changing its context path
      • @@ -120,7 +120,7 @@ * ranking *
      • At actual server runtime level, each servlet is associated (through {@link ServletConfig#getServletContext()}) * with own {@link OsgiContextModel}, but there are things to do before actual request processing - like - * calling {@link javax.servlet.ServletContainerInitializer#onStartup(Set, ServletContext)} methods. Here, the + * calling {@link jakarta.servlet.ServletContainerInitializer#onStartup(Set, ServletContext)} methods. Here, the * {@link OsgiContextModel} passed to such calls is the highest ranked {@link OsgiContextModel} / * {@link org.ops4j.pax.web.service.spi.servlet.OsgiServletContext} which may be different that the context * associated with the servlets running in such context.
      • @@ -138,8 +138,8 @@ * (Whiteboard Service specification) context. If it's created (customized) for {@link HttpContext} * (registered directly or via {@link org.ops4j.pax.web.service.whiteboard.HttpContextMapping}) and if it's a * singleton, then such {@link OsgiContextModel} is equivalent to one created directly through - * {@link org.osgi.service.http.HttpService} and user may continue to register servlets via - * {@link org.osgi.service.http.HttpService} to such contexts. That's the way to change the context path of such + * {@link org.ops4j.pax.web.service.http.HttpService} and user may continue to register servlets via + * {@link org.ops4j.pax.web.service.http.HttpService} to such contexts. That's the way to change the context path of such * context. Without any additional steps, the servlets (and filters and resources) registered through * {@link org.ops4j.pax.web.service.WebContainer} will always be associated with {@link OsgiContextModel} * that is lower ranked than the "default" {@link OsgiContextModel} coming from Whiteboard.

        @@ -172,7 +172,7 @@ public final class OsgiContextModel extends Identity implements Comparable { Bundle whiteboardBundle = context == null ? null : context.getBundle(); @@ -183,10 +183,10 @@ public final class OsgiContextModel extends Identity implements Comparable registration = DEFAULT_CONTEXT_MODEL.getContextRegistrationProperties(); registration.clear(); // We pretend that this ServletContextModel was: - // - registered to represent the Whiteboard's "default" context (org.osgi.service.http.context.ServletContextHelper) + // - registered to represent the Whiteboard's "default" context (org.osgi.service.servlet.context.ServletContextHelper) registration.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, HttpWhiteboardConstants.HTTP_WHITEBOARD_DEFAULT_CONTEXT_NAME); - // - NOT registered to represent the HttpService's "default" context (org.osgi.service.http.HttpContext) - registration.remove(HttpWhiteboardConstants.HTTP_SERVICE_CONTEXT_PROPERTY); + // - NOT registered to represent the HttpService's "default" context (org.ops4j.pax.web.service.http.HttpContext) + registration.remove(PaxWebConstants.HTTP_SERVICE_CONTEXT_PROPERTY); registration.put(Constants.SERVICE_ID, DEFAULT_CONTEXT_MODEL.getServiceId()); registration.put(Constants.SERVICE_RANKING, DEFAULT_CONTEXT_MODEL.getServiceRank()); // - registered with "/" context path @@ -301,8 +301,8 @@ public final class OsgiContextModel extends Identity implements Comparable connectors = new ArrayList<>(); /** - *

        This is the owner bundle of this context. For {@link org.osgi.service.http.HttpService} - * scenario, that's the bundle of bundle-scoped {@link org.osgi.service.http.HttpService} used to create + *

        This is the owner bundle of this context. For {@link org.ops4j.pax.web.service.http.HttpService} + * scenario, that's the bundle of bundle-scoped {@link org.ops4j.pax.web.service.http.HttpService} used to create * {@link HttpContext}. For Whiteboard scenario, that's the bundle registering * {@link ServletContextHelper}. For old Pax Web Whiteboard, that can be a * bundle which registered shared {@link HttpContext}.

        @@ -356,7 +356,7 @@ public final class OsgiContextModel extends Identity implements ComparableAt {@link OsgiContextModel} level we track a list of {@link Change changes} that represent implicit * unregistrations of dynamic servlets/filters/listeners that may have been added for example inside - * {@link javax.servlet.ServletContainerInitializer#onStartup(Set, ServletContext)} method.

        + * {@link jakarta.servlet.ServletContainerInitializer#onStartup(Set, ServletContext)} method.

        * - *

        JavaEE doesn't bother with unregistration of such elements, but Pax Web does ;)

        + *

        JakartaEE doesn't bother with unregistration of such elements, but Pax Web does ;)

        * * @param unregistration */ @@ -676,7 +676,7 @@ public void addTagLibs(Collection tagLibs) { } public void addJspPropertyGroupDescriptor(JspPropertyGroupDescriptor descriptor) { - // because javax.servlet.descriptor.JspConfigDescriptor may contain more property group descriptors, we + // because jakarta.servlet.descriptor.JspConfigDescriptor may contain more property group descriptors, we // should implement some kind of identification. So descriptors are "same" if they share at least one // URI pattern. In such case the property group is replaced, otherwise it is added. for (Iterator it = jspConfiguration.getJspPropertyGroups().iterator(); it.hasNext(); ) { @@ -737,7 +737,7 @@ public List getServerSpecificDescriptors() { /** * A "whiteboard" context can override implicit "httpservice" context. This allows users to override the - * context (and its path for example) used in {@link org.osgi.service.http.HttpService} scenario. + * context (and its path for example) used in {@link org.ops4j.pax.web.service.http.HttpService} scenario. * @return */ public boolean isWhiteboard() { diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/ServerModel.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/ServerModel.java index 2d9b1b2616..7c9b3e557f 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/ServerModel.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/ServerModel.java @@ -47,11 +47,11 @@ import java.util.concurrent.atomic.AtomicLong; import java.util.regex.Pattern; import java.util.stream.Collectors; -import javax.servlet.Filter; -import javax.servlet.Servlet; -import javax.servlet.ServletContainerInitializer; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; +import jakarta.servlet.Filter; +import jakarta.servlet.Servlet; +import jakarta.servlet.ServletContainerInitializer; +import jakarta.servlet.ServletContext; +import jakarta.servlet.ServletException; import org.ops4j.pax.web.annotations.PaxWebConfiguration; import org.ops4j.pax.web.service.PaxWebConstants; @@ -104,29 +104,29 @@ import org.osgi.framework.ServiceFactory; import org.osgi.framework.ServiceRegistration; import org.osgi.framework.dto.ServiceReferenceDTO; -import org.osgi.service.http.HttpContext; -import org.osgi.service.http.HttpService; -import org.osgi.service.http.NamespaceException; -import org.osgi.service.http.context.ServletContextHelper; -import org.osgi.service.http.runtime.HttpServiceRuntime; -import org.osgi.service.http.runtime.dto.DTOConstants; -import org.osgi.service.http.runtime.dto.ErrorPageDTO; -import org.osgi.service.http.runtime.dto.FailedErrorPageDTO; -import org.osgi.service.http.runtime.dto.FailedFilterDTO; -import org.osgi.service.http.runtime.dto.FailedListenerDTO; -import org.osgi.service.http.runtime.dto.FailedPreprocessorDTO; -import org.osgi.service.http.runtime.dto.FailedResourceDTO; -import org.osgi.service.http.runtime.dto.FailedServletContextDTO; -import org.osgi.service.http.runtime.dto.FailedServletDTO; -import org.osgi.service.http.runtime.dto.FilterDTO; -import org.osgi.service.http.runtime.dto.ListenerDTO; -import org.osgi.service.http.runtime.dto.PreprocessorDTO; -import org.osgi.service.http.runtime.dto.RequestInfoDTO; -import org.osgi.service.http.runtime.dto.ResourceDTO; -import org.osgi.service.http.runtime.dto.RuntimeDTO; -import org.osgi.service.http.runtime.dto.ServletContextDTO; -import org.osgi.service.http.runtime.dto.ServletDTO; -import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; +import org.ops4j.pax.web.service.http.HttpContext; +import org.ops4j.pax.web.service.http.HttpService; +import org.ops4j.pax.web.service.http.NamespaceException; +import org.osgi.service.servlet.context.ServletContextHelper; +import org.osgi.service.servlet.runtime.HttpServiceRuntime; +import org.osgi.service.servlet.runtime.dto.DTOConstants; +import org.osgi.service.servlet.runtime.dto.ErrorPageDTO; +import org.osgi.service.servlet.runtime.dto.FailedErrorPageDTO; +import org.osgi.service.servlet.runtime.dto.FailedFilterDTO; +import org.osgi.service.servlet.runtime.dto.FailedListenerDTO; +import org.osgi.service.servlet.runtime.dto.FailedPreprocessorDTO; +import org.osgi.service.servlet.runtime.dto.FailedResourceDTO; +import org.osgi.service.servlet.runtime.dto.FailedServletContextDTO; +import org.osgi.service.servlet.runtime.dto.FailedServletDTO; +import org.osgi.service.servlet.runtime.dto.FilterDTO; +import org.osgi.service.servlet.runtime.dto.ListenerDTO; +import org.osgi.service.servlet.runtime.dto.PreprocessorDTO; +import org.osgi.service.servlet.runtime.dto.RequestInfoDTO; +import org.osgi.service.servlet.runtime.dto.ResourceDTO; +import org.osgi.service.servlet.runtime.dto.RuntimeDTO; +import org.osgi.service.servlet.runtime.dto.ServletContextDTO; +import org.osgi.service.servlet.runtime.dto.ServletDTO; +import org.osgi.service.servlet.whiteboard.HttpWhiteboardConstants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -989,10 +989,10 @@ public OsgiContextModel createNewContextModel(WebContainerContext webContext, Bu Hashtable registration = osgiContextModel.getContextRegistrationProperties(); registration.clear(); // we pretend that this HttpContext/ServletContextModel was: - // - registered to NOT represent the Whiteboard's context (org.osgi.service.http.context.ServletContextHelper) + // - registered to NOT represent the Whiteboard's context (org.osgi.service.servlet.context.ServletContextHelper) registration.remove(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME); - // - registered to represent the HttpService's context (org.osgi.service.http.HttpContext) - registration.put(HttpWhiteboardConstants.HTTP_SERVICE_CONTEXT_PROPERTY, webContext.getContextId()); + // - registered to represent the HttpService's context (org.ops4j.pax.web.service.http.HttpContext) + registration.put(PaxWebConstants.HTTP_SERVICE_CONTEXT_PROPERTY, webContext.getContextId()); // - registered with legacy context id parameter registration.put(PaxWebConstants.SERVICE_PROPERTY_HTTP_CONTEXT_ID, webContext.getContextId()); // - registered with given context path @@ -3102,7 +3102,7 @@ public void visitClearDynamicRegistrationsChange(ClearDynamicRegistrationsChange eventListeners.entrySet().removeIf(e -> e.getValue().isDynamic()); } - // --- implementation of org.osgi.service.http.runtime.HttpServiceRuntime + // --- implementation of org.osgi.service.servlet.runtime.HttpServiceRuntime @Override public RuntimeDTO getRuntimeDTO() { @@ -3479,13 +3479,13 @@ public void collectWebApplications(Set webapps) { // - pax-web-extender-war deploys "full" web applications based on web.xml (and fragments + annotations) // - pax-web-extender-whiteboard tracks Whiteboard services (servlets, filters, listeners, ...) and installs // the web elements together with matching "context" - // - pax-web-runtime implements org.osgi.service.http.HttpService/org.ops4j.pax.web.service.WebContainer + // - pax-web-runtime implements org.ops4j.pax.web.service.http.HttpService/org.ops4j.pax.web.service.WebContainer // and allows direct registration of web elements // // Whatever's the origin, every "web application" is about web elements registered into single implementation - // of javax.servlet.ServletContext (target runtime specific) which is uniquely identified by its context path. + // of jakarta.servlet.ServletContext (target runtime specific) which is uniquely identified by its context path. // However in OSGi (all 3 origins), web elements are not directly registered there - there's an intermediate - // implementation of javax.servlet.ServletContext, common for all runtimes - + // implementation of jakarta.servlet.ServletContext, common for all runtimes - // org.ops4j.pax.web.service.spi.servlet.OsgiServletContext. And from configuration perspective, there's // 1:1 mapping with even more important object - org.ops4j.pax.web.service.spi.model.OsgiContextModel // @@ -3494,10 +3494,10 @@ public void collectWebApplications(Set webapps) { // - WAB - one OsgiContextModel is created for the WAB and its context path - it's always the "best" // OsgiContextModel for ServletContext with given context path // - Whiteboard - first, one OsgiContextModel is created for each Whiteboard-registered service of - // org.osgi.service.http.context.ServletContextHelper and web elements choose such helper using + // org.osgi.service.servlet.context.ServletContextHelper and web elements choose such helper using // "osgi.http.whiteboard.context.select" service registration property (with specification-defined default) // - HttpService - when registering web elements, a custom (or default, if null) instance of - // org.osgi.service.http.HttpContext is passed along the registration. For each such HttpContext, + // org.ops4j.pax.web.service.http.HttpContext is passed along the registration. For each such HttpContext, // a HttpService-specific (tied to the registering bundle) OsgiContextModel is created // // org.ops4j.pax.web.service.spi.model.WebApplicationModel class is not used internally for actual diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/ServiceModel.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/ServiceModel.java index d8dfca5a34..08750643cf 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/ServiceModel.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/ServiceModel.java @@ -64,9 +64,9 @@ import org.slf4j.LoggerFactory; /** - *

        Service Model is kept at {@link org.osgi.service.http.HttpService} level, which is bundle-scoped in Pax Web + *

        Service Model is kept at {@link org.ops4j.pax.web.service.http.HttpService} level, which is bundle-scoped in Pax Web * (though Http Service specification doesn't mention the scope of Http Service). Its goal is to remember which - * web elements were registered from given bundle (both {@link org.osgi.service.http.HttpService} usage + * web elements were registered from given bundle (both {@link org.ops4j.pax.web.service.http.HttpService} usage * and Whiteboard service registrations).

        * *

        This is just organizational separation, because the models are kept anyway at {@link ServerModel} and @@ -84,7 +84,7 @@ public class ServiceModel implements BatchVisitor { /** * Full {@link ServerModel}, while this {@link ServiceModel} collects elements registered within the scope - * of single bundle-scoped {@link org.osgi.service.http.HttpService} or (using Whiteboard) single + * of single bundle-scoped {@link org.ops4j.pax.web.service.http.HttpService} or (using Whiteboard) single * {@link org.osgi.framework.BundleContext#registerService bundle context}. */ private final ServerModel serverModel; @@ -94,15 +94,15 @@ public class ServiceModel implements BatchVisitor { /** *

        Servlets registered under alias in given context path (exact URL pattern) by given bundle-scoped - * {@link org.osgi.service.http.HttpService}. Group of disjoint slices of + * {@link org.ops4j.pax.web.service.http.HttpService}. Group of disjoint slices of * {@code org.ops4j.pax.web.service.spi.model.ServletContextModel#aliasMapping} for all context mappings.

        * - *

        Kept to fulfill the contract of {@link org.osgi.service.http.HttpService#unregister(String)}, which + *

        Kept to fulfill the contract of {@link org.ops4j.pax.web.service.http.HttpService#unregister(String)}, which * doesn't distinguish servlets registered under the same alias into different contexts.

        * *

        Two different servlets can be registered into two different context paths ({@link ServletContextModel}) * through two different {@link OsgiContextModel} under the same alias. - * {@link org.osgi.service.http.HttpService#unregister(String)} should unregister both of them.

        + * {@link org.ops4j.pax.web.service.http.HttpService#unregister(String)} should unregister both of them.

        * *

        Also, if single servlet model is registered into two different contexts, both of them should be unregistered * when needed.

        @@ -112,16 +112,16 @@ public class ServiceModel implements BatchVisitor { */ private final Map> aliasMapping = new HashMap<>(); - /** All servlet models registered by given bundle-scoped {@link org.osgi.service.http.HttpService}. */ + /** All servlet models registered by given bundle-scoped {@link org.ops4j.pax.web.service.http.HttpService}. */ private final Set servletModels = new HashSet<>(); - /** All filter models registered by given bundle-scoped {@link org.osgi.service.http.HttpService}. */ + /** All filter models registered by given bundle-scoped {@link org.ops4j.pax.web.service.http.HttpService}. */ private final Set filterModels = new HashSet<>(); - /** All event listener models registered by given bundle-scoped {@link org.osgi.service.http.HttpService}. */ + /** All event listener models registered by given bundle-scoped {@link org.ops4j.pax.web.service.http.HttpService}. */ private final Set eventListenerModels = new HashSet<>(); - /** All container initializer models registered by given bundle-scoped {@link org.osgi.service.http.HttpService}. */ + /** All container initializer models registered by given bundle-scoped {@link org.ops4j.pax.web.service.http.HttpService}. */ private final Set containerInitializerModels = new HashSet<>(); /** Welcome files are just kept as a sets - separately for each {@link ContextKey}. */ diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/ServletContextModel.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/ServletContextModel.java index 5046a18a49..78b2c087b0 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/ServletContextModel.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/ServletContextModel.java @@ -19,7 +19,7 @@ import java.util.HashMap; import java.util.Map; import java.util.Objects; -import javax.servlet.ServletContext; +import jakarta.servlet.ServletContext; import org.ops4j.pax.web.service.spi.model.elements.ErrorPageModel; import org.ops4j.pax.web.service.spi.model.elements.FilterModel; @@ -28,12 +28,12 @@ /** *

        This class is 1:1 representation of server-specific {@link ServletContext} and is unaware of - * OSGi-related representation of a context (like {@link org.osgi.service.http.HttpContext} and - * {@link org.osgi.service.http.context.ServletContextHelper}).

        + * OSGi-related representation of a context (like {@link org.ops4j.pax.web.service.http.HttpContext} and + * {@link org.osgi.service.servlet.context.ServletContextHelper}).

        * *

        It represents a web application (that could be described using single {@code web.xml} descriptor), * while the web elements (like servlets, filters, ...) or configuration (session, JSP config, ...) are - * contributed possibly by many bundles (bundle-scoped {@link org.osgi.service.http.HttpService} services or + * contributed possibly by many bundles (bundle-scoped {@link org.ops4j.pax.web.service.http.HttpService} services or * whiteboard service registrations).

        * *

        Normally, web applications are represented by {@code web.xml} files which are parsed by server-specific @@ -43,10 +43,10 @@ * {@code org.apache.tomcat.util.descriptor.web.WebXmlParser#parseWebXml()} *

      * - *

      When user registers (through {@link org.osgi.service.http.HttpService} or Whiteboard) a web element + *

      When user registers (through {@link org.ops4j.pax.web.service.http.HttpService} or Whiteboard) a web element * (like servlet), the registration seems unique, but physically, given servlet has to be explicitly registered * to all related {@link ServletContextModel} (and eventually - {@link ServletContext}). It is even more important - * during unregistration - simple call to {@link org.osgi.service.http.HttpService#unregister(String)} has to + * during unregistration - simple call to {@link org.ops4j.pax.web.service.http.HttpService#unregister(String)} has to * iterate over all mapped {@link ServletContextModel} contexts.

      * *

      Each {@link OsgiContextModel} pointing to this class may declare virtual hosts. Actual, server @@ -68,7 +68,7 @@ public final class ServletContextModel extends Identity { private final Map servletNameMapping = new HashMap<>(); /** - *

      Http Service specification ({@link org.osgi.service.http.HttpService#registerServlet}) uses the concept + *

      Http Service specification ({@link org.ops4j.pax.web.service.http.HttpService#registerServlet}) uses the concept * of alias and requires it to be unique. It's effectively a nexact URL mapping for a servlet, * according to "12.2 Specification of Mappings" from Servlet specification.

      * diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/elements/ContainerInitializerModel.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/elements/ContainerInitializerModel.java index 501072c2e3..84e35068d1 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/elements/ContainerInitializerModel.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/elements/ContainerInitializerModel.java @@ -20,7 +20,7 @@ import java.util.LinkedHashSet; import java.util.List; import java.util.Set; -import javax.servlet.ServletContainerInitializer; +import jakarta.servlet.ServletContainerInitializer; import org.ops4j.pax.web.service.spi.model.events.ContainerInitializerEventData; import org.ops4j.pax.web.service.spi.whiteboard.WhiteboardWebContainerView; diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/elements/ContainerInitializerModelAware.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/elements/ContainerInitializerModelAware.java index ed2ec43216..90fbe978ce 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/elements/ContainerInitializerModelAware.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/elements/ContainerInitializerModelAware.java @@ -16,7 +16,7 @@ package org.ops4j.pax.web.service.spi.model.elements; /** - * Specialized interface to communicate with {@link javax.servlet.ServletContainerInitializer} instances which + * Specialized interface to communicate with {@link jakarta.servlet.ServletContainerInitializer} instances which * should be aware of {@link ContainerInitializerModel}. There's of course only one (as of 2021-07-27) such SCI, * which is used to register already instantiated WebSocket endpoints, but we still need this interface. */ diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/elements/ElementModel.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/elements/ElementModel.java index e77209db22..628d51d55e 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/elements/ElementModel.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/elements/ElementModel.java @@ -36,22 +36,22 @@ /** *

      Base class for all models representing actual elements of a web application (or - * context), the most obvious model is representing {@link javax.servlet.Servlet}.

      + * context), the most obvious model is representing {@link jakarta.servlet.Servlet}.

      * - *

      What user does (through {@link org.osgi.service.http.HttpService} or by publishing Whiteboard services) is + *

      What user does (through {@link org.ops4j.pax.web.service.http.HttpService} or by publishing Whiteboard services) is * a registration of web elements (like servlets) always within the context of ... well, a context * (possibly many, as permitted by Whiteboard Service specification).

      * *

      A context is not an element itself (thus - not a model), it's rather:

        - *
      • actual {@link javax.servlet.ServletContext} from server point of view
      • - *
      • OSGi abstraction ({@link org.osgi.service.http.HttpContext} or - * {@link org.osgi.service.http.context.ServletContextHelper}) providing additional/bridged functionality, - * when delegating some of it to actual {@link javax.servlet.ServletContext}
      • + *
      • actual {@link jakarta.servlet.ServletContext} from server point of view
      • + *
      • OSGi abstraction ({@link org.ops4j.pax.web.service.http.HttpContext} or + * {@link org.osgi.service.servlet.context.ServletContextHelper}) providing additional/bridged functionality, + * when delegating some of it to actual {@link jakarta.servlet.ServletContext}
      • *

      * *

      Each element, when registered through Whiteboard Service, may turn out to unregister some existing * element when it uses conflicting URL mapping but has lower ranking or service id. Such conflicts lead - * to trivial {@link org.osgi.service.http.NamespaceException} when using Http Service.

      + * to trivial {@link org.ops4j.pax.web.service.http.NamespaceException} when using Http Service.

      * * @param type of the service that user registers to be processed by Whiteboard extender (whether standard * OSGi CMPN Whiteboard or Pax Web specific Whiteboard extender) @@ -85,7 +85,7 @@ public abstract class ElementModel /** * When an element is registered as Whiteboard service, we have to keep the reference here, so we can * use {@link ServiceReference#getBundle() a bundle} and its context to obtain a reference to - * {@link org.osgi.service.http.context.ServletContextHelper} associated with the element. + * {@link org.osgi.service.servlet.context.ServletContextHelper} associated with the element. */ private ServiceReference elementReference; @@ -95,7 +95,7 @@ public abstract class ElementModel private boolean prototype = false; /** - * Because user may specify Whiteboard service (e.g., {@link javax.servlet.Servlet}) using legacy service + * Because user may specify Whiteboard service (e.g., {@link jakarta.servlet.Servlet}) using legacy service * like {@link org.ops4j.pax.web.service.whiteboard.ServletMapping} we can't assume if method returning this * servlet returns a singleton or an instance on each call. So we wrap such * {@link org.ops4j.pax.web.service.whiteboard.ServletMapping} inside this {@link Supplier} to delay @@ -108,9 +108,9 @@ public abstract class ElementModel /** * Even if the element is not registered as Whiteboard service, we still need a bundle in which scope * the element was registered (for example using - * {@link org.osgi.service.http.HttpService#registerServlet}), so + * {@link org.ops4j.pax.web.service.http.HttpService#registerServlet}), so * we can use its {@link org.osgi.framework.BundleContext} to obtain proper reference to - * {@link org.osgi.service.http.context.ServletContextHelper} if needed. + * {@link org.osgi.service.servlet.context.ServletContextHelper} if needed. */ private Bundle registeringBundle; @@ -327,7 +327,7 @@ public void setRegisteringBundle(Bundle registeringBundle) { /** * Some Whiteboard services specify context selector using - * {@link org.osgi.service.http.whiteboard.HttpWhiteboardConstants#HTTP_WHITEBOARD_CONTEXT_SELECT} service + * {@link org.osgi.service.servlet.whiteboard.HttpWhiteboardConstants#HTTP_WHITEBOARD_CONTEXT_SELECT} service * registration property and some (legacy) using {@link ContextRelated#getContextId()}/{@link ContextRelated#getContextSelectFilter()}. * After setting the selector, we no longer have to resolve one. * @param mappingSelector diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/elements/ErrorPageModel.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/elements/ErrorPageModel.java index 58ca32c32e..7dfbe92bd2 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/elements/ErrorPageModel.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/elements/ErrorPageModel.java @@ -27,9 +27,9 @@ import org.ops4j.pax.web.service.spi.whiteboard.WhiteboardWebContainerView; import org.ops4j.pax.web.service.whiteboard.ErrorPageMapping; import org.osgi.framework.wiring.BundleWiring; -import org.osgi.service.http.runtime.dto.DTOConstants; -import org.osgi.service.http.runtime.dto.ErrorPageDTO; -import org.osgi.service.http.runtime.dto.FailedErrorPageDTO; +import org.osgi.service.servlet.runtime.dto.DTOConstants; +import org.osgi.service.servlet.runtime.dto.ErrorPageDTO; +import org.osgi.service.servlet.runtime.dto.FailedErrorPageDTO; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/elements/EventListenerModel.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/elements/EventListenerModel.java index 023848af14..0d661a1e88 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/elements/EventListenerModel.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/elements/EventListenerModel.java @@ -21,9 +21,9 @@ import org.ops4j.pax.web.service.spi.util.Utils; import org.ops4j.pax.web.service.spi.whiteboard.WhiteboardWebContainerView; import org.osgi.framework.BundleContext; -import org.osgi.service.http.runtime.dto.DTOConstants; -import org.osgi.service.http.runtime.dto.FailedListenerDTO; -import org.osgi.service.http.runtime.dto.ListenerDTO; +import org.osgi.service.servlet.runtime.dto.DTOConstants; +import org.osgi.service.servlet.runtime.dto.FailedListenerDTO; +import org.osgi.service.servlet.runtime.dto.ListenerDTO; import java.util.Arrays; import java.util.EventListener; @@ -47,7 +47,7 @@ public class EventListenerModel extends ElementModelholder classes which * control the lifecycle of servlets/filters, but here we do it ourselves, as there's no - * lifecycle of the listener itself from the point of view of JavaEE Servlets specification. + * lifecycle of the listener itself from the point of view of JakartaEE Servlets specification. * @return */ public EventListener resolveEventListener() { diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/elements/FilterModel.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/elements/FilterModel.java index 3763c57a14..d585af09af 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/elements/FilterModel.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/elements/FilterModel.java @@ -32,9 +32,9 @@ import java.util.UUID; import java.util.function.Supplier; import java.util.stream.Collectors; -import javax.servlet.DispatcherType; -import javax.servlet.Filter; -import javax.servlet.FilterConfig; +import jakarta.servlet.DispatcherType; +import jakarta.servlet.Filter; +import jakarta.servlet.FilterConfig; import org.ops4j.pax.web.service.PaxWebConstants; import org.ops4j.pax.web.service.spi.model.OsgiContextModel; @@ -44,11 +44,11 @@ import org.ops4j.pax.web.service.spi.whiteboard.WhiteboardWebContainerView; import org.osgi.framework.Bundle; import org.osgi.framework.ServiceReference; -import org.osgi.service.http.runtime.dto.DTOConstants; -import org.osgi.service.http.runtime.dto.FailedFilterDTO; -import org.osgi.service.http.runtime.dto.FailedPreprocessorDTO; -import org.osgi.service.http.runtime.dto.FilterDTO; -import org.osgi.service.http.runtime.dto.PreprocessorDTO; +import org.osgi.service.servlet.runtime.dto.DTOConstants; +import org.osgi.service.servlet.runtime.dto.FailedFilterDTO; +import org.osgi.service.servlet.runtime.dto.FailedPreprocessorDTO; +import org.osgi.service.servlet.runtime.dto.FilterDTO; +import org.osgi.service.servlet.runtime.dto.PreprocessorDTO; /** * Set of parameters describing everything that's required to register a {@link Filter}. @@ -57,7 +57,7 @@ public class FilterModel extends ElementModel { /** *

      URL patterns and servlet names (per dispatcher type) as specified by:

        - *
      • Pax Web specific extensions to {@link org.osgi.service.http.HttpService}
      • + *
      • Pax Web specific extensions to {@link org.ops4j.pax.web.service.http.HttpService}
      • *
      • Whiteboard Service specification
      • *
      • Servlet API specification
      • *

      @@ -74,8 +74,8 @@ public class FilterModel extends ElementModel { private String[] flatDispatcherTypes; /** - * When using {@link javax.servlet.ServletContext#addFilter(String, Filter)} and - * {@link javax.servlet.FilterRegistration.Dynamic#addMappingForServletNames(EnumSet, boolean, String...)} we + * When using {@link jakarta.servlet.ServletContext#addFilter(String, Filter)} and + * {@link jakarta.servlet.FilterRegistration.Dynamic#addMappingForServletNames(EnumSet, boolean, String...)} we * need to store distinct sets of mappings separately for different dispatchers (and order) */ private final List dynamicUrlPatterns = new LinkedList<>(); @@ -107,11 +107,11 @@ public class FilterModel extends ElementModel { private final Class filterClass; /** - * Flag used for models registered using {@link javax.servlet.ServletContext#addFilter} + * Flag used for models registered using {@link jakarta.servlet.ServletContext#addFilter} */ private boolean dynamic = false; - /** Flag to mark a {@link FilterModel} for {@link org.osgi.service.http.whiteboard.Preprocessor} */ + /** Flag to mark a {@link FilterModel} for {@link org.osgi.service.servlet.whiteboard.Preprocessor} */ private boolean preprocessor = false; /** diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/elements/JspConfigurationModel.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/elements/JspConfigurationModel.java index 5cdd8830d1..d540628fac 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/elements/JspConfigurationModel.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/elements/JspConfigurationModel.java @@ -18,9 +18,9 @@ import java.util.Collection; import java.util.LinkedList; import java.util.List; -import javax.servlet.descriptor.JspConfigDescriptor; -import javax.servlet.descriptor.JspPropertyGroupDescriptor; -import javax.servlet.descriptor.TaglibDescriptor; +import jakarta.servlet.descriptor.JspConfigDescriptor; +import jakarta.servlet.descriptor.JspPropertyGroupDescriptor; +import jakarta.servlet.descriptor.TaglibDescriptor; import org.ops4j.pax.web.service.spi.config.Configuration; import org.ops4j.pax.web.service.spi.model.OsgiContextModel; diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/elements/SecurityConfigurationModel.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/elements/SecurityConfigurationModel.java index ef1172e24d..8a887be433 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/elements/SecurityConfigurationModel.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/elements/SecurityConfigurationModel.java @@ -43,7 +43,7 @@ *
    *

    * - *

    Additionally, security declarations may be passed through {@link javax.servlet.ServletRegistration.Dynamic#setServletSecurity} + *

    Additionally, security declarations may be passed through {@link jakarta.servlet.ServletRegistration.Dynamic#setServletSecurity} * and for example, Tomcat passes the arguments to {@code org.apache.catalina.core.StandardContext#addServletSecurity()}.

    */ public class SecurityConfigurationModel extends ElementModel { diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/elements/SecurityConstraintModel.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/elements/SecurityConstraintModel.java index 412edca7c2..d8ec10fcd8 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/elements/SecurityConstraintModel.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/elements/SecurityConstraintModel.java @@ -15,8 +15,8 @@ */ package org.ops4j.pax.web.service.spi.model.elements; -import javax.servlet.ServletSecurityElement; -import javax.servlet.annotation.ServletSecurity; +import jakarta.servlet.ServletSecurityElement; +import jakarta.servlet.annotation.ServletSecurity; import java.util.ArrayList; import java.util.List; @@ -44,7 +44,7 @@ public class SecurityConstraintModel { /** * If the security constraint model was created from Servlet-specific configuration like:
      - *
    • {@link javax.servlet.ServletRegistration.Dynamic#setServletSecurity(ServletSecurityElement)}, or
    • + *
    • {@link jakarta.servlet.ServletRegistration.Dynamic#setServletSecurity(ServletSecurityElement)}, or
    • *
    • {@link ServletSecurity} annotation
    • *
    we remember the associated {@link ServletModel}, so dynamic security constraints are properly applied. */ diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/elements/ServletModel.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/elements/ServletModel.java index 0e22f99215..e3e8435bf6 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/elements/ServletModel.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/elements/ServletModel.java @@ -30,10 +30,10 @@ import java.util.Map; import java.util.UUID; import java.util.function.Supplier; -import javax.servlet.MultipartConfigElement; -import javax.servlet.Servlet; -import javax.servlet.ServletConfig; -import javax.servlet.ServletContext; +import jakarta.servlet.MultipartConfigElement; +import jakarta.servlet.Servlet; +import jakarta.servlet.ServletConfig; +import jakarta.servlet.ServletContext; import org.ops4j.pax.web.service.PaxWebConstants; import org.ops4j.pax.web.service.spi.config.JspConfiguration; @@ -45,13 +45,13 @@ import org.ops4j.pax.web.service.whiteboard.ServletMapping; import org.osgi.framework.Bundle; import org.osgi.framework.ServiceReference; -import org.osgi.service.http.HttpService; -import org.osgi.service.http.context.ServletContextHelper; -import org.osgi.service.http.runtime.dto.DTOConstants; -import org.osgi.service.http.runtime.dto.FailedResourceDTO; -import org.osgi.service.http.runtime.dto.FailedServletDTO; -import org.osgi.service.http.runtime.dto.ResourceDTO; -import org.osgi.service.http.runtime.dto.ServletDTO; +import org.ops4j.pax.web.service.http.HttpService; +import org.osgi.service.servlet.context.ServletContextHelper; +import org.osgi.service.servlet.runtime.dto.DTOConstants; +import org.osgi.service.servlet.runtime.dto.FailedResourceDTO; +import org.osgi.service.servlet.runtime.dto.FailedServletDTO; +import org.osgi.service.servlet.runtime.dto.ResourceDTO; +import org.osgi.service.servlet.runtime.dto.ServletDTO; /** * Set of parameters describing everything that's required to register a {@link Servlet}. @@ -406,13 +406,6 @@ public Boolean performValidation() throws Exception { initParams.put("jspFile", jspFile); } - if (multipartConfigElement != null && multipartConfigElement.getLocation() != null) { - if (System.getSecurityManager() != null && !getRegisteringBundle().hasPermission(new FilePermission(multipartConfigElement.getLocation(), "read,write,delete"))) { - dtoFailureCode = DTOConstants.FAILURE_REASON_SERVLET_WRITE_TO_LOCATION_DENIED; - throw new IllegalArgumentException("No Write permission to " + multipartConfigElement.getLocation()); - } - } - dtoFailureCode = -1; return Boolean.TRUE; } diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/elements/SessionConfigurationModel.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/elements/SessionConfigurationModel.java index 96f4f837d4..81710661e9 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/elements/SessionConfigurationModel.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/elements/SessionConfigurationModel.java @@ -17,8 +17,8 @@ import java.util.HashSet; import java.util.Set; -import javax.servlet.SessionCookieConfig; -import javax.servlet.SessionTrackingMode; +import jakarta.servlet.SessionCookieConfig; +import jakarta.servlet.SessionTrackingMode; import org.ops4j.pax.web.service.PaxWebConstants; import org.ops4j.pax.web.service.spi.model.OsgiContextModel; @@ -51,7 +51,7 @@ public class SessionConfigurationModel { // - SameSite(enum None/Strict/Lax) - "Session cookie sameSite mode. Currently this is encoded in the session comment until sameSite is supported by SessionCookieConfig" // - SecureRequestOnly(boolean) (different than SessionCookieConfig.setSecure()) - "if session cookie is to be marked as secure only on HTTPS requests" // - SessionIdPathParameterName(string), default "jsessionid" - "the URL path parameter name for session id URL rewriting (null or "none" for no rewriting)" - // - UsingCookies(boolean), default true, set if javax.servlet.SessionTrackingMode.COOKIE is used + // - UsingCookies(boolean), default true, set if jakarta.servlet.SessionTrackingMode.COOKIE is used // Tomcat (org.apache.catalina.core.StandardContext): // - sessionCookiePathUsesTrailingSlash(boolean), default false - "Is a / added to the end of the session cookie path to ensure browsers, particularly IE, don't send a session cookie for context /foo with requests intended for context /foobar." // Undertow: diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/elements/WebSocketModel.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/elements/WebSocketModel.java index b9fdbfa26e..adf9120450 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/elements/WebSocketModel.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/elements/WebSocketModel.java @@ -15,9 +15,9 @@ */ package org.ops4j.pax.web.service.spi.model.elements; -import javax.websocket.Decoder; -import javax.websocket.Encoder; -import javax.websocket.server.ServerEndpoint; +import jakarta.websocket.Decoder; +import jakarta.websocket.Encoder; +import jakarta.websocket.server.ServerEndpoint; import org.ops4j.pax.web.service.spi.model.events.WebSocketEventData; import org.ops4j.pax.web.service.spi.whiteboard.WhiteboardWebContainerView; @@ -33,11 +33,11 @@ public class WebSocketModel extends ElementModel { public static final Logger LOG = LoggerFactory.getLogger(WebSocketModel.class); private final Object webSocketEndpoint; - private Class webSocketEndpointClass; + private final Class webSocketEndpointClass; private Class webSocketEndpointClassResolved; - // see javax.websocket.server.ServerEndpoint.value + // see jakarta.websocket.server.ServerEndpoint.value private String mappedPath; @SuppressWarnings("unchecked") diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/events/ContainerInitializerEventData.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/events/ContainerInitializerEventData.java index c3f7cbc147..919995dd35 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/events/ContainerInitializerEventData.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/events/ContainerInitializerEventData.java @@ -15,7 +15,7 @@ */ package org.ops4j.pax.web.service.spi.model.events; -import javax.servlet.ServletContainerInitializer; +import jakarta.servlet.ServletContainerInitializer; public class ContainerInitializerEventData extends WebElementEventData { diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/events/FilterEventData.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/events/FilterEventData.java index ded0e42e1b..117a896567 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/events/FilterEventData.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/events/FilterEventData.java @@ -18,7 +18,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import javax.servlet.Filter; +import jakarta.servlet.Filter; import org.ops4j.pax.web.service.spi.model.elements.FilterModel; diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/events/ServletEventData.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/events/ServletEventData.java index b84c491f3f..f3275898cd 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/events/ServletEventData.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/events/ServletEventData.java @@ -16,7 +16,7 @@ package org.ops4j.pax.web.service.spi.model.events; import java.util.Arrays; -import javax.servlet.Servlet; +import jakarta.servlet.Servlet; public class ServletEventData extends WebElementEventData { diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/events/WebApplicationEvent.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/events/WebApplicationEvent.java index 51477767a6..e5b7222cff 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/events/WebApplicationEvent.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/events/WebApplicationEvent.java @@ -19,7 +19,7 @@ import org.osgi.framework.Bundle; import org.osgi.framework.Version; -import org.osgi.service.http.HttpContext; +import org.ops4j.pax.web.service.http.HttpContext; /** *

    Event related to registration of a web application (WAB), described in OSGi CMPN 128 Web Applications Specification. diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/events/WebElementEvent.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/events/WebElementEvent.java index 162cf40180..dc7078af2d 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/events/WebElementEvent.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/events/WebElementEvent.java @@ -15,14 +15,14 @@ */ package org.ops4j.pax.web.service.spi.model.events; -import javax.servlet.Servlet; +import jakarta.servlet.Servlet; import org.osgi.framework.Bundle; import org.osgi.framework.Version; /** *

    Event related to registration of single {@link org.ops4j.pax.web.service.spi.model.elements.ElementModel} which - * may represent any web element like {@link Servlet} or {@link javax.servlet.Filter}. + * may represent any web element like {@link Servlet} or {@link jakarta.servlet.Filter}. * In Pax Web 7 there was only a {@code ServletEvent}.

    * *

    While the names may be similar, these events are not the events mentioned in chapter 128.5, diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/events/WebElementEventData.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/events/WebElementEventData.java index 610f5511c5..e68956dab9 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/events/WebElementEventData.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/events/WebElementEventData.java @@ -24,7 +24,7 @@ /** * Base class for data for events related to registration/unregistration of web elements like - * {@link javax.servlet.Servlet servlets} or {@link javax.servlet.Filter filters}. + * {@link jakarta.servlet.Servlet servlets} or {@link jakarta.servlet.Filter filters}. */ public abstract class WebElementEventData { diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/info/ServletInfo.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/info/ServletInfo.java index 528d946891..0a13e34429 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/info/ServletInfo.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/info/ServletInfo.java @@ -15,7 +15,7 @@ */ package org.ops4j.pax.web.service.spi.model.info; -import javax.servlet.Servlet; +import jakarta.servlet.Servlet; import org.ops4j.pax.web.service.spi.model.OsgiContextModel; import org.ops4j.pax.web.service.spi.model.elements.ServletModel; diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/info/WebApplicationInfo.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/info/WebApplicationInfo.java index e1f0ec8c8d..4c0ce7038e 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/info/WebApplicationInfo.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/info/WebApplicationInfo.java @@ -27,8 +27,8 @@ import org.ops4j.pax.web.service.spi.model.OsgiContextModel; import org.osgi.framework.Bundle; import org.osgi.framework.Constants; -import org.osgi.service.http.HttpService; -import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; +import org.ops4j.pax.web.service.http.HttpService; +import org.osgi.service.servlet.whiteboard.HttpWhiteboardConstants; /** *

    A model class representing the details of a Web Application.

    @@ -185,7 +185,7 @@ public List getContextRegistrationIdProperties() { contextModel.getModel().getContextRegistrationProperties().forEach((k, v) -> { if (PaxWebConstants.SERVICE_PROPERTY_HTTP_CONTEXT_ID.equals(k) || PaxWebConstants.SERVICE_PROPERTY_HTTP_CONTEXT_PATH.equals(k) - || HttpWhiteboardConstants.HTTP_SERVICE_CONTEXT_PROPERTY.equals(k) + || PaxWebConstants.HTTP_SERVICE_CONTEXT_PROPERTY.equals(k) || HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME.equals(k) || HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH.equals(k)) { props.add(String.format("%s=%s", k, v)); diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/package-info.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/package-info.java index c01972c759..d2998eb50f 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/package-info.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/package-info.java @@ -36,7 +36,7 @@ * {@code Host} HTTP header or non-matched requests if acting as default virtual host for an * engine. For Tomcat purpose, a virtual host has dedicated app base. *
  • Context ({@code org.apache.catalina.core.StandardContext}) represents - * {@link javax.servlet.ServletContext} or in other words, entire web application. The most important + * {@link jakarta.servlet.ServletContext} or in other words, entire web application. The most important * thing is that it uses single, unique context path.
  • *

    * @@ -54,7 +54,7 @@ *
  • Handler collection is a special handler recommended to set as delegate inside * a server. Each handler from the collection is called until one of them marks request as "handled".
  • *
  • Context ({@code org.eclipse.jetty.server.handler.ContextHandler} and subclasses) represents
  • - * {@link javax.servlet.ServletContext} (or in other words, entire web application) and is unique wrt + * {@link jakarta.servlet.ServletContext} (or in other words, entire web application) and is unique wrt * context path. Standalone Jetty (in {@code etc/jetty.xml} and Pax Web itself) choose to use * handler collection containing context handlers. *
  • Virtual host is not a special handler - it's part of handling request inside context @@ -71,7 +71,7 @@ *
  • Listeners receives a request and calls single handler inside a server.
  • *
  • Virtual host is just one of the handlers * ({@code io.undertow.server.handlers.NameVirtualHostHandler}) and doesn't have to be set in a server.
  • - *
  • Context, which matches {@link javax.servlet.ServletContext} has context path and + *
  • Context, which matches {@link jakarta.servlet.ServletContext} has context path and * represents entire web application (or WAR deployment), allowing to register servlets, filters, etc.
  • *

    * @@ -83,22 +83,22 @@ * context.

    * *

    There are two contexts depending on OSGi CMPN specification considered:

      - *
    • {@link org.osgi.service.http.HttpContext} ("102 Http Service")
    • - *
    • {@link org.osgi.service.http.context.ServletContextHelper} ("140 Whiteboard Service")
    • + *
    • {@link org.ops4j.pax.web.service.http.HttpContext} ("102 Http Service")
    • + *
    • {@link org.osgi.service.servlet.context.ServletContextHelper} ("140 Whiteboard Service")
    • *

    * - *

    However, these contexts are not mapped 1:1 with single {@link javax.servlet.ServletContext} + *

    However, these contexts are not mapped 1:1 with single {@link jakarta.servlet.ServletContext} * representing a web application as seen by actual server implementation. The above are used * by some other servlet context which is mapped 1:1 with original one (according to * OSGi CMPN R7). - * But there's still additional {@link javax.servlet.ServletContext} actually visible by servlets/filters/etc. - * depending on the {@link org.osgi.service.http.HttpContext} or - * {@link org.osgi.service.http.context.ServletContextHelper} with which the servlet/filter/etc. was registered + * But there's still additional {@link jakarta.servlet.ServletContext} actually visible by servlets/filters/etc. + * depending on the {@link org.ops4j.pax.web.service.http.HttpContext} or + * {@link org.osgi.service.servlet.context.ServletContextHelper} with which the servlet/filter/etc. was registered * to preserve bundle-affinity.

    * - *

    First, original, server-specific {@link javax.servlet.ServletContext}, identified uniquely by context - * path is created everytime a {@link org.osgi.service.http.HttpContext} or - * {@link org.osgi.service.http.context.ServletContextHelper} is tracked from service registry, with specified + *

    First, original, server-specific {@link jakarta.servlet.ServletContext}, identified uniquely by context + * path is created everytime a {@link org.ops4j.pax.web.service.http.HttpContext} or + * {@link org.osgi.service.servlet.context.ServletContextHelper} is tracked from service registry, with specified * context path. Such context is represented by {@link org.ops4j.pax.web.service.spi.model.ServletContextModel} * and is agnostic wrt any bundle. When more HttpContext/ServletContextHelper services are registered for a given * context path, there's no conflict - simply more OSGi-specific contexts point to server-specific @@ -115,10 +115,10 @@ * *

    When servlet (or filter, or ...) is registered, it is registered with one (or more!) contexts and * when actual server implementation is asked to register such element the registration has to be done for all - * actual {@link javax.servlet.ServletContext} instances.

    + * actual {@link jakarta.servlet.ServletContext} instances.

    * - *

    There's a requirement, that {@link org.osgi.service.http.context.ServletContextHelper} instances have to + *

    There's a requirement, that {@link org.osgi.service.servlet.context.ServletContextHelper} instances have to * be available in OSGi registry (including the default one registered by Whiteboard implementation itself). It is - * not a case with Http Service and {@link org.osgi.service.http.HttpContext}.

    + * not a case with Http Service and {@link org.ops4j.pax.web.service.http.HttpContext}.

    */ package org.ops4j.pax.web.service.spi.model; diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/views/DynamicJEEWebContainerView.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/views/DynamicJEEWebContainerView.java index 332f3b22ce..a6b2b563a3 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/views/DynamicJEEWebContainerView.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/views/DynamicJEEWebContainerView.java @@ -22,7 +22,7 @@ /** * Interface with selected methods from {@link org.ops4j.pax.web.service.spi.whiteboard.WhiteboardWebContainerView} - * used for dynamic addServlet/addFilter/addListener methods of {@link javax.servlet.ServletContext}. + * used for dynamic addServlet/addFilter/addListener methods of {@link jakarta.servlet.ServletContext}. */ public interface DynamicJEEWebContainerView extends PaxWebContainerView { diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/views/ReportWebContainerView.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/views/ReportWebContainerView.java index 40fd163fae..004a4c84c5 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/views/ReportWebContainerView.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/views/ReportWebContainerView.java @@ -24,7 +24,7 @@ /** *

    This {@link PaxWebContainerView view} is used only to get read-only information about the state of * {@link org.ops4j.pax.web.service.spi.model.ServerModel}. It plays a role similar to - * {@link org.osgi.service.http.runtime.HttpServiceRuntime} but with much greater flexibility.

    + * {@link org.osgi.service.servlet.runtime.HttpServiceRuntime} but with much greater flexibility.

    * *

    This view was created especially for the purpose of Karaf commands.

    */ @@ -35,7 +35,7 @@ public interface ReportWebContainerView extends PaxWebContainerView { * *

    User expects mostly the Web Application Bundles (WABs), but the list will contain all * web applications - the ones created using Whiteboard registration or direct installation using - * {@link org.osgi.service.http.HttpService} as well.

    + * {@link org.ops4j.pax.web.service.http.HttpService} as well.

    * * @return */ diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/views/WebAppWebContainerView.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/views/WebAppWebContainerView.java index 65bf064cc7..561d3512e9 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/views/WebAppWebContainerView.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/views/WebAppWebContainerView.java @@ -30,7 +30,7 @@ * we can arrange the operations within a kind of transaction. This is desired and expected if all the * web elements belong to single WAR (WAB) and also because some kind of validation was already performed when * WAB's {@code web.xml} (and possibly web fragments and annotated elements) was parsed. Also all the elements - * really belong to single {@link javax.servlet.ServletContext} and share single context path.

    + * really belong to single {@link jakarta.servlet.ServletContext} and share single context path.

    * *

    As with traditional Servlet containers, each WAR (in OSGi: WAB) maps 1:1 to unique servlet context * identified by context path. In Whiteboard scenario, many bundles may contribute to a single diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/Default404Servlet.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/Default404Servlet.java index b10676693c..5676d87a5e 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/Default404Servlet.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/Default404Servlet.java @@ -16,11 +16,11 @@ package org.ops4j.pax.web.service.spi.servlet; import java.io.IOException; -import javax.servlet.DispatcherType; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.DispatcherType; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/DefaultJspPropertyGroupDescriptor.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/DefaultJspPropertyGroupDescriptor.java index 40d60bdcc2..a683f9c879 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/DefaultJspPropertyGroupDescriptor.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/DefaultJspPropertyGroupDescriptor.java @@ -16,7 +16,7 @@ package org.ops4j.pax.web.service.spi.servlet; import java.util.Collection; -import javax.servlet.descriptor.JspPropertyGroupDescriptor; +import jakarta.servlet.descriptor.JspPropertyGroupDescriptor; public class DefaultJspPropertyGroupDescriptor implements JspPropertyGroupDescriptor { @@ -32,6 +32,7 @@ public class DefaultJspPropertyGroupDescriptor implements JspPropertyGroupDescri private String defaultContentType; private String buffer; private String errorOnUndeclaredNamespace; + private String errorOnELNotFound; @Override public Collection getUrlPatterns() { @@ -141,4 +142,13 @@ public void setErrorOnUndeclaredNamespace(String errorOnUndeclaredNamespace) { this.errorOnUndeclaredNamespace = errorOnUndeclaredNamespace; } + @Override + public String getErrorOnELNotFound() { + return errorOnELNotFound; + } + + public void setErrorOnELNotFound(String errorOnELNotFound) { + this.errorOnELNotFound = errorOnELNotFound; + } + } diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/DefaultSessionCookieConfig.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/DefaultSessionCookieConfig.java index 6f9d6766d0..8835b685a7 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/DefaultSessionCookieConfig.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/DefaultSessionCookieConfig.java @@ -15,7 +15,9 @@ */ package org.ops4j.pax.web.service.spi.servlet; -import javax.servlet.SessionCookieConfig; +import jakarta.servlet.SessionCookieConfig; + +import java.util.Map; public class DefaultSessionCookieConfig implements SessionCookieConfig { @@ -58,11 +60,13 @@ public void setPath(String path) { } @Override + @SuppressWarnings("removal") public String getComment() { return comment; } @Override + @SuppressWarnings("removal") public void setComment(String comment) { this.comment = comment; } @@ -97,4 +101,21 @@ public void setMaxAge(int maxAge) { this.maxAge = maxAge; } + @Override + public void setAttribute(String name, String value) { + // TODO: JakartaEE 10 + } + + @Override + public String getAttribute(String name) { + // TODO: JakartaEE 10 + return null; + } + + @Override + public Map getAttributes() { + // TODO: JakartaEE 10 + return null; + } + } diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/DefaultTaglibDescriptor.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/DefaultTaglibDescriptor.java index ed2615f369..4414da9f53 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/DefaultTaglibDescriptor.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/DefaultTaglibDescriptor.java @@ -15,7 +15,7 @@ */ package org.ops4j.pax.web.service.spi.servlet; -import javax.servlet.descriptor.TaglibDescriptor; +import jakarta.servlet.descriptor.TaglibDescriptor; public class DefaultTaglibDescriptor implements TaglibDescriptor { diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/DynamicRegistrations.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/DynamicRegistrations.java index 6f48e5151b..06f03d1c3c 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/DynamicRegistrations.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/DynamicRegistrations.java @@ -21,12 +21,12 @@ import java.util.HashMap; import java.util.IdentityHashMap; import java.util.Map; -import javax.servlet.Filter; -import javax.servlet.FilterRegistration; -import javax.servlet.Servlet; -import javax.servlet.ServletContext; -import javax.servlet.ServletContextListener; -import javax.servlet.ServletRegistration; +import jakarta.servlet.Filter; +import jakarta.servlet.FilterRegistration; +import jakarta.servlet.Servlet; +import jakarta.servlet.ServletContext; +import jakarta.servlet.ServletContextListener; +import jakarta.servlet.ServletRegistration; import org.ops4j.pax.web.service.WebContainer; import org.ops4j.pax.web.service.spi.model.OsgiContextModel; @@ -51,12 +51,12 @@ /** *

    This class may be used by container-specific classes to collect dynamic servlets/filters/listeners - * being registered by {@link javax.servlet.ServletContainerInitializer}s.

    + * being registered by {@link jakarta.servlet.ServletContainerInitializer}s.

    * - *

    Just as dynamic registration methods of {@link javax.servlet.ServletContext}, we don't bother with + *

    Just as dynamic registration methods of {@link jakarta.servlet.ServletContext}, we don't bother with * unregistration of the elements. We will eventually clean things up, but only after given context is somehow * destroyed/closed. Registration declarations stored in this class are cleared after invocation of - * context's {@link javax.servlet.ServletContainerInitializer} ends.

    + * context's {@link jakarta.servlet.ServletContainerInitializer} ends.

    */ public class DynamicRegistrations { @@ -106,11 +106,11 @@ public Map getDynamicListenerModels() { // // According to javadocs, addXXX methods may return null if a filter/servlet with given name is already // registered. On the other hand, org.apache.myfaces.ee6.MyFacesContainerInitializer.onStartup() doesn't - // check for null, but checks existence of the servlet using javax.servlet.ServletContext.getServletRegistrations() - // for javax.faces.webapp.FacesServlet class of the servlet + // check for null, but checks existence of the servlet using jakarta.servlet.ServletContext.getServletRegistrations() + // for jakarta.faces.webapp.FacesServlet class of the servlet // to keep Servlet API compliance, we'll check existence by name in ServerModel/FilterModel and return null if // a servlet/filter is already registered - // for servlet mapping (javax.servlet.ServletRegistration.addMapping()), we'll either register the ServletModel + // for servlet mapping (jakarta.servlet.ServletRegistration.addMapping()), we'll either register the ServletModel // or return a set of conflicting mappings (even if Whiteboard specification allows shadowing of the servlets // by service ranking rules) @@ -168,7 +168,7 @@ public FilterRegistration.Dynamic addFilter(OsgiServletContext context, String f private FilterRegistration.Dynamic register(OsgiServletContext context, DynamicFilterRegistration reg) { ServletContextModel scModel = context.getServletContextModel(); if (scModel.getFilterNameMapping().containsKey(reg.getName())) { - // according to javax.servlet.ServletContext.addFilter(java.lang.String, ...) + // according to jakarta.servlet.ServletContext.addFilter(java.lang.String, ...) return null; } @@ -180,8 +180,8 @@ private FilterRegistration.Dynamic register(OsgiServletContext context, DynamicF model.setDynamic(true); configureBundle(context, model, reg.getModel().getActualClass()); - // JavaEE doesn't provide a way to unregister filters registered by - // javax.servlet.ServletContext.addFilter(), but Pax Web does! + // JakartaEE doesn't provide a way to unregister filters registered by + // jakarta.servlet.ServletContext.addFilter(), but Pax Web does! configureUnregistration(context.getOsgiContextModel(), new FilterModelChange(OpCode.DELETE, model)); dynamicFilterRegistrations.put(reg.getName(), reg); @@ -247,7 +247,7 @@ public ServletRegistration.Dynamic addServlet(OsgiServletContext context, String private ServletRegistration.Dynamic register(OsgiServletContext context, DynamicServletRegistration reg) { ServletContextModel scModel = context.getServletContextModel(); if (scModel.getServletNameMapping().containsKey(reg.getName())) { - // according to javax.servlet.ServletContext.addServlet(java.lang.String, ...) + // according to jakarta.servlet.ServletContext.addServlet(java.lang.String, ...) return null; } @@ -259,8 +259,8 @@ private ServletRegistration.Dynamic register(OsgiServletContext context, Dynamic model.setDynamic(true); configureBundle(context, model, reg.getModel().getActualClass()); - // JavaEE doesn't provide a way to unregister servlets registered by - // javax.servlet.ServletContext.addServlet(), but Pax Web does! + // JakartaEE doesn't provide a way to unregister servlets registered by + // jakarta.servlet.ServletContext.addServlet(), but Pax Web does! configureUnregistration(context.getOsgiContextModel(), new ServletModelChange(OpCode.DELETE, model)); dynamicServletRegistrations.put(reg.getName(), reg); @@ -327,8 +327,8 @@ private void register(OsgiServletContext context, DynamicEventListenerRegistrati model.setDynamic(true); configureBundle(context, model, reg.getModel().getEventListener().getClass()); - // JavaEE doesn't provide a way to unregister listeners registered by - // javax.servlet.ServletContext.addListener(), but Pax Web does! + // JakartaEE doesn't provide a way to unregister listeners registered by + // jakarta.servlet.ServletContext.addListener(), but Pax Web does! configureUnregistration(context.getOsgiContextModel(), new EventListenerModelChange(OpCode.DELETE, model)); dynamicListenerRegistrations.put(System.identityHashCode(model.getEventListener()), reg); diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/OsgiDynamicServletContext.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/OsgiDynamicServletContext.java index a54145a2d8..bc6dd96e97 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/OsgiDynamicServletContext.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/OsgiDynamicServletContext.java @@ -25,16 +25,16 @@ import java.util.HashSet; import java.util.Map; import java.util.Set; -import javax.servlet.Filter; -import javax.servlet.FilterRegistration; -import javax.servlet.RequestDispatcher; -import javax.servlet.Servlet; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.ServletRegistration; -import javax.servlet.SessionCookieConfig; -import javax.servlet.SessionTrackingMode; -import javax.servlet.descriptor.JspConfigDescriptor; +import jakarta.servlet.Filter; +import jakarta.servlet.FilterRegistration; +import jakarta.servlet.RequestDispatcher; +import jakarta.servlet.Servlet; +import jakarta.servlet.ServletContext; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRegistration; +import jakarta.servlet.SessionCookieConfig; +import jakarta.servlet.SessionTrackingMode; +import jakarta.servlet.descriptor.JspConfigDescriptor; import org.ops4j.pax.web.service.spi.model.OsgiContextModel; import org.slf4j.Logger; @@ -43,11 +43,11 @@ /** *

    This class wraps {@link OsgiServletContext} and is used to perform "dynamic registration operations" of * servlets, filters and listeners into single physical {@link ServletContext}. This wrapper is passed to - * {@link javax.servlet.ServletContainerInitializer}s and allows dynamic configuration. While the context that's + * {@link jakarta.servlet.ServletContainerInitializer}s and allows dynamic configuration. While the context that's * wrapped doesn't allow this.

    * *

    Many {@link OsgiServletContext}s may point to single container-specific physical servlet context and many - * {@link javax.servlet.ServletContainerInitializer}s may be used to register dynamic servlets/filters/listeners + * {@link jakarta.servlet.ServletContainerInitializer}s may be used to register dynamic servlets/filters/listeners * through many {@link OsgiServletContext}s into single {@link ServletContext}. We need to keep track of the dynamic * web elements registered by multiple SCIs and actually register them later after all SCIs are invoked.

    * @@ -58,19 +58,19 @@ * Tomcat checks {@code !context.getState().equals(LifecycleState.STARTING_PREP)} and Undertow calls * {@code io.undertow.servlet.spec.ServletContextImpl#ensureNotInitialized()} *
  • The basic, most "initial" way of adding listeners is through web.xml, web-fragment.xml or - * {@link javax.servlet.annotation.WebListener} and such listeners should always be able to add more + * {@link jakarta.servlet.annotation.WebListener} and such listeners should always be able to add more * listeners. Each container has it's own way to mark the point when new listeners can't be added:
      *
    • Jetty calls {@code ContextHandler.Context#setEnabled(false)} when invoking first programmatic - * listener, but new {@link javax.servlet.ServletContextListener} can't be added if + * listener, but new {@link jakarta.servlet.ServletContextListener} can't be added if * {@code org.eclipse.jetty.server.handler.ContextHandler.Context#_extendedListenerTypes} is * false
    • - *
    • Tomcat calls SCIs which can add {@link javax.servlet.ServletContextListener}, but then inside + *
    • Tomcat calls SCIs which can add {@link jakarta.servlet.ServletContextListener}, but then inside * {@code org.apache.catalina.core.StandardContext#listenerStart()}, {@code newServletContextListenerAllowed} * is set to {@code false}. Additionally all programmatic ServletContextListeners are marked as * "no pluggability listeners", so they can't add ANY new listener. ServletContextListeners added * in SCIs can add other listeners only.
    • *
    • Undertow allows listeners to call {@link ServletContext#addListener} only if the adding - * listener is NOT programmatic. But new {@link javax.servlet.ServletContextListener} can + * listener is NOT programmatic. But new {@link jakarta.servlet.ServletContextListener} can * never be added anyway
    • *
  • * @@ -93,7 +93,7 @@ public OsgiDynamicServletContext(OsgiServletContext osgiContext, DynamicRegistra /** * This method has to be called after {@link SCIWrapper} calls wrapped - * {@link javax.servlet.ServletContainerInitializer}, so attributes potentially added by the SCI are removed + * {@link jakarta.servlet.ServletContainerInitializer}, so attributes potentially added by the SCI are removed * when the context is restarted. */ public void rememberAttributesFromSCIs() { @@ -280,18 +280,6 @@ public int getMinorVersion() { return osgiContext.getMinorVersion(); } - @Override - @SuppressWarnings({ "deprecation", "RedundantSuppression" }) - public Servlet getServlet(String name) throws ServletException { - return osgiContext.getServlet(name); - } - - @Override - @SuppressWarnings({ "deprecation", "RedundantSuppression" }) - public Enumeration getServletNames() { - return osgiContext.getServletNames(); - } - @Override public ServletRegistration getServletRegistration(String servletName) { // this method returns a ServletRegistration by name. If a servlet is already regitered in the context @@ -315,12 +303,6 @@ public ServletRegistration getServletRegistration(String servletName) { return regs; } - @Override - @SuppressWarnings({ "deprecation", "RedundantSuppression" }) - public Enumeration getServlets() { - return osgiContext.getServlets(); - } - @Override public String getVirtualServerName() { return osgiContext.getVirtualServerName(); @@ -336,12 +318,6 @@ public void log(String msg) { osgiContext.log(msg); } - @Override - @SuppressWarnings({ "deprecation", "RedundantSuppression" }) - public void log(Exception exception, String msg) { - osgiContext.log(exception, msg); - } - @Override public void log(String message, Throwable throwable) { osgiContext.log(message, throwable); diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/OsgiFilterChain.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/OsgiFilterChain.java index c2309c80c1..5a3291e4cb 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/OsgiFilterChain.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/OsgiFilterChain.java @@ -18,25 +18,25 @@ import java.io.IOException; import java.util.LinkedList; import java.util.List; -import javax.servlet.FilterChain; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.FilterChain; +import jakarta.servlet.ServletContext; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.ops4j.pax.web.service.WebContainerContext; import org.osgi.framework.Bundle; -import org.osgi.service.http.whiteboard.Preprocessor; +import org.osgi.service.servlet.whiteboard.Preprocessor; /** * A {@link FilterChain} that can be configured in any runtime to correctly handle two concepts defined in * Http Service / Whiteboard Service specifications:
      *
    • {@link Preprocessor} filters
    • - *
    • {@link org.osgi.service.http.HttpContext#handleSecurity} and/or - * {@link org.osgi.service.http.context.ServletContextHelper#handleSecurity} + - * {@link org.osgi.service.http.context.ServletContextHelper#finishSecurity}
    • + *
    • {@link org.ops4j.pax.web.service.http.HttpContext#handleSecurity} and/or + * {@link org.osgi.service.servlet.context.ServletContextHelper#handleSecurity} + + * {@link org.osgi.service.servlet.context.ServletContextHelper#finishSecurity}
    • *
    */ public class OsgiFilterChain implements FilterChain { diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/OsgiHttpServletRequestWrapper.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/OsgiHttpServletRequestWrapper.java index 321aa5a1f8..8dcf7c506e 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/OsgiHttpServletRequestWrapper.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/OsgiHttpServletRequestWrapper.java @@ -16,13 +16,13 @@ package org.ops4j.pax.web.service.spi.servlet; import java.security.Principal; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletRequestWrapper; -import javax.servlet.http.HttpSession; +import jakarta.servlet.ServletContext; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequestWrapper; +import jakarta.servlet.http.HttpSession; import org.ops4j.pax.web.service.spi.model.OsgiContextModel; -import org.osgi.service.http.context.ServletContextHelper; +import org.osgi.service.servlet.context.ServletContextHelper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/OsgiHttpSession.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/OsgiHttpSession.java index 6285daec5b..7a6add1aed 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/OsgiHttpSession.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/OsgiHttpSession.java @@ -16,8 +16,8 @@ package org.ops4j.pax.web.service.spi.servlet; import java.util.Enumeration; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpSession; +import jakarta.servlet.ServletContext; +import jakarta.servlet.http.HttpSession; /** * Special {@link HttpSession} that:
      @@ -68,56 +68,26 @@ public int getMaxInactiveInterval() { return original.getMaxInactiveInterval(); } - @Override - @SuppressWarnings("deprecation") - public javax.servlet.http.HttpSessionContext getSessionContext() { - return original.getSessionContext(); - } - @Override public Object getAttribute(String name) { return original.getAttribute(name); } - @Override - @SuppressWarnings("deprecation") - public Object getValue(String name) { - return original.getValue(name); - } - @Override public Enumeration getAttributeNames() { return original.getAttributeNames(); } - @Override - @SuppressWarnings("deprecation") - public String[] getValueNames() { - return original.getValueNames(); - } - @Override public void setAttribute(String name, Object value) { original.setAttribute(name, value); } - @Override - @SuppressWarnings("deprecation") - public void putValue(String name, Object value) { - original.putValue(name, value); - } - @Override public void removeAttribute(String name) { original.removeAttribute(name); } - @Override - @SuppressWarnings("deprecation") - public void removeValue(String name) { - original.removeValue(name); - } - @Override public void invalidate() { original.invalidate(); diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/OsgiInitializedFilter.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/OsgiInitializedFilter.java index 256840bd14..ed5463ac9d 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/OsgiInitializedFilter.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/OsgiInitializedFilter.java @@ -27,18 +27,18 @@ import java.util.List; import java.util.regex.Pattern; import java.util.regex.PatternSyntaxException; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.Filter; +import jakarta.servlet.FilterChain; +import jakarta.servlet.FilterConfig; +import jakarta.servlet.ServletContext; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServletRequest; /** * {@link Filter} wrapper that uses correct {@link FilterConfig} wrapper that returns correct wrapper - * for {@link javax.servlet.ServletContext} + * for {@link jakarta.servlet.ServletContext} */ public class OsgiInitializedFilter implements Filter { diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/OsgiInitializedServlet.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/OsgiInitializedServlet.java index b89fcb88c5..f0454e244b 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/OsgiInitializedServlet.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/OsgiInitializedServlet.java @@ -17,18 +17,18 @@ import java.io.IOException; import java.util.Enumeration; -import javax.servlet.Servlet; -import javax.servlet.ServletConfig; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; +import jakarta.servlet.Servlet; +import jakarta.servlet.ServletConfig; +import jakarta.servlet.ServletContext; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; import org.osgi.framework.wiring.BundleWiring; /** * {@link Servlet} wrapper that uses correct {@link ServletConfig} wrapper that returns correct wrapper - * for {@link javax.servlet.ServletContext} related to given servlet. This servlet wrapper class should be used + * for {@link jakarta.servlet.ServletContext} related to given servlet. This servlet wrapper class should be used * for all the runtimes of Pax Web. */ public class OsgiInitializedServlet implements Servlet { diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/OsgiScopedServletContext.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/OsgiScopedServletContext.java index 79f8fcd4e6..6be7f1d89c 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/OsgiScopedServletContext.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/OsgiScopedServletContext.java @@ -22,16 +22,16 @@ import java.util.EventListener; import java.util.Map; import java.util.Set; -import javax.servlet.Filter; -import javax.servlet.FilterRegistration; -import javax.servlet.RequestDispatcher; -import javax.servlet.Servlet; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.ServletRegistration; -import javax.servlet.SessionCookieConfig; -import javax.servlet.SessionTrackingMode; -import javax.servlet.descriptor.JspConfigDescriptor; +import jakarta.servlet.Filter; +import jakarta.servlet.FilterRegistration; +import jakarta.servlet.RequestDispatcher; +import jakarta.servlet.Servlet; +import jakarta.servlet.ServletContext; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRegistration; +import jakarta.servlet.SessionCookieConfig; +import jakarta.servlet.SessionTrackingMode; +import jakarta.servlet.descriptor.JspConfigDescriptor; import org.ops4j.pax.web.service.WebContainerContext; import org.ops4j.pax.web.service.spi.model.OsgiContextModel; @@ -42,9 +42,9 @@ /** *

      This class provides special {@link ServletContext#getClassLoader()} method for Whiteboard elements. * All Whiteboard services should use a {@link ServletContext} which uses single - * {@link org.osgi.service.http.HttpContext} or {@link org.osgi.service.http.context.ServletContextHelper}, but + * {@link org.ops4j.pax.web.service.http.HttpContext} or {@link org.osgi.service.servlet.context.ServletContextHelper}, but * additionally, class loader should come from the bundle which registered the Whiteboard service (e.g., a servlet) - * itself, not from the bundle that has registered the {@link org.osgi.service.http.context.ServletContextHelper}.

      + * itself, not from the bundle that has registered the {@link org.osgi.service.servlet.context.ServletContextHelper}.

      */ public class OsgiScopedServletContext implements ServletContext { @@ -56,7 +56,7 @@ public class OsgiScopedServletContext implements ServletContext { */ private final OsgiServletContext osgiContext; - /** {@link Bundle} which was used to register target {@link javax.servlet.Servlet} */ + /** {@link Bundle} which was used to register target {@link jakarta.servlet.Servlet} */ private final Bundle bundle; private final WebContainerContext webContainerContext; @@ -274,18 +274,6 @@ public int getMinorVersion() { return osgiContext.getMinorVersion(); } - @Override - @SuppressWarnings({ "deprecation", "RedundantSuppression" }) - public Servlet getServlet(String name) throws ServletException { - return osgiContext.getServlet(name); - } - - @Override - @SuppressWarnings({ "deprecation", "RedundantSuppression" }) - public Enumeration getServletNames() { - return osgiContext.getServletNames(); - } - @Override public ServletRegistration getServletRegistration(String servletName) { return osgiContext.getServletRegistration(servletName); @@ -296,12 +284,6 @@ public ServletRegistration getServletRegistration(String servletName) { return osgiContext.getServletRegistrations(); } - @Override - @SuppressWarnings({ "deprecation", "RedundantSuppression" }) - public Enumeration getServlets() { - return osgiContext.getServlets(); - } - @Override public String getVirtualServerName() { return osgiContext.getVirtualServerName(); @@ -317,12 +299,6 @@ public void log(String msg) { osgiContext.log(msg); } - @Override - @SuppressWarnings({ "deprecation", "RedundantSuppression" }) - public void log(Exception exception, String msg) { - osgiContext.log(exception, msg); - } - @Override public void log(String message, Throwable throwable) { osgiContext.log(message, throwable); diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/OsgiServletContext.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/OsgiServletContext.java index 725eff7a3d..4ada328c79 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/OsgiServletContext.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/OsgiServletContext.java @@ -31,18 +31,18 @@ import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.CopyOnWriteArrayList; -import javax.servlet.Filter; -import javax.servlet.FilterRegistration; -import javax.servlet.RequestDispatcher; -import javax.servlet.Servlet; -import javax.servlet.ServletContext; -import javax.servlet.ServletContextAttributeEvent; -import javax.servlet.ServletContextAttributeListener; -import javax.servlet.ServletException; -import javax.servlet.ServletRegistration; -import javax.servlet.SessionCookieConfig; -import javax.servlet.SessionTrackingMode; -import javax.servlet.descriptor.JspConfigDescriptor; +import jakarta.servlet.Filter; +import jakarta.servlet.FilterRegistration; +import jakarta.servlet.RequestDispatcher; +import jakarta.servlet.Servlet; +import jakarta.servlet.ServletContext; +import jakarta.servlet.ServletContextAttributeEvent; +import jakarta.servlet.ServletContextAttributeListener; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRegistration; +import jakarta.servlet.SessionCookieConfig; +import jakarta.servlet.SessionTrackingMode; +import jakarta.servlet.descriptor.JspConfigDescriptor; import org.ops4j.pax.web.service.PaxWebConstants; import org.ops4j.pax.web.service.WebContainerContext; @@ -62,7 +62,7 @@ /** *

      Implementation of {@link ServletContext} for the contract described in 140.2.6 "Behavior of the Servlet Context" * from OSGi CMPN R7 Whiteboard Service specification. That's the 1:1 mapping with single - * {@link org.osgi.service.http.context.ServletContextHelper} (or {@link org.osgi.service.http.HttpContext}).

      + * {@link org.osgi.service.servlet.context.ServletContextHelper} (or {@link org.ops4j.pax.web.service.http.HttpContext}).

      * *

      When handling single servlet (or generally filters+servlet chain), we have to provide special facade for * {@link ServletContext} from Servlet API in the form of {@link OsgiServletContext}. And during actual request @@ -80,8 +80,8 @@ public class OsgiServletContext implements ServletContext { /** * {@link WebContainerContext} obtained from {@link OsgiContextModel} in the context of the bundle registering - * the context ({@link org.osgi.service.http.HttpContext} or - * {@link org.osgi.service.http.context.ServletContextHelper}). This {@link WebContainerContext} is used by + * the context ({@link org.ops4j.pax.web.service.http.HttpContext} or + * {@link org.osgi.service.servlet.context.ServletContextHelper}). This {@link WebContainerContext} is used by * default, but during actual request processing, different {@link WebContainerContext} should be used - the one * obtained (e.g., from OSGi service registry, {@link org.osgi.framework.ServiceFactory}) in the context of a * bundle that registered target {@link Servlet}. @@ -242,7 +242,7 @@ public Set getAttributesToClearBeforeRestart() { } /** - * This method removes the attributes set by {@link javax.servlet.ServletContainerInitializer SCIs} in previous + * This method removes the attributes set by {@link jakarta.servlet.ServletContainerInitializer SCIs} in previous * restart of the context. */ public void clearAttributesFromPreviousCycle() { @@ -303,14 +303,14 @@ public void setWelcomeFilesRedirect(boolean redirect) { /** * This will mark the {@link OsgiServletContext} as a context that still alows for dynamic registration, but - * not if the listener implements {@link javax.servlet.ServletContextListener} + * not if the listener implements {@link jakarta.servlet.ServletContextListener} */ public void noMoreServletContextListeners() { this.acceptsServletContextListeners = false; } /** - * Can {@link javax.servlet.ServletContextListener} be registered? + * Can {@link jakarta.servlet.ServletContextListener} be registered? * @return */ public boolean acceptsServletContextListeners() { @@ -319,7 +319,7 @@ public boolean acceptsServletContextListeners() { /** * This method should be called with the associated context starts, so SCIs can register - * {@link javax.servlet.ServletContextListener} listeners + * {@link jakarta.servlet.ServletContextListener} listeners */ public void allowServletContextListeners() { this.acceptsServletContextListeners = true; @@ -552,18 +552,6 @@ public int getMinorVersion() { return containerServletContext.getMinorVersion(); } - @Override - @SuppressWarnings("deprecation") - public Servlet getServlet(String name) throws ServletException { - return containerServletContext.getServlet(name); - } - - @Override - @SuppressWarnings("deprecation") - public Enumeration getServletNames() { - return containerServletContext.getServletNames(); - } - @Override public ServletRegistration getServletRegistration(String servletName) { return containerServletContext.getServletRegistration(servletName); @@ -574,12 +562,6 @@ public ServletRegistration getServletRegistration(String servletName) { return containerServletContext.getServletRegistrations(); } - @Override - @SuppressWarnings("deprecation") - public Enumeration getServlets() { - return containerServletContext.getServlets(); - } - @Override public String getVirtualServerName() { return containerServletContext.getVirtualServerName(); @@ -595,12 +577,6 @@ public void log(String msg) { containerServletContext.log(msg); } - @Override - @SuppressWarnings("deprecation") - public void log(Exception exception, String msg) { - containerServletContext.log(exception, msg); - } - @Override public void log(String message, Throwable throwable) { containerServletContext.log(message, throwable); @@ -698,7 +674,7 @@ public URL getResource(WebContainerContext context, String path) throws Malforme // ServletContextHelper is roughly compatible, we'll leave it as is - but still we need to support a case // when a WAB is installed, but then, higher-ranked ServletContextHelper is registered for WABs context path. - // special javax.faces.FACELETS_LIBRARIES handling + // special jakarta.faces.FACELETS_LIBRARIES handling @SuppressWarnings("unchecked") Map mapping = (Map) osgiContextModel.getInitialContextAttributes() .get(PaxWebConstants.CONTEXT_PARAM_PAX_WEB_FACELETS_LIBRARIES); diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/OsgiServletContextClassLoader.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/OsgiServletContextClassLoader.java index 29f3be7c4b..a7467cf22f 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/OsgiServletContextClassLoader.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/OsgiServletContextClassLoader.java @@ -21,7 +21,7 @@ import java.util.Collections; import java.util.Enumeration; import java.util.List; -import javax.servlet.ServletContext; +import jakarta.servlet.ServletContext; import org.osgi.framework.Bundle; import org.osgi.framework.BundleReference; @@ -32,10 +32,10 @@ * as the {@link ClassLoader} for {@link OsgiServletContext}.

      * *

      In Whiteboard scenario, an {@link OsgiServletContext} should get a {@link ClassLoader} from a bundle that - * was used to register {@link org.osgi.service.http.context.ServletContextHelper} OSGi service and in case of - * servlets (and filters), the {@link javax.servlet.ServletContext} obtained from {@link javax.servlet.ServletConfig} + * was used to register {@link org.osgi.service.servlet.context.ServletContextHelper} OSGi service and in case of + * servlets (and filters), the {@link jakarta.servlet.ServletContext} obtained from {@link jakarta.servlet.ServletConfig} * should return (in {@link ServletContext#getClassLoader()}) the {@link ClassLoader} of a bundle associated with - * the {@link Bundle} that registered this {@link javax.servlet.Servlet} or {@link javax.servlet.Filter} OSGi service.

      + * the {@link Bundle} that registered this {@link jakarta.servlet.Servlet} or {@link jakarta.servlet.Filter} OSGi service.

      * *

      In practice (and in WAB scenario), the actual {@link ClassLoader} returned from {@link OsgiServletContext} should * also be able to reach to resources/classes for given server runtime (Jetty, Tomcat, Undertow) and engines like JSP.

      diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/OsgiSessionAttributeListener.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/OsgiSessionAttributeListener.java index 1d1ac7de17..a8c85eb9fe 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/OsgiSessionAttributeListener.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/OsgiSessionAttributeListener.java @@ -18,15 +18,15 @@ import java.util.EventListener; import java.util.List; -import javax.servlet.http.HttpSession; -import javax.servlet.http.HttpSessionAttributeListener; -import javax.servlet.http.HttpSessionBindingEvent; +import jakarta.servlet.http.HttpSession; +import jakarta.servlet.http.HttpSessionAttributeListener; +import jakarta.servlet.http.HttpSessionBindingEvent; import org.ops4j.pax.web.service.spi.model.OsgiContextModel; import org.ops4j.pax.web.service.spi.model.elements.EventListenerModel; /** - * A runtime-agnostic interface used to call actual {@link javax.servlet.http.HttpSessionAttributeListener} + * A runtime-agnostic interface used to call actual {@link jakarta.servlet.http.HttpSessionAttributeListener} * listeners registered in specific runtime. */ public final class OsgiSessionAttributeListener { @@ -41,7 +41,7 @@ public OsgiSessionAttributeListener(List sessionListenerMode * Notification about attribute change in {@link OsgiHttpSession} * * @param session - * @param model {@link OsgiContextModel} for which the {@link javax.servlet.http.HttpSession} is scoped + * @param model {@link OsgiContextModel} for which the {@link jakarta.servlet.http.HttpSession} is scoped * @param name * @param value * @param old diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/PreprocessorFilterConfig.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/PreprocessorFilterConfig.java index 34a699467d..adb2c7c134 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/PreprocessorFilterConfig.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/PreprocessorFilterConfig.java @@ -17,16 +17,16 @@ import java.util.Collections; import java.util.Enumeration; -import javax.servlet.Filter; -import javax.servlet.FilterConfig; -import javax.servlet.ServletContext; +import jakarta.servlet.Filter; +import jakarta.servlet.FilterConfig; +import jakarta.servlet.ServletContext; import org.ops4j.pax.web.service.spi.model.elements.FilterModel; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceObjects; import org.osgi.framework.ServiceReference; -import org.osgi.service.http.runtime.dto.DTOConstants; -import org.osgi.service.http.whiteboard.Preprocessor; +import org.osgi.service.servlet.runtime.dto.DTOConstants; +import org.osgi.service.servlet.whiteboard.Preprocessor; public class PreprocessorFilterConfig implements FilterConfig { diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/RegisteringContainerInitializer.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/RegisteringContainerInitializer.java index fc83a76fe1..51731983a7 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/RegisteringContainerInitializer.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/RegisteringContainerInitializer.java @@ -17,9 +17,9 @@ import java.util.Iterator; import java.util.Set; -import javax.servlet.ServletContext; -import javax.servlet.ServletContextListener; -import javax.servlet.ServletException; +import jakarta.servlet.ServletContext; +import jakarta.servlet.ServletContextListener; +import jakarta.servlet.ServletException; import org.ops4j.pax.web.service.spi.model.elements.ContainerInitializerModel; import org.ops4j.pax.web.service.spi.model.views.DynamicJEEWebContainerView; @@ -27,7 +27,7 @@ import org.osgi.framework.Bundle; /** - *

      The {@link javax.servlet.ServletContainerInitializer} that's supposed to collect all the servlets/filters/listeners + *

      The {@link jakarta.servlet.ServletContainerInitializer} that's supposed to collect all the servlets/filters/listeners * that may have beed dynamically added when other SCIs were called and actually register them using full Pax Web * procedure of going through the {@link org.ops4j.pax.web.service.spi.model.ServerModel}, batches and server * controllers.

      diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/RegisteringContextListener.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/RegisteringContextListener.java index c68a560d73..3647c20300 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/RegisteringContextListener.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/RegisteringContextListener.java @@ -15,10 +15,10 @@ */ package org.ops4j.pax.web.service.spi.servlet; -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; -import javax.servlet.ServletSecurityElement; -import javax.servlet.annotation.ServletSecurity; +import jakarta.servlet.ServletContextEvent; +import jakarta.servlet.ServletContextListener; +import jakarta.servlet.ServletSecurityElement; +import jakarta.servlet.annotation.ServletSecurity; import org.ops4j.pax.web.service.spi.model.elements.ServletModel; import org.ops4j.pax.web.service.spi.model.views.DynamicJEEWebContainerView; @@ -55,12 +55,12 @@ public void contextInitialized(ServletContextEvent sce) { // just before the dynamic registration is registered, we have to do additional scanning // check @ServletSecurity (even if "13.4.1 @ServletSecurity Annotation" constraint this to the servlets - // created using javax.servlet.ServletContext.createServlet()...) + // created using jakarta.servlet.ServletContext.createServlet()...) ServletModel model = reg.getModel(); Class cls = model.getServlet() != null ? model.getServlet().getClass() : model.getServletClass(); ServletSecurity security = cls == null ? null : cls.getAnnotation(ServletSecurity.class); if (security != null && !model.isServletSecurityPresent()) { - // it means user didn't call javax.servlet.ServletRegistration.Dynamic.setServletSecurity() + // it means user didn't call jakarta.servlet.ServletRegistration.Dynamic.setServletSecurity() // we can leverage the constructur that accepts the annotation reg.setServletSecurity(new ServletSecurityElement(security)); } diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/SCIWrapper.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/SCIWrapper.java index 9b9b1c4e66..90f29a0c13 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/SCIWrapper.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/SCIWrapper.java @@ -16,9 +16,9 @@ package org.ops4j.pax.web.service.spi.servlet; import java.util.Set; -import javax.servlet.ServletContainerInitializer; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; +import jakarta.servlet.ServletContainerInitializer; +import jakarta.servlet.ServletContext; +import jakarta.servlet.ServletException; import org.ops4j.pax.web.service.spi.model.elements.ContainerInitializerModel; diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/ScopedFilter.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/ScopedFilter.java index ecd11a330a..9552015f64 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/ScopedFilter.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/ScopedFilter.java @@ -16,13 +16,13 @@ package org.ops4j.pax.web.service.spi.servlet; import java.io.IOException; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; +import jakarta.servlet.Filter; +import jakarta.servlet.FilterChain; +import jakarta.servlet.FilterConfig; +import jakarta.servlet.ServletContext; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; import org.ops4j.pax.web.service.spi.model.elements.FilterModel; diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/dynamic/DynamicFilterRegistration.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/dynamic/DynamicFilterRegistration.java index 78328be60b..5f318f6a2d 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/dynamic/DynamicFilterRegistration.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/dynamic/DynamicFilterRegistration.java @@ -22,8 +22,8 @@ import java.util.Map; import java.util.Set; import java.util.stream.Collectors; -import javax.servlet.DispatcherType; -import javax.servlet.FilterRegistration; +import jakarta.servlet.DispatcherType; +import jakarta.servlet.FilterRegistration; import org.ops4j.pax.web.service.spi.model.OsgiContextModel; import org.ops4j.pax.web.service.spi.model.elements.FilterModel; @@ -53,7 +53,7 @@ public FilterModel getModel() { @Override public void addMappingForServletNames(EnumSet dispatcherTypes, boolean isMatchAfter, String... servletNames) { - // we have easier task than in javax.servlet.ServletRegistration.addMapping(), because more servlets + // we have easier task than in jakarta.servlet.ServletRegistration.addMapping(), because more servlets // may be mapped to single servlet by name or to an URL model.addDynamicServletNameMapping(dispatcherTypes, servletNames, isMatchAfter); } diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/dynamic/DynamicServletRegistration.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/dynamic/DynamicServletRegistration.java index d691136c1c..247d9692cb 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/dynamic/DynamicServletRegistration.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/dynamic/DynamicServletRegistration.java @@ -24,11 +24,11 @@ import java.util.List; import java.util.Map; import java.util.Set; -import javax.servlet.HttpMethodConstraintElement; -import javax.servlet.MultipartConfigElement; -import javax.servlet.ServletRegistration; -import javax.servlet.ServletSecurityElement; -import javax.servlet.annotation.ServletSecurity; +import jakarta.servlet.HttpMethodConstraintElement; +import jakarta.servlet.MultipartConfigElement; +import jakarta.servlet.ServletRegistration; +import jakarta.servlet.ServletSecurityElement; +import jakarta.servlet.annotation.ServletSecurity; import org.ops4j.pax.web.service.spi.model.OsgiContextModel; import org.ops4j.pax.web.service.spi.model.ServletContextModel; diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/package-info.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/package-info.java index 9423ea6c0b..3590a43c27 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/package-info.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/package-info.java @@ -16,6 +16,6 @@ /** * Package with classes used in different runtimes for common tasks, like wrapping - * {@link javax.servlet.http.HttpServletRequest}. + * {@link jakarta.servlet.http.HttpServletRequest}. */ package org.ops4j.pax.web.service.spi.servlet; diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/task/Batch.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/task/Batch.java index 677a6915d3..5eefb107fb 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/task/Batch.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/task/Batch.java @@ -215,7 +215,7 @@ public void disableFilterModel(FilterModel model) { * * @param contextFilters * @param dynamic should be set to {@code true} when adding a {@link FilterModel} related to - * {@link javax.servlet.ServletContext#addFilter} + * {@link jakarta.servlet.ServletContext#addFilter} */ public void updateFilters(Map>> contextFilters, boolean dynamic) { operations.add(new FilterStateChange(contextFilters, dynamic)); @@ -411,7 +411,7 @@ public void configureMimeAndEncodingMappings(Map mimeMapping, Ma /** * Operation that clears all dynamic registrations from the model and target context. Dynamic registrations - * are the ones created by e.g., {@link javax.servlet.ServletContext#addServlet}. + * are the ones created by e.g., {@link jakarta.servlet.ServletContext#addServlet}. * @param contextModels */ public void clearDynamicRegistrations(List contextModels) { diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/task/BatchVisitor.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/task/BatchVisitor.java index 0ebe15652c..9369f2ccd6 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/task/BatchVisitor.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/task/BatchVisitor.java @@ -20,7 +20,7 @@ * {@code unregisterServlet}, ...

      * *

      In Pax Web 8, we've tried to decrease duplication of such interfaces (similar methods were available in - * interfaces representing {@link org.osgi.service.http.HttpService}, + * interfaces representing {@link org.ops4j.pax.web.service.http.HttpService}, * {@link org.ops4j.pax.web.service.spi.ServerController}, server abstraction, server state, ... Now, if any class * wants to handle actual (un/re)registrations, it just needs to implement the visitor and correctly * configured {@link Batch} can accept such visitor.

      @@ -125,7 +125,7 @@ default void visitMimeAndLocaleMappingChange(MimeAndLocaleMappingChange change) } /** - * Process a change related to reset of dynamic registrations (like {@link javax.servlet.ServletContext#addServlet} + * Process a change related to reset of dynamic registrations (like {@link jakarta.servlet.ServletContext#addServlet} * @param change */ void visitClearDynamicRegistrationsChange(ClearDynamicRegistrationsChange change); diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/task/ClearDynamicRegistrationsChange.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/task/ClearDynamicRegistrationsChange.java index 5cdf587d86..0153944411 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/task/ClearDynamicRegistrationsChange.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/task/ClearDynamicRegistrationsChange.java @@ -22,7 +22,7 @@ /** * A change that clears all dynamic registrations, potentially made using methods like - * {@link javax.servlet.ServletContext#addServlet} + * {@link jakarta.servlet.ServletContext#addServlet} */ public class ClearDynamicRegistrationsChange extends Change { diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/task/ContextParamsChange.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/task/ContextParamsChange.java index 44e3549242..a45ef9cd7a 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/task/ContextParamsChange.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/task/ContextParamsChange.java @@ -21,7 +21,7 @@ import org.ops4j.pax.web.service.spi.model.OsgiContextModel; /** - * Change of context params ({@link javax.servlet.ServletContext#getInitParameter(String)}). + * Change of context params ({@link jakarta.servlet.ServletContext#getInitParameter(String)}). */ public class ContextParamsChange extends Change { diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/task/EventListenerModelChange.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/task/EventListenerModelChange.java index ce553a5edc..30a37f565b 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/task/EventListenerModelChange.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/task/EventListenerModelChange.java @@ -20,7 +20,7 @@ import java.util.LinkedList; import java.util.List; -import javax.servlet.ServletContextListener; +import jakarta.servlet.ServletContextListener; import org.ops4j.pax.web.service.spi.model.OsgiContextModel; import org.ops4j.pax.web.service.spi.model.elements.EventListenerModel; diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/task/FilterStateChange.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/task/FilterStateChange.java index 141de30f14..980eb29240 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/task/FilterStateChange.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/task/FilterStateChange.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.TreeMap; -import javax.servlet.DispatcherType; +import jakarta.servlet.DispatcherType; import org.ops4j.pax.web.service.spi.model.OsgiContextModel; import org.ops4j.pax.web.service.spi.model.elements.FilterModel; @@ -33,7 +33,7 @@ public class FilterStateChange extends Change { /** * Whether the change is caused by dynamic filter registration. In such case, we should NEVER attempt * to start the context after registering such filter (because most probably we're in the process of starting - * the context and in particular - we're calling {@link javax.servlet.ServletContainerInitializer#onStartup}). + * the context and in particular - we're calling {@link jakarta.servlet.ServletContainerInitializer#onStartup}). */ private boolean dynamic = false; diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/util/FilterAnnotationScanner.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/util/FilterAnnotationScanner.java index c7c4d1ca8a..ffad1ecaba 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/util/FilterAnnotationScanner.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/util/FilterAnnotationScanner.java @@ -18,9 +18,9 @@ import java.util.Arrays; import java.util.LinkedHashMap; import java.util.Map; -import javax.servlet.Filter; -import javax.servlet.annotation.WebFilter; -import javax.servlet.annotation.WebInitParam; +import jakarta.servlet.Filter; +import jakarta.servlet.annotation.WebFilter; +import jakarta.servlet.annotation.WebInitParam; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/util/NamedThreadFactory.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/util/NamedThreadFactory.java index cab0d3cb00..548c9a2aa3 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/util/NamedThreadFactory.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/util/NamedThreadFactory.java @@ -29,8 +29,7 @@ public class NamedThreadFactory implements ThreadFactory { private final String namePrefix; public NamedThreadFactory(String prefix) { - SecurityManager s = System.getSecurityManager(); - group = (s != null) ? s.getThreadGroup() : Thread.currentThread().getThreadGroup(); + group = Thread.currentThread().getThreadGroup(); namePrefix = prefix + "-" + POOL_NUMBER.getAndIncrement() + "-thread-"; } diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/util/ServletAnnotationScanner.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/util/ServletAnnotationScanner.java index fd6d5f215d..1a158e1ee8 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/util/ServletAnnotationScanner.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/util/ServletAnnotationScanner.java @@ -17,10 +17,10 @@ import java.util.LinkedHashMap; import java.util.Map; -import javax.servlet.Servlet; -import javax.servlet.annotation.MultipartConfig; -import javax.servlet.annotation.WebInitParam; -import javax.servlet.annotation.WebServlet; +import jakarta.servlet.Servlet; +import jakarta.servlet.annotation.MultipartConfig; +import jakarta.servlet.annotation.WebInitParam; +import jakarta.servlet.annotation.WebServlet; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/util/Utils.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/util/Utils.java index b799f932e0..1a00dd7846 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/util/Utils.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/util/Utils.java @@ -31,7 +31,7 @@ import java.util.Objects; import java.util.Set; import java.util.function.BiFunction; -import javax.servlet.ServletConfig; +import jakarta.servlet.ServletConfig; import org.apache.felix.utils.properties.InterpolationHelper; import org.ops4j.pax.web.service.PaxWebConstants; @@ -500,9 +500,8 @@ public static Bundle getPaxWebJspBundle(Bundle bundle) { /** * Specialized method that's used to add Jetty WebSocket bundle that we know to contain required - * {@link javax.servlet.ServletContainerInitializer} services. - * Actually Jetty has two bundles with SCIs (websocket-server and javax-websocket-server-impl), but the JSR356 one - * is wired to the native one + * {@link jakarta.servlet.ServletContainerInitializer} services. + * Jetty has websocket related SCI in jetty-ee10-websocket-jakarta-server * @param bundle * @return */ @@ -513,7 +512,7 @@ public static Bundle getJettyWebSocketBundle(Bundle bundle) { } Bundle[] bundles = new Bundle[] { null, null }; for (Bundle b : ctx.getBundles()) { - if ("org.eclipse.jetty.websocket.javax.server".equals(b.getSymbolicName())) { + if ("org.eclipse.jetty.ee10.websocket.jakarta.server".equals(b.getSymbolicName())) { return b; } } @@ -522,7 +521,7 @@ public static Bundle getJettyWebSocketBundle(Bundle bundle) { /** * Specialized method that's used to add Tomcat WebSocket bundle that we know to contain required - * {@link javax.servlet.ServletContainerInitializer} services + * {@link jakarta.servlet.ServletContainerInitializer} services * @param bundle * @return */ @@ -541,7 +540,7 @@ public static Bundle getTomcatWebSocketBundle(Bundle bundle) { /** * Specialized method that's used to add Undertow WebSocket bundle that we know to contain required - * {@link javax.servlet.ServletContainerInitializer} services + * {@link jakarta.servlet.ServletContainerInitializer} services * @param bundle * @return */ @@ -551,7 +550,7 @@ public static Bundle getUndertowWebSocketBundle(Bundle bundle) { return null; } for (Bundle b : ctx.getBundles()) { - // undertow-websockets-jsr doesn't include javax.servlet.ServletContainerInitializer service, so + // undertow-websockets-jsr doesn't include jakarta.servlet.ServletContainerInitializer service, so // we have to provide our own. if ("org.ops4j.pax.web.pax-web-undertow-websocket".equals(b.getSymbolicName())) { return b; @@ -562,7 +561,7 @@ public static Bundle getUndertowWebSocketBundle(Bundle bundle) { /** * Specialized method that's used to add Undertow WebSocket bundle that we know to contain required - * {@link javax.servlet.ServletContainerInitializer} services + * {@link jakarta.servlet.ServletContainerInitializer} services * @param bundle * @return */ @@ -573,7 +572,7 @@ public static Bundle getPaxWebUndertowWebSocketBundle(Bundle bundle) { } for (Bundle b : ctx.getBundles()) { // undertow-websockets-jsr provides necessary - // /META-INF/services/javax.websocket.server.ServerEndpointConfig$Configurator + // /META-INF/services/jakarta.websocket.server.ServerEndpointConfig$Configurator if ("io.undertow.websockets-jsr".equals(b.getSymbolicName())) { return b; } diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/whiteboard/WhiteboardWebContainerView.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/whiteboard/WhiteboardWebContainerView.java index d01eb9379c..21448f7060 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/whiteboard/WhiteboardWebContainerView.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/whiteboard/WhiteboardWebContainerView.java @@ -40,7 +40,7 @@ * *

      The most important difference with direct usage of {@link org.ops4j.pax.web.service.WebContainer} is that * the passed models already have {@link OsgiContextModel}s associated, while in the {@code WebContainer} case - * these have to be translated from {@link org.osgi.service.http.HttpContext}.

      + * these have to be translated from {@link org.ops4j.pax.web.service.http.HttpContext}.

      */ public interface WhiteboardWebContainerView extends PaxWebContainerView { @@ -61,9 +61,9 @@ public interface WhiteboardWebContainerView extends PaxWebContainerView { List getOsgiContextModels(Bundle bundle); /** - * One-stop method to register a {@link javax.servlet.Servlet} described using {@link ServletModel}. + * One-stop method to register a {@link jakarta.servlet.Servlet} described using {@link ServletModel}. * {@link ServletModel} should always be associated with target (one or many) {@link OsgiContextModel}, because - * differently than with {@link org.osgi.service.http.HttpService} scenario, contexts are targeted by logical name + * differently than with {@link org.ops4j.pax.web.service.http.HttpService} scenario, contexts are targeted by logical name * (or LDAP selector) and not as any instance. * @param model */ @@ -76,7 +76,7 @@ public interface WhiteboardWebContainerView extends PaxWebContainerView { void unregisterServlet(ServletModel model); /** - * One-stop method to register a {@link javax.servlet.Filter} described using {@link FilterModel}. + * One-stop method to register a {@link jakarta.servlet.Filter} described using {@link FilterModel}. * {@link FilterModel} should always be associated with target (one or many) {@link OsgiContextModel}. * @param model */ @@ -115,7 +115,7 @@ public interface WhiteboardWebContainerView extends PaxWebContainerView { /** * Passes Whiteboard-registered (customized) {@link OsgiContextModel} to be managed in * {@link org.ops4j.pax.web.service.WebContainer}. Such {@link OsgiContextModel} should have - * {@link org.osgi.service.http.HttpContext} / {@link org.ops4j.pax.web.service.WebContainerContext} configured + * {@link org.ops4j.pax.web.service.http.HttpContext} / {@link org.ops4j.pax.web.service.WebContainerContext} configured * directly. That's the requirement, when Whiteboard cedes the management of such context from * pax-web-extender-whiteboard to pax-web-runtime. * @param model @@ -125,7 +125,7 @@ public interface WhiteboardWebContainerView extends PaxWebContainerView { /** * Removes Whiteboard-registered (customized) {@link OsgiContextModel} from * {@link org.ops4j.pax.web.service.WebContainer}, which may then switch to using "default" - * {@link org.osgi.service.http.HttpContext} + * {@link org.ops4j.pax.web.service.http.HttpContext} * @param model */ void removeWhiteboardOsgiContextModel(OsgiContextModel model); diff --git a/pax-web-spi/src/test/java/org/ops4j/pax/web/service/spi/model/OsgiContextModelTest.java b/pax-web-spi/src/test/java/org/ops4j/pax/web/service/spi/model/OsgiContextModelTest.java index 3e421e0977..8cf762d492 100644 --- a/pax-web-spi/src/test/java/org/ops4j/pax/web/service/spi/model/OsgiContextModelTest.java +++ b/pax-web-spi/src/test/java/org/ops4j/pax/web/service/spi/model/OsgiContextModelTest.java @@ -15,9 +15,9 @@ */ package org.ops4j.pax.web.service.spi.model; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; public class OsgiContextModelTest { @@ -28,7 +28,7 @@ public void sortByRank() { OsgiContextModel ocm2 = new OsgiContextModel(null, 0, 0L, true); ocm2.setContextPath("/testPath"); - assertTrue("Comparing by static atomic id", ocm1.compareTo(ocm2) < 0); + assertTrue(ocm1.compareTo(ocm2) < 0, "Comparing by static atomic id"); } } diff --git a/pax-web-spi/src/test/java/org/ops4j/pax/web/service/spi/servlet/dynamic/DynamicFilterRegistrationTest.java b/pax-web-spi/src/test/java/org/ops4j/pax/web/service/spi/servlet/dynamic/DynamicFilterRegistrationTest.java index 1742211a0b..d97fa239cf 100644 --- a/pax-web-spi/src/test/java/org/ops4j/pax/web/service/spi/servlet/dynamic/DynamicFilterRegistrationTest.java +++ b/pax-web-spi/src/test/java/org/ops4j/pax/web/service/spi/servlet/dynamic/DynamicFilterRegistrationTest.java @@ -18,14 +18,13 @@ import java.util.Collection; import java.util.EnumSet; -import javax.servlet.DispatcherType; +import jakarta.servlet.DispatcherType; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.ops4j.pax.web.service.spi.model.elements.FilterModel; -import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.Assert.assertTrue; +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertTrue; public class DynamicFilterRegistrationTest { @@ -38,7 +37,7 @@ public void flatteningServletNames() { dfr.addMappingForServletNames(EnumSet.of(DispatcherType.ERROR, DispatcherType.INCLUDE), true, "s2", "s4"); Collection patterns = dfr.getServletNameMappings(); - assertThat(patterns.size(), equalTo(4)); + assertThat(patterns.size()).isEqualTo(4); assertTrue(patterns.contains("s1")); assertTrue(patterns.contains("s2")); assertTrue(patterns.contains("s3")); @@ -54,7 +53,7 @@ public void flatteningUrlPatterns() { dfr.addMappingForUrlPatterns(EnumSet.of(DispatcherType.ERROR, DispatcherType.INCLUDE), true, "/s2", "/s3/*"); Collection patterns = dfr.getUrlPatternMappings(); - assertThat(patterns.size(), equalTo(4)); + assertThat(patterns.size()).isEqualTo(4); assertTrue(patterns.contains("/s1")); assertTrue(patterns.contains("/s2")); assertTrue(patterns.contains("/s3")); diff --git a/pax-web-spi/src/test/java/org/ops4j/pax/web/service/spi/util/PathTest.java b/pax-web-spi/src/test/java/org/ops4j/pax/web/service/spi/util/PathTest.java index 92038c402a..6d28cab616 100644 --- a/pax-web-spi/src/test/java/org/ops4j/pax/web/service/spi/util/PathTest.java +++ b/pax-web-spi/src/test/java/org/ops4j/pax/web/service/spi/util/PathTest.java @@ -16,18 +16,16 @@ */ package org.ops4j.pax.web.service.spi.util; +import org.junit.jupiter.api.Test; + import java.io.File; import java.net.MalformedURLException; import java.net.URL; -import org.junit.Test; - -import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.CoreMatchers.nullValue; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.fail; +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.fail; public class PathTest { @@ -37,7 +35,7 @@ public class PathTest { */ @Test public void replaceSlashesWithNull() { - assertNull("Replaced", Path.replaceSlashes(null)); + assertNull(Path.replaceSlashes(null), "Replaced"); } /** @@ -46,7 +44,7 @@ public void replaceSlashesWithNull() { */ @Test public void replaceSlashes01() { - assertEquals("Replaced", "/foo/bar/", Path.replaceSlashes("/foo/bar/")); + assertEquals("/foo/bar/", Path.replaceSlashes("/foo/bar/"), "Replaced"); } /** @@ -54,7 +52,7 @@ public void replaceSlashes01() { */ @Test public void replaceSlashes02() { - assertEquals("Replaced", "/", Path.replaceSlashes("/")); + assertEquals("/", Path.replaceSlashes("/"), "Replaced"); } /** @@ -62,7 +60,7 @@ public void replaceSlashes02() { */ @Test public void replaceSlashes03() { - assertEquals("Replaced", "/", Path.replaceSlashes("/////")); + assertEquals("/", Path.replaceSlashes("/////"), "Replaced"); } /** @@ -70,7 +68,7 @@ public void replaceSlashes03() { */ @Test public void replaceSlashes04() { - assertEquals("Replaced", "/foo/bar", Path.replaceSlashes("///foo/bar")); + assertEquals("/foo/bar", Path.replaceSlashes("///foo/bar"), "Replaced"); } /** @@ -78,7 +76,7 @@ public void replaceSlashes04() { */ @Test public void replaceSlashes05() { - assertEquals("Replaced", "foo/bar/", Path.replaceSlashes("foo/bar///")); + assertEquals("foo/bar/", Path.replaceSlashes("foo/bar///"), "Replaced"); } /** @@ -86,7 +84,7 @@ public void replaceSlashes05() { */ @Test public void replaceSlashes06() { - assertEquals("Replaced", "foo/bar", Path.replaceSlashes("foo////bar")); + assertEquals("foo/bar", Path.replaceSlashes("foo////bar"), "Replaced"); } /** @@ -95,7 +93,7 @@ public void replaceSlashes06() { */ @Test public void replaceSlashes07() { - assertEquals("Replaced", "/foo/bar/car/", Path.replaceSlashes("/foo////bar//car//")); + assertEquals("/foo/bar/car/", Path.replaceSlashes("/foo////bar//car//"), "Replaced"); } /** @@ -104,7 +102,7 @@ public void replaceSlashes07() { */ @Test public void normalizeResourcePathSlash01() { - assertEquals("Normalized", "/", Path.normalizeResourcePath("/")); + assertEquals("/", Path.normalizeResourcePath("/"), "Normalized"); } /** @@ -113,7 +111,7 @@ public void normalizeResourcePathSlash01() { */ @Test public void normalizeResourcePathSlash02() { - assertEquals("Normalized", "/", Path.normalizeResourcePath(" /")); + assertEquals("/", Path.normalizeResourcePath(" /"), "Normalized"); } /** @@ -122,7 +120,7 @@ public void normalizeResourcePathSlash02() { */ @Test public void normalizeResourcePathSlash03() { - assertEquals("Normalized", "/", Path.normalizeResourcePath(" / ")); + assertEquals("/", Path.normalizeResourcePath(" / "), "Normalized"); } /** @@ -131,7 +129,7 @@ public void normalizeResourcePathSlash03() { */ @Test public void normalizeResourcePathSlash04() { - assertEquals("Normalized", "/", Path.normalizeResourcePath("/ ")); + assertEquals("/", Path.normalizeResourcePath("/ "), "Normalized"); } /** @@ -144,21 +142,21 @@ public void normalizeResourcePathSlash04() { */ @Test public void secureNormalization() { - assertThat(Path.securePath(null), equalTo("")); - assertThat(Path.securePath(""), equalTo("")); - assertThat(Path.securePath("/"), equalTo("/")); - assertThat(Path.securePath("."), equalTo("")); - assertThat(Path.securePath(".."), nullValue()); - assertThat(Path.securePath("./."), equalTo("")); - assertThat(Path.securePath("../.."), nullValue()); - assertThat(Path.securePath("..."), equalTo("...")); - assertThat(Path.securePath("/a"), equalTo("/a")); - assertThat(Path.securePath("a"), equalTo("a")); - assertThat(Path.securePath("a/"), equalTo("a/")); - assertThat(Path.securePath("a/b"), equalTo("a/b")); - assertThat(Path.securePath("a/../b"), equalTo("b")); - assertThat(Path.securePath("a/../b/../c"), equalTo("c")); - assertThat(Path.securePath("a/../b/../c/../../"), nullValue()); + assertThat(Path.securePath(null)).isEqualTo(""); + assertThat(Path.securePath("")).isEqualTo(""); + assertThat(Path.securePath("/")).isEqualTo("/"); + assertThat(Path.securePath(".")).isEqualTo(""); + assertThat(Path.securePath("..")).isNull(); + assertThat(Path.securePath("./.")).isEqualTo(""); + assertThat(Path.securePath("../..")).isNull(); + assertThat(Path.securePath("...")).isEqualTo("..."); + assertThat(Path.securePath("/a")).isEqualTo("/a"); + assertThat(Path.securePath("a")).isEqualTo("a"); + assertThat(Path.securePath("a/")).isEqualTo("a/"); + assertThat(Path.securePath("a/b")).isEqualTo("a/b"); + assertThat(Path.securePath("a/../b")).isEqualTo("b"); + assertThat(Path.securePath("a/../b/../c")).isEqualTo("c"); + assertThat(Path.securePath("a/../b/../c/../../")).isNull(); } @Test @@ -176,144 +174,144 @@ public void urlTest() throws MalformedURLException { URL url; url = new URL("file:"); - assertThat(url.getPath(), equalTo("")); - assertThat(url.getHost(), equalTo("")); - assertThat(url.getAuthority(), nullValue()); + assertThat(url.getPath()).isEqualTo(""); + assertThat(url.getHost()).isEqualTo(""); + assertThat(url.getAuthority()).isNull(); url = new URL("file:/"); - assertThat(url.getPath(), equalTo("/")); - assertThat(url.getHost(), equalTo("")); - assertThat(url.getAuthority(), nullValue()); + assertThat(url.getPath()).isEqualTo("/"); + assertThat(url.getHost()).isEqualTo(""); + assertThat(url.getAuthority()).isNull(); url = new URL("file://"); - assertThat(url.getPath(), equalTo("")); - assertThat(url.getHost(), equalTo("")); - assertThat(url.getAuthority(), equalTo("")); + assertThat(url.getPath()).isEqualTo(""); + assertThat(url.getHost()).isEqualTo(""); + assertThat(url.getAuthority()).isEqualTo(""); url = new URL("file:///"); - assertThat(url.getPath(), equalTo("/")); - assertThat(url.getHost(), equalTo("")); - assertThat(url.getAuthority(), equalTo("")); + assertThat(url.getPath()).isEqualTo("/"); + assertThat(url.getHost()).isEqualTo(""); + assertThat(url.getAuthority()).isEqualTo(""); url = new URL("file:////"); - assertThat(url.getPath(), equalTo("////")); - assertThat(url.getHost(), equalTo("")); - assertThat(url.getAuthority(), nullValue()); + assertThat(url.getPath()).isEqualTo("////"); + assertThat(url.getHost()).isEqualTo(""); + assertThat(url.getAuthority()).isNull(); url = new URL("file://///"); - assertThat(url.getPath(), equalTo("/////")); - assertThat(url.getHost(), equalTo("")); - assertThat(url.getAuthority(), nullValue()); + assertThat(url.getPath()).isEqualTo("/////"); + assertThat(url.getHost()).isEqualTo(""); + assertThat(url.getAuthority()).isNull(); url = new URL("file:a"); - assertThat(url.getPath(), equalTo("a")); - assertThat(url.getHost(), equalTo("")); - assertThat(url.getAuthority(), nullValue()); + assertThat(url.getPath()).isEqualTo("a"); + assertThat(url.getHost()).isEqualTo(""); + assertThat(url.getAuthority()).isNull(); url = new URL("file:a/"); - assertThat(url.getPath(), equalTo("a/")); - assertThat(url.getHost(), equalTo("")); - assertThat(url.getAuthority(), nullValue()); + assertThat(url.getPath()).isEqualTo("a/"); + assertThat(url.getHost()).isEqualTo(""); + assertThat(url.getAuthority()).isNull(); url = new URL("file:a//"); - assertThat(url.getPath(), equalTo("a//")); - assertThat(url.getHost(), equalTo("")); - assertThat(url.getAuthority(), nullValue()); + assertThat(url.getPath()).isEqualTo("a//"); + assertThat(url.getHost()).isEqualTo(""); + assertThat(url.getAuthority()).isNull(); url = new URL("file:a///"); - assertThat(url.getPath(), equalTo("a///")); - assertThat(url.getHost(), equalTo("")); - assertThat(url.getAuthority(), nullValue()); + assertThat(url.getPath()).isEqualTo("a///"); + assertThat(url.getHost()).isEqualTo(""); + assertThat(url.getAuthority()).isNull(); url = new URL("file:a////"); - assertThat(url.getPath(), equalTo("a////")); - assertThat(url.getHost(), equalTo("")); - assertThat(url.getAuthority(), nullValue()); + assertThat(url.getPath()).isEqualTo("a////"); + assertThat(url.getHost()).isEqualTo(""); + assertThat(url.getAuthority()).isNull(); url = new URL("file:a/////"); - assertThat(url.getPath(), equalTo("a/////")); - assertThat(url.getHost(), equalTo("")); - assertThat(url.getAuthority(), nullValue()); + assertThat(url.getPath()).isEqualTo("a/////"); + assertThat(url.getHost()).isEqualTo(""); + assertThat(url.getAuthority()).isNull(); url = new URL("file:a"); - assertThat(url.getPath(), equalTo("a")); - assertThat(url.getHost(), equalTo("")); - assertThat(url.getAuthority(), nullValue()); + assertThat(url.getPath()).isEqualTo("a"); + assertThat(url.getHost()).isEqualTo(""); + assertThat(url.getAuthority()).isNull(); url = new URL("file:/a"); - assertThat(url.getPath(), equalTo("/a")); - assertThat(url.getHost(), equalTo("")); - assertThat(url.getAuthority(), nullValue()); + assertThat(url.getPath()).isEqualTo("/a"); + assertThat(url.getHost()).isEqualTo(""); + assertThat(url.getAuthority()).isNull(); url = new URL("file:/a/"); - assertThat(url.getPath(), equalTo("/a/")); - assertThat(url.getHost(), equalTo("")); - assertThat(url.getAuthority(), nullValue()); + assertThat(url.getPath()).isEqualTo("/a/"); + assertThat(url.getHost()).isEqualTo(""); + assertThat(url.getAuthority()).isNull(); url = new URL("file:/a//"); - assertThat(url.getPath(), equalTo("/a//")); - assertThat(url.getHost(), equalTo("")); - assertThat(url.getAuthority(), nullValue()); + assertThat(url.getPath()).isEqualTo("/a//"); + assertThat(url.getHost()).isEqualTo(""); + assertThat(url.getAuthority()).isNull(); url = new URL("file:/a///"); - assertThat(url.getPath(), equalTo("/a///")); - assertThat(url.getHost(), equalTo("")); - assertThat(url.getAuthority(), nullValue()); + assertThat(url.getPath()).isEqualTo("/a///"); + assertThat(url.getHost()).isEqualTo(""); + assertThat(url.getAuthority()).isNull(); url = new URL("file:/a////"); - assertThat(url.getPath(), equalTo("/a////")); - assertThat(url.getHost(), equalTo("")); - assertThat(url.getAuthority(), nullValue()); + assertThat(url.getPath()).isEqualTo("/a////"); + assertThat(url.getHost()).isEqualTo(""); + assertThat(url.getAuthority()).isNull(); url = new URL("file:/"); - assertThat(url.getPath(), equalTo("/")); - assertThat(url.getHost(), equalTo("")); - assertThat(url.getAuthority(), nullValue()); + assertThat(url.getPath()).isEqualTo("/"); + assertThat(url.getHost()).isEqualTo(""); + assertThat(url.getAuthority()).isNull(); url = new URL("file://a"); - assertThat(url.getPath(), equalTo("")); - assertThat(url.getHost(), equalTo("a")); - assertThat(url.getAuthority(), equalTo("a")); + assertThat(url.getPath()).isEqualTo(""); + assertThat(url.getHost()).isEqualTo("a"); + assertThat(url.getAuthority()).isEqualTo("a"); url = new URL("file://a/"); - assertThat(url.getPath(), equalTo("/")); - assertThat(url.getHost(), equalTo("a")); - assertThat(url.getAuthority(), equalTo("a")); + assertThat(url.getPath()).isEqualTo("/"); + assertThat(url.getHost()).isEqualTo("a"); + assertThat(url.getAuthority()).isEqualTo("a"); url = new URL("file://a//"); - assertThat(url.getPath(), equalTo("//")); - assertThat(url.getHost(), equalTo("a")); - assertThat(url.getAuthority(), equalTo("a")); + assertThat(url.getPath()).isEqualTo("//"); + assertThat(url.getHost()).isEqualTo("a"); + assertThat(url.getAuthority()).isEqualTo("a"); url = new URL("file://a///"); - assertThat(url.getPath(), equalTo("///")); - assertThat(url.getHost(), equalTo("a")); - assertThat(url.getAuthority(), equalTo("a")); + assertThat(url.getPath()).isEqualTo("///"); + assertThat(url.getHost()).isEqualTo("a"); + assertThat(url.getAuthority()).isEqualTo("a"); url = new URL("file:/"); - assertThat(url.getPath(), equalTo("/")); - assertThat(url.getHost(), equalTo("")); - assertThat(url.getAuthority(), nullValue()); + assertThat(url.getPath()).isEqualTo("/"); + assertThat(url.getHost()).isEqualTo(""); + assertThat(url.getAuthority()).isNull(); url = new URL("file://"); - assertThat(url.getPath(), equalTo("")); - assertThat(url.getHost(), equalTo("")); - assertThat(url.getAuthority(), equalTo("")); + assertThat(url.getPath()).isEqualTo(""); + assertThat(url.getHost()).isEqualTo(""); + assertThat(url.getAuthority()).isEqualTo(""); url = new URL("file:///a"); - assertThat(url.getPath(), equalTo("/a")); - assertThat(url.getHost(), equalTo("")); - assertThat(url.getAuthority(), equalTo("")); + assertThat(url.getPath()).isEqualTo("/a"); + assertThat(url.getHost()).isEqualTo(""); + assertThat(url.getAuthority()).isEqualTo(""); url = new URL("file:///a/"); - assertThat(url.getPath(), equalTo("/a/")); - assertThat(url.getHost(), equalTo("")); - assertThat(url.getAuthority(), equalTo("")); + assertThat(url.getPath()).isEqualTo("/a/"); + assertThat(url.getHost()).isEqualTo(""); + assertThat(url.getAuthority()).isEqualTo(""); url = new URL("file:///a//"); - assertThat(url.getPath(), equalTo("/a//")); - assertThat(url.getHost(), equalTo("")); - assertThat(url.getAuthority(), equalTo("")); + assertThat(url.getPath()).isEqualTo("/a//"); + assertThat(url.getHost()).isEqualTo(""); + assertThat(url.getAuthority()).isEqualTo(""); } @Test diff --git a/pax-web-spi/src/test/java/org/ops4j/pax/web/service/spi/util/UtilsTest.java b/pax-web-spi/src/test/java/org/ops4j/pax/web/service/spi/util/UtilsTest.java index bae68fa50c..b9c8804987 100644 --- a/pax-web-spi/src/test/java/org/ops4j/pax/web/service/spi/util/UtilsTest.java +++ b/pax-web-spi/src/test/java/org/ops4j/pax/web/service/spi/util/UtilsTest.java @@ -15,17 +15,15 @@ */ package org.ops4j.pax.web.service.spi.util; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.CoreMatchers.not; -import static org.hamcrest.MatcherAssert.assertThat; +import static org.assertj.core.api.Assertions.assertThat; public class UtilsTest { @Test public void substitution() { - assertThat(Utils.resolve("${java.home}"), not(equalTo("${java.home}"))); + assertThat(Utils.resolve("${java.home}")).isNotEqualTo("${java.home}"); } }