diff --git a/pom.xml b/pom.xml index 206d8bee953a..bd1b5d15d4c0 100644 --- a/pom.xml +++ b/pom.xml @@ -58,10 +58,6 @@ 12.0.12 10.0.24 ${jetty.client.version} - - 2.0.13 4.1.113.Final 5.6.15.Final 3.4.0 diff --git a/xwiki-platform-core/pom.xml b/xwiki-platform-core/pom.xml index d14fb99f50ed..36a1465948b2 100644 --- a/xwiki-platform-core/pom.xml +++ b/xwiki-platform-core/pom.xml @@ -138,10 +138,93 @@ Single justification example: --> - - - - + + + revapi false positives + allowed + + + true + true + java.method.addedToInterface + .*@ com.xpn.xwiki.web.XWikiResponse + + + true + true + java.method.addedToInterface + .*@ com.xpn.xwiki.web.XWikiRequest + + + true + java.class.nonFinalClassInheritsFromNewClass + class com.xpn.xwiki.render.ScriptXWikiServletRequest + class com.xpn.xwiki.render.ScriptXWikiServletRequest + javax.servlet.ServletRequestWrapper + + + true + java.class.nonFinalClassInheritsFromNewClass + class com.xpn.xwiki.web.WrappingXWikiRequest + class com.xpn.xwiki.web.WrappingXWikiRequest + javax.servlet.ServletRequestWrapper + + + + + Move to Jakarta + highlight + + + true + true + .* + .*org.xwiki.websocket.AbstractXWikiEndpoint.* + + + true + true + .* + .*org.xwiki.container.servlet.SetThreadNameServletRequestListener.* + + + true + true + .* + .*org.xwiki.resource.servlet.ResourceReferenceHandlerServlet.* + + + true + true + .* + .*org.xwiki.resource.servlet.RoutingFilter.* + + + true + true + .* + .*org.xwiki.wysiwyg.filter.ConversionFilter.* + + + true + true + .* + .*com.xpn.xwiki.web.ActionFilter.* + + + true + true + .* + .*com.xpn.xwiki.web.HomePageRedirectServlet.* + + + true + true + .* + .*com.xpn.xwiki.web.LegacyActionServlet.* + + + diff --git a/xwiki-platform-core/xwiki-platform-activeinstalls2/xwiki-platform-activeinstalls2-api/pom.xml b/xwiki-platform-core/xwiki-platform-activeinstalls2/xwiki-platform-activeinstalls2-api/pom.xml index 8e03de1d6562..366deeb79363 100644 --- a/xwiki-platform-core/xwiki-platform-activeinstalls2/xwiki-platform-activeinstalls2-api/pom.xml +++ b/xwiki-platform-core/xwiki-platform-activeinstalls2/xwiki-platform-activeinstalls2-api/pom.xml @@ -74,9 +74,10 @@ - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api + org.testcontainers diff --git a/xwiki-platform-core/xwiki-platform-annotation/xwiki-platform-annotation-core/pom.xml b/xwiki-platform-core/xwiki-platform-annotation/xwiki-platform-annotation-core/pom.xml index 5c78d6463181..ea2c2abc4ba2 100644 --- a/xwiki-platform-core/xwiki-platform-annotation/xwiki-platform-annotation-core/pom.xml +++ b/xwiki-platform-core/xwiki-platform-annotation/xwiki-platform-annotation-core/pom.xml @@ -85,14 +85,13 @@ test - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api test - - org.mortbay.jasper - apache-el + org.glassfish.expressly + expressly test diff --git a/xwiki-platform-core/xwiki-platform-annotation/xwiki-platform-annotation-io/pom.xml b/xwiki-platform-core/xwiki-platform-annotation/xwiki-platform-annotation-io/pom.xml index dcf4074bd0e7..3fb959986ae8 100644 --- a/xwiki-platform-core/xwiki-platform-annotation/xwiki-platform-annotation-io/pom.xml +++ b/xwiki-platform-core/xwiki-platform-annotation/xwiki-platform-annotation-io/pom.xml @@ -68,8 +68,8 @@ - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api test diff --git a/xwiki-platform-core/xwiki-platform-annotation/xwiki-platform-annotation-maintainer/pom.xml b/xwiki-platform-core/xwiki-platform-annotation/xwiki-platform-annotation-maintainer/pom.xml index b618b3ba4175..65190ffe6723 100644 --- a/xwiki-platform-core/xwiki-platform-annotation/xwiki-platform-annotation-maintainer/pom.xml +++ b/xwiki-platform-core/xwiki-platform-annotation/xwiki-platform-annotation-maintainer/pom.xml @@ -108,8 +108,8 @@ test - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api test diff --git a/xwiki-platform-core/xwiki-platform-annotation/xwiki-platform-annotation-rest/pom.xml b/xwiki-platform-core/xwiki-platform-annotation/xwiki-platform-annotation-rest/pom.xml index 2ff82da9a724..658d863eaa16 100644 --- a/xwiki-platform-core/xwiki-platform-annotation/xwiki-platform-annotation-rest/pom.xml +++ b/xwiki-platform-core/xwiki-platform-annotation/xwiki-platform-annotation-rest/pom.xml @@ -64,8 +64,8 @@ ${project.version} - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api org.xwiki.platform diff --git a/xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-api/pom.xml b/xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-api/pom.xml index 78202ea7a7e6..d27df771853e 100644 --- a/xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-api/pom.xml +++ b/xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-api/pom.xml @@ -51,8 +51,8 @@ ${project.version} - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api org.xwiki.platform diff --git a/xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-validation/xwiki-platform-attachment-validation-api/pom.xml b/xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-validation/xwiki-platform-attachment-validation-api/pom.xml index 0672c2fc3b1d..00c38c94e5a7 100644 --- a/xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-validation/xwiki-platform-attachment-validation-api/pom.xml +++ b/xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-validation/xwiki-platform-attachment-validation-api/pom.xml @@ -42,8 +42,8 @@ ${commons.version} - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api org.xwiki.commons diff --git a/xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-validation/xwiki-platform-attachment-validation-default/pom.xml b/xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-validation/xwiki-platform-attachment-validation-default/pom.xml index 4579c2d39d76..cdd73070bae8 100644 --- a/xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-validation/xwiki-platform-attachment-validation-default/pom.xml +++ b/xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-validation/xwiki-platform-attachment-validation-default/pom.xml @@ -68,8 +68,8 @@ test - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api test diff --git a/xwiki-platform-core/xwiki-platform-captcha/xwiki-platform-captcha-jcaptcha/xwiki-platform-captcha-jcaptcha-api/pom.xml b/xwiki-platform-core/xwiki-platform-captcha/xwiki-platform-captcha-jcaptcha/xwiki-platform-captcha-jcaptcha-api/pom.xml index 26107691d2a0..b5a2a42d3173 100644 --- a/xwiki-platform-core/xwiki-platform-captcha/xwiki-platform-captcha-jcaptcha/xwiki-platform-captcha-jcaptcha-api/pom.xml +++ b/xwiki-platform-core/xwiki-platform-captcha/xwiki-platform-captcha-jcaptcha/xwiki-platform-captcha-jcaptcha-api/pom.xml @@ -94,8 +94,8 @@ - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api org.xwiki.commons diff --git a/xwiki-platform-core/xwiki-platform-component/xwiki-platform-component-wiki/pom.xml b/xwiki-platform-core/xwiki-platform-component/xwiki-platform-component-wiki/pom.xml index 40a0089fb997..beb713640a8b 100644 --- a/xwiki-platform-core/xwiki-platform-component/xwiki-platform-component-wiki/pom.xml +++ b/xwiki-platform-core/xwiki-platform-component/xwiki-platform-component-wiki/pom.xml @@ -81,14 +81,10 @@ - javax.servlet - javax.servlet-api - test - - - org.xwiki.commons - xwiki-commons-tool-test-component - ${commons.version} + org.xwiki.platform + xwiki-platform-test-oldcore + ${project.version} + pom test @@ -97,13 +93,6 @@ ${commons.version} test - - org.xwiki.platform - xwiki-platform-test-oldcore - ${project.version} - pom - test - diff --git a/xwiki-platform-core/xwiki-platform-configuration/xwiki-platform-configuration-default/pom.xml b/xwiki-platform-core/xwiki-platform-configuration/xwiki-platform-configuration-default/pom.xml index 662a80d1cce4..109bf64469ae 100644 --- a/xwiki-platform-core/xwiki-platform-configuration/xwiki-platform-configuration-default/pom.xml +++ b/xwiki-platform-core/xwiki-platform-configuration/xwiki-platform-configuration-default/pom.xml @@ -91,10 +91,6 @@ ${commons.version} test - - javax.servlet - javax.servlet-api - diff --git a/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-portlet/src/main/java/org/xwiki/container/portlet/PortletApplicationContext.java b/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-portlet/src/main/java/org/xwiki/container/portlet/PortletApplicationContext.java index e4c090b5a275..31963188e436 100644 --- a/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-portlet/src/main/java/org/xwiki/container/portlet/PortletApplicationContext.java +++ b/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-portlet/src/main/java/org/xwiki/container/portlet/PortletApplicationContext.java @@ -66,6 +66,6 @@ public File getTemporaryDirectory() { // Section PLT.10.3 from the Portlet 1.0 specification says that this should be available. // FIXME: why is this using a servlet specifications variable name ? Is that really valid for a portlet ? - return (File) this.portletContext.getAttribute("javax.servlet.context.tempdir"); + return (File) this.portletContext.getAttribute("jakarta.servlet.context.tempdir"); } } diff --git a/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/pom.xml b/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/pom.xml index e9e795e1d93c..539d0b590c26 100644 --- a/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/pom.xml +++ b/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/pom.xml @@ -35,6 +35,10 @@ 0.15 + + jakarta.servlet + jakarta.servlet-api + org.xwiki.commons xwiki-commons-component-default @@ -71,8 +75,9 @@ ${project.version} - javax.servlet - javax.servlet-api + org.xwiki.commons + xwiki-commons-jakartabridge-servlet + ${commons.version} diff --git a/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/HttpServletUtils.java b/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/HttpServletUtils.java index e80ce49627a6..24628886a34b 100644 --- a/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/HttpServletUtils.java +++ b/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/HttpServletUtils.java @@ -22,15 +22,17 @@ import java.net.MalformedURLException; import java.net.URL; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - import org.apache.commons.lang3.StringUtils; import org.apache.http.HeaderElement; import org.apache.http.message.BasicHeader; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.xwiki.container.servlet.internal.ForwardedHeader; +import org.xwiki.jakartabridge.servlet.JakartaServletBridge; +import org.xwiki.stability.Unstable; + +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; /** * Various helpers around the {@link HttpServletRequest} and {@link HttpServletResponse} API. @@ -82,8 +84,11 @@ private HttpServletUtils() * * @param servletRequest the servlet request input * @return the URL as close as possible from what the client used + * @throws MalformedURLException when an invalid URL was received + * @since 42.0.0 */ - public static URL getSourceURL(HttpServletRequest servletRequest) + @Unstable + public static URL getSourceURL(HttpServletRequest servletRequest) throws MalformedURLException { URL baseURL = getSourceBaseURL(servletRequest); @@ -96,12 +101,7 @@ public static URL getSourceURL(HttpServletRequest servletRequest) path.append(servletRequest.getQueryString()); } - try { - return new URL(baseURL, path.toString()); - } catch (MalformedURLException e) { - // Not really supposed to happen - throw new RuntimeException("XWiki received an invalid URL path or query string", e); - } + return new URL(baseURL, path.toString()); } /** @@ -113,8 +113,11 @@ public static URL getSourceURL(HttpServletRequest servletRequest) * * @param servletRequest the servlet request input * @return the URL as close as possible from what the client used + * @throws MalformedURLException when an invalid URL was received + * @since 42.0.0 */ - public static URL getSourceBaseURL(HttpServletRequest servletRequest) + @Unstable + public static URL getSourceBaseURL(HttpServletRequest servletRequest) throws MalformedURLException { StringBuilder builder = new StringBuilder(); @@ -132,14 +135,9 @@ public static URL getSourceBaseURL(HttpServletRequest servletRequest) } } - private static URL getFinalBaseURL(HttpServletRequest servletRequest) + private static URL getFinalBaseURL(HttpServletRequest servletRequest) throws MalformedURLException { - try { - return new URL(servletRequest.getScheme(), servletRequest.getRemoteHost(), servletRequest.getRemotePort(), - ""); - } catch (MalformedURLException e) { - throw new RuntimeException("XWiki received an invalid URL", e); - } + return new URL(servletRequest.getScheme(), servletRequest.getRemoteHost(), servletRequest.getRemotePort(), ""); } private static void appendScheme(HttpServletRequest request, StringBuilder builder) @@ -241,8 +239,9 @@ private static String getFirstHeaderValue(HttpServletRequest request, String key /** * @param request the servlet request input * @return true if the request explicitly disable getting resources from the cache - * @since 11.8RC1 + * @since 42.0.0 */ + @Unstable public static boolean isCacheReadAllowed(HttpServletRequest request) { String headerValue = request.getHeader(HEADER_CACHE_CONTROL); @@ -258,4 +257,58 @@ public static boolean isCacheReadAllowed(HttpServletRequest request) return true; } + + // Deprecated + + /** + * Try to extract from various http headers the URL ({@code ://[:]/[?]}) as + * close as possible to the one used by the client. + *

+ * In theory HttpServletRequest#getRequestURL() is supposed to take care of all that but depending on the + * application server and its configuration it's not always reliable. One less thing to configure. + * + * @param servletRequest the servlet request input + * @return the URL as close as possible from what the client used + */ + @Deprecated(since = "42.0.0") + public static URL getSourceURL(javax.servlet.http.HttpServletRequest servletRequest) + { + try { + return getSourceURL(JakartaServletBridge.toJakarta(servletRequest)); + } catch (MalformedURLException e) { + // Not really supposed to happen + throw new RuntimeException("XWiki received an invalid URL path or query string", e); + } + } + + /** + * Try to extract from various http headers the base URL ({@code ://[:]}) as close as possible + * to the one used by the client. + *

+ * In theory HttpServletRequest#getRequestURL() is supposed to take care of all that but depending on the + * application server and its configuration it's not always reliable. One less thing to configure. + * + * @param servletRequest the servlet request input + * @return the URL as close as possible from what the client used + */ + @Deprecated(since = "42.0.0") + public static URL getSourceBaseURL(javax.servlet.http.HttpServletRequest servletRequest) + { + try { + return getSourceBaseURL(JakartaServletBridge.toJakarta(servletRequest)); + } catch (MalformedURLException e) { + throw new RuntimeException("XWiki received an invalid URL", e); + } + } + + /** + * @param request the servlet request input + * @return true if the request explicitly disable getting resources from the cache + * @since 11.8RC1 + */ + @Deprecated(since = "42.0.0") + public static boolean isCacheReadAllowed(javax.servlet.http.HttpServletRequest request) + { + return isCacheReadAllowed(JakartaServletBridge.toJakarta(request)); + } } diff --git a/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/ServletContainerInitializer.java b/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/ServletContainerInitializer.java index f65ffb16cdd5..c63ad9ddad5e 100644 --- a/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/ServletContainerInitializer.java +++ b/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/ServletContainerInitializer.java @@ -19,28 +19,44 @@ */ package org.xwiki.container.servlet; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - import org.xwiki.component.annotation.Role; +import org.xwiki.jakartabridge.servlet.JakartaServletBridge; +import org.xwiki.stability.Unstable; + +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; @Role public interface ServletContainerInitializer { - void initializeRequest(HttpServletRequest request, Object xwikiContext) - throws ServletContainerException; - - void initializeRequest(HttpServletRequest request) + @Deprecated(since = "42.0.0") + void initializeRequest(javax.servlet.http.HttpServletRequest request, Object xwikiContext) throws ServletContainerException; - void initializeResponse(HttpServletResponse response); - - void initializeSession(HttpServletRequest request); + @Deprecated(since = "42.0.0") + void initializeRequest(javax.servlet.http.HttpServletRequest request) throws ServletContainerException; + + @Deprecated(since = "42.0.0") + void initializeResponse(javax.servlet.http.HttpServletResponse response); + + @Deprecated(since = "42.0.0") + void initializeSession(javax.servlet.http.HttpServletRequest request); /** * @deprecated use the notion of Environment instead */ @Deprecated(since = "3.5M1") - void initializeApplicationContext(ServletContext servletContext); + void initializeApplicationContext(javax.servlet.ServletContext servletContext); + + /** + * @param request the current request + * @param response the current response + * @since 42.0.0 + */ + @Unstable + default void initializeRequest(HttpServletRequest request, HttpServletResponse response) + throws ServletContainerException + { + initializeRequest(JakartaServletBridge.toJavax(request), JakartaServletBridge.toJavax(response)); + } } diff --git a/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/ServletRequest.java b/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/ServletRequest.java index 9a6cfc9616c4..695bf75209e0 100644 --- a/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/ServletRequest.java +++ b/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/ServletRequest.java @@ -24,21 +24,62 @@ import java.util.List; import org.xwiki.container.Request; +import org.xwiki.jakartabridge.servlet.JakartaServletBridge; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; +/** + * This is the implementation of {@link Request} for {@link HttpServletRequest}. + * + * @version $Id$ + */ public class ServletRequest implements Request { - private HttpServletRequest httpServletRequest; + private final HttpServletRequest jakartaHttpServletRequest; + + private javax.servlet.http.HttpServletRequest javaxHttpServletRequest; + + /** + * @param jakartaHttpServletRequest the standard Jakarta {@link HttpServletRequest} instance + * @since 42.0.0 + */ + public ServletRequest(HttpServletRequest jakartaHttpServletRequest) + { + this.jakartaHttpServletRequest = jakartaHttpServletRequest; + } - public ServletRequest(HttpServletRequest httpServletRequest) + /** + * @param javaxHttpServletRequest the legacy Javax {@link javax.servlet.http.HttpServletRequest} instance + * @deprecated use {@link #ServletRequest(HttpServletRequest)} instead + */ + @Deprecated(since = "42.0.0") + public ServletRequest(javax.servlet.http.HttpServletRequest javaxHttpServletRequest) { - this.httpServletRequest = httpServletRequest; + this.javaxHttpServletRequest = javaxHttpServletRequest; + this.jakartaHttpServletRequest = JakartaServletBridge.toJakarta(javaxHttpServletRequest); } - public HttpServletRequest getHttpServletRequest() + /** + * @return the standard Jakarta {@link HttpServletRequest} instance + * @since 42.0.0 + */ + public HttpServletRequest getJakartaHttpServletRequest() { - return this.httpServletRequest; + return this.jakartaHttpServletRequest; + } + + /** + * @return the legacy Javax {@link javax.servlet.http.HttpServletRequest} instance + * @deprecated use {@link #getJakartaHttpServletRequest()} instead + */ + @Deprecated(since = "42.0.0") + public javax.servlet.http.HttpServletRequest getHttpServletRequest() + { + if (this.javaxHttpServletRequest == null) { + this.javaxHttpServletRequest = JakartaServletBridge.toJavax(this.jakartaHttpServletRequest); + } + + return this.javaxHttpServletRequest; } @Override @@ -47,9 +88,9 @@ public Object getProperty(String key) Object result; // Look first in the Query Parameters and then in the Query Attributes - result = this.httpServletRequest.getParameter(key); + result = this.jakartaHttpServletRequest.getParameter(key); if (result == null) { - result = this.httpServletRequest.getAttribute(key); + result = this.jakartaHttpServletRequest.getAttribute(key); } return result; @@ -58,14 +99,14 @@ public Object getProperty(String key) @Override public List getProperties(String key) { - List result = new ArrayList(); + List result = new ArrayList<>(); // Look first in the Query Parameters and then in the Query Attributes - Object[] requestParameters = this.httpServletRequest.getParameterValues(key); + Object[] requestParameters = this.jakartaHttpServletRequest.getParameterValues(key); if (requestParameters != null) { result.addAll(Arrays.asList(requestParameters)); } - Object attributeValue = this.httpServletRequest.getAttribute(key); + Object attributeValue = this.jakartaHttpServletRequest.getAttribute(key); if (attributeValue != null) { result.add(attributeValue); } @@ -76,12 +117,12 @@ public List getProperties(String key) @Override public void setProperty(String key, Object value) { - this.httpServletRequest.setAttribute(key, value); + this.jakartaHttpServletRequest.setAttribute(key, value); } @Override public void removeProperty(String key) { - this.httpServletRequest.removeAttribute(key); + this.jakartaHttpServletRequest.removeAttribute(key); } } diff --git a/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/ServletResponse.java b/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/ServletResponse.java index d23d98b58b4b..2274ae60e5a9 100644 --- a/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/ServletResponse.java +++ b/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/ServletResponse.java @@ -22,10 +22,11 @@ import java.io.IOException; import java.io.OutputStream; -import javax.servlet.http.HttpServletResponse; - import org.xwiki.container.RedirectResponse; import org.xwiki.container.Response; +import org.xwiki.jakartabridge.servlet.JakartaServletBridge; + +import jakarta.servlet.http.HttpServletResponse; /** * This is the implementation of {@link Response} for {@link HttpServletResponse}. @@ -34,23 +35,58 @@ */ public class ServletResponse implements Response, RedirectResponse { - private HttpServletResponse httpServletResponse; + private final HttpServletResponse jakartaHttpServletResponse; + + private javax.servlet.http.HttpServletResponse javaxHttpServletResponse; + + /** + * @param jakartaHttpServletResponse the standard Jakarta {@link HttpServletResponse} instance + * @since 42.0.0 + */ + public ServletResponse(HttpServletResponse jakartaHttpServletResponse) + { + this.jakartaHttpServletResponse = jakartaHttpServletResponse; + } - public ServletResponse(HttpServletResponse httpServletResponse) + /** + * @param javaxHttpServletResponse the legacy Javax {@link javax.servlet.http.HttpServletResponse} instance + * @deprecated use {@link #ServletResponse(HttpServletResponse)} instead + */ + @Deprecated(since = "42.0.0") + public ServletResponse(javax.servlet.http.HttpServletResponse javaxHttpServletResponse) { - this.httpServletResponse = httpServletResponse; + this.javaxHttpServletResponse = javaxHttpServletResponse; + this.jakartaHttpServletResponse = JakartaServletBridge.toJakarta(javaxHttpServletResponse); } - public HttpServletResponse getHttpServletResponse() + /** + * @return the standard Jakarta {@link HttpServletResponse} instance + * @since 42.0.0 + */ + public HttpServletResponse getJakartaHttpServletResponse() { - return this.httpServletResponse; + return this.jakartaHttpServletResponse; + } + + /** + * @return the legacy Javax {@link javax.servlet.http.HttpServletResponse} instance + * @deprecated use {@link #getJakartaHttpServletResponse()} instead + */ + @Deprecated(since = "42.0.0") + public javax.servlet.http.HttpServletResponse getHttpServletResponse() + { + if (this.javaxHttpServletResponse == null) { + this.javaxHttpServletResponse = JakartaServletBridge.toJavax(this.jakartaHttpServletResponse); + } + + return this.javaxHttpServletResponse; } @Override public OutputStream getOutputStream() throws IOException { try { - return this.httpServletResponse.getOutputStream(); + return this.jakartaHttpServletResponse.getOutputStream(); } catch (IllegalStateException ex) { return null; } @@ -59,18 +95,18 @@ public OutputStream getOutputStream() throws IOException @Override public void setContentLength(int length) { - this.httpServletResponse.setContentLength(length); + this.jakartaHttpServletResponse.setContentLength(length); } @Override public void setContentType(String mimeType) { - this.httpServletResponse.setContentType(mimeType); + this.jakartaHttpServletResponse.setContentType(mimeType); } @Override public void sendRedirect(String location) throws IOException { - this.httpServletResponse.sendRedirect(location); + this.jakartaHttpServletResponse.sendRedirect(location); } } diff --git a/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/ServletSession.java b/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/ServletSession.java index a7e17b370af6..10eabe95f1b0 100644 --- a/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/ServletSession.java +++ b/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/ServletSession.java @@ -20,20 +20,51 @@ package org.xwiki.container.servlet; import org.xwiki.container.Session; +import org.xwiki.jakartabridge.servlet.JakartaServletBridge; +import org.xwiki.stability.Unstable; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpSession; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpSession; public class ServletSession implements Session { private HttpSession httpSession; + /** + * @param request the servlet request + * @deprecated use {@link #ServletSession(HttpServletRequest)} instead + */ + @Deprecated(since = "42.0.0") + public ServletSession(javax.servlet.http.HttpServletRequest request) + { + this(JakartaServletBridge.toJakarta(request)); + } + + /** + * @param request the servlet request + * @since 42.0.0 + */ + @Unstable public ServletSession(HttpServletRequest request) { this.httpSession = request.getSession(true); } - public HttpSession getHttpSession() + /** + * @deprecated use {@link #getJakartaHttpSession()} instead + */ + @Deprecated(since = "42.0.0") + public javax.servlet.http.HttpSession getHttpSession() + { + return JakartaServletBridge.toJavax(this.httpSession); + } + + /** + * @return the current servlet session + * @since 42.0.0 + */ + @Unstable + public HttpSession getJakartaHttpSession() { return this.httpSession; } diff --git a/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/SetThreadNameServletRequestListener.java b/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/SetThreadNameServletRequestListener.java index d4d53998a749..2f2670d1f319 100644 --- a/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/SetThreadNameServletRequestListener.java +++ b/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/SetThreadNameServletRequestListener.java @@ -19,22 +19,27 @@ */ package org.xwiki.container.servlet; -import javax.servlet.ServletRequest; -import javax.servlet.ServletRequestEvent; -import javax.servlet.ServletRequestListener; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletRequestEvent; +import jakarta.servlet.ServletRequestListener; +import jakarta.servlet.http.HttpServletRequest; /** - * Make threads names created by the application server more meaningful. + * Make threads names created by the application server more meaningful. TODO When it will be possible it would be + * better to do this a component like a RequestInitializer component to work for any kind of container. Right now + * component can't really access the initial URL. + *

+ * While the class is much older, the since annotation was moved to 42.0.0 because it implement a completely different + * API from Java point of view. * - * TODO When it will be possible it would be better to do this a component like a RequestInitializer component to work - * for any kind of container. Right now component can't really access the initial URL. * @version $Id$ - * @since 2.0M3 + * @since 42.0.0 */ public class SetThreadNameServletRequestListener implements ServletRequestListener { - /** The name of the servlet request attribute holding the original name of the processing thread. */ + /** + * The name of the servlet request attribute holding the original name of the processing thread. + */ private static final String ORIGINAL_THREAD_NAME_ATTRIBUTE = "xwiki.thread.originalName"; @Override @@ -42,9 +47,7 @@ public void requestInitialized(ServletRequestEvent sre) { ServletRequest servletRequest = sre.getServletRequest(); - if (servletRequest instanceof HttpServletRequest) { - HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest; - + if (servletRequest instanceof HttpServletRequest httpServletRequest) { String threadName = httpServletRequest.getRequestURL().toString(); if (httpServletRequest.getQueryString() != null) { @@ -65,8 +68,7 @@ public void requestInitialized(ServletRequestEvent sre) public void requestDestroyed(ServletRequestEvent sre) { ServletRequest servletRequest = sre.getServletRequest(); - if (servletRequest instanceof HttpServletRequest) { - HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest; + if (servletRequest instanceof HttpServletRequest httpServletRequest) { Thread.currentThread().setName("" + httpServletRequest.getAttribute(ORIGINAL_THREAD_NAME_ATTRIBUTE)); } } diff --git a/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/XWikiServletContextListener.java b/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/XWikiServletContextInitializer.java similarity index 93% rename from xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/XWikiServletContextListener.java rename to xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/XWikiServletContextInitializer.java index 7054d0fa2af8..b97e2c63b1bd 100644 --- a/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/XWikiServletContextListener.java +++ b/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/XWikiServletContextInitializer.java @@ -19,9 +19,6 @@ */ package org.xwiki.container.servlet; -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.xwiki.component.embed.EmbeddableComponentManager; @@ -33,16 +30,24 @@ import org.xwiki.environment.Environment; import org.xwiki.environment.internal.ServletEnvironment; import org.xwiki.extension.handler.ExtensionInitializer; +import org.xwiki.jakartabridge.servlet.JakartaServletBridge; import org.xwiki.observation.ObservationManager; import org.xwiki.observation.event.ApplicationStartedEvent; import org.xwiki.observation.event.ApplicationStoppedEvent; +import jakarta.servlet.ServletContextEvent; +import jakarta.servlet.ServletContextListener; + /** * Implementation of the {@link ServletContextListener}. Initializes component manager and application context. + *

+ * While the class is much older, the since annotation was moved to 42.0.0 because it implement a completely + * different API from Java point of view. * * @version $Id$ + * @since 42.0.0 */ -public class XWikiServletContextListener implements ServletContextListener +public class XWikiServletContextInitializer implements ServletContextListener { /** * Logger to use to log shutdown information (opposite of initialization). @@ -97,7 +102,8 @@ public void contextInitialized(ServletContextEvent servletContextEvent) try { ServletContainerInitializer containerInitializer = this.componentManager.getInstance(ServletContainerInitializer.class); - containerInitializer.initializeApplicationContext(servletContextEvent.getServletContext()); + containerInitializer + .initializeApplicationContext(JakartaServletBridge.toJavax(servletContextEvent.getServletContext())); } catch (ComponentLookupException e) { throw new RuntimeException("Failed to initialize the Application Context", e); } @@ -118,7 +124,7 @@ public void contextInitialized(ServletContextEvent servletContextEvent) throw new RuntimeException("Failed to initialize installed extensions", e); } - // Register the HttpSessionManager as a listener. + // Register the HttpSessionManager as a listener. try { HttpSessionManager httpSessionManager = this.componentManager.getInstance(HttpSessionManager.class); servletContextEvent.getServletContext().addListener(httpSessionManager); diff --git a/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/filters/SavedRequestManager.java b/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/filters/SavedRequestManager.java index 30e499273dfe..20b4aebee56b 100644 --- a/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/filters/SavedRequestManager.java +++ b/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/filters/SavedRequestManager.java @@ -23,11 +23,13 @@ import java.util.HashMap; import java.util.Map; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpSession; - import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.lang3.StringUtils; +import org.xwiki.jakartabridge.servlet.JakartaServletBridge; +import org.xwiki.stability.Unstable; + +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpSession; /** * Allows to save a request and restore it later from the stored request identifier (SRID). @@ -64,20 +66,33 @@ public static class SavedRequest implements Serializable * Constructor that copies the needed information from a request. * * @param request the request that needs to be saved + * @deprecated use {@link #SavedRequest(HttpServletRequest)}) instead */ - @SuppressWarnings("unchecked") + @Deprecated(since = "42.0.0") + public SavedRequest(javax.servlet.http.HttpServletRequest request) + { + this(JakartaServletBridge.toJakarta(request)); + } + + /** + * Constructor that copies the needed information from a request. + * + * @param request the request that needs to be saved + * @since 42.0.0 + */ + @Unstable public SavedRequest(HttpServletRequest request) { - this.parameters = new HashMap(request.getParameterMap()); + this.parameters = new HashMap<>(request.getParameterMap()); this.requestUrl = request.getRequestURL().toString(); } /** - * Gets the value for a parameter, just like {@link javax.servlet.ServletRequest#getParameter(String)}. + * Gets the value for a parameter, just like {@link jakarta.servlet.ServletRequest#getParameter(String)}. * * @param name the name of the parameter * @return The first value for this parameter, or null if no value was sent for this parameter. - * @see javax.servlet.ServletRequest#getParameter(String) + * @see jakarta.servlet.ServletRequest#getParameter(String) * @see #getParameterValues(String) */ public String getParameter(String name) @@ -91,11 +106,11 @@ public String getParameter(String name) /** * Gets all the values stored for a parameter, just like - * {@link javax.servlet.ServletRequest#getParameterValues(String)}. + * {@link jakarta.servlet.ServletRequest#getParameterValues(String)}. * * @param name the name of the parameter * @return All the values for this parameter, or null if no value was sent for this parameter. - * @see javax.servlet.ServletRequest#getParameterValues(String) + * @see jakarta.servlet.ServletRequest#getParameterValues(String) * @see #getParameter(String) */ public String[] getParameterValues(String name) @@ -104,10 +119,10 @@ public String[] getParameterValues(String name) } /** - * Gets all the stored parameters, just like {@link javax.servlet.ServletRequest#getParameterMap()}. + * Gets all the stored parameters, just like {@link jakarta.servlet.ServletRequest#getParameterMap()}. * * @return A map with all the stored parameters. - * @see javax.servlet.ServletRequest#getParameterMap() + * @see jakarta.servlet.ServletRequest#getParameterMap() */ public Map getParameterMap() { @@ -156,7 +171,24 @@ public static String getSavedRequestKey() * * @param request the request to save * @return the identifier of the saved request + * @deprecated use {@link #saveRequest(HttpServletRequest)} instead */ + @Deprecated(since = "42.0.0") + public static String saveRequest(javax.servlet.http.HttpServletRequest request) + { + return saveRequest(JakartaServletBridge.toJakarta(request)); + } + + /** + * Saves the data from a request and stores it in the current session. This method is not thread safe, and does not + * guarantee that saved requests are not overwritten, but given that this should only happen sparingly, and that + * each client uses his own session to save this kind of information, this is not a real issue. + * + * @param request the request to save + * @return the identifier of the saved request + * @since 42.0.0 + */ + @Unstable @SuppressWarnings("unchecked") public static String saveRequest(HttpServletRequest request) { @@ -166,7 +198,7 @@ public static String saveRequest(HttpServletRequest request) Map savedRequests = (Map) session.getAttribute(getSavedRequestKey()); if (savedRequests == null) { - savedRequests = new HashMap(); + savedRequests = new HashMap<>(); session.setAttribute(getSavedRequestKey(), savedRequests); } // Save the request data @@ -190,7 +222,25 @@ public static String saveRequest(HttpServletRequest request) * @param request the current request * @return the original requested URL that triggered a detour, or null if there isn't any original * request information + * @deprecated use {@link #getOriginalUrl(HttpServletRequest)} instead + */ + @Deprecated(since = "42.0.0") + public static String getOriginalUrl(javax.servlet.http.HttpServletRequest request) + { + return getOriginalUrl(JakartaServletBridge.toJakarta(request)); + } + + /** + * Retrieves the original URL requested before a detour. This method returns something different from + * null only when there's a srid parameter in the current request, indicating that there was + * another request which data was saved, related to the current request. + * + * @param request the current request + * @return the original requested URL that triggered a detour, or null if there isn't any original + * request information + * @since 42.0.0 */ + @Unstable @SuppressWarnings("unchecked") public static String getOriginalUrl(HttpServletRequest request) { diff --git a/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/filters/internal/SavedRequestRestorerFilter.java b/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/filters/internal/SavedRequestRestorerFilter.java index 497f09f8e284..291d70f34314 100644 --- a/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/filters/internal/SavedRequestRestorerFilter.java +++ b/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/filters/internal/SavedRequestRestorerFilter.java @@ -27,15 +27,15 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletRequestWrapper; -import javax.servlet.http.HttpSession; +import jakarta.servlet.Filter; +import jakarta.servlet.FilterChain; +import jakarta.servlet.FilterConfig; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequestWrapper; +import jakarta.servlet.http.HttpSession; import org.apache.commons.lang3.StringUtils; import org.xwiki.container.servlet.filters.SavedRequestManager; @@ -61,8 +61,12 @@ * safe as a session is, and it will not be available after the session is invalidated. Another consequence is that only * HTTP requests are saved. *

+ *

+ * While the class is much older, the since annotation was moved to 42.0.0 because it implement a completely + * different API from Java point of view. * * @version $Id$ + * @since 42.0.0 */ public class SavedRequestRestorerFilter implements Filter { @@ -156,7 +160,6 @@ public String[] getParameterValues(String name) * @return an immutable Map containing parameter names as keys and parameter values as map values * @see javax.servlet.ServletRequest#getParameterMap() */ - @SuppressWarnings("unchecked") @Override public Map getParameterMap() { @@ -191,13 +194,13 @@ public void init(FilterConfig filterConfig) } @Override - public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, - ServletException + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) + throws IOException, ServletException { ServletRequest filteredRequest = request; // This filter works only for HTTP requests, because they are the only ones with a session. if (request instanceof HttpServletRequest - && !Boolean.valueOf((String) request.getAttribute(ATTRIBUTE_APPLIED))) { + && !Boolean.valueOf((String) request.getAttribute(ATTRIBUTE_APPLIED))) { // Get the saved request, if any (returns null if not applicable) SavedRequest savedRequest = getSavedRequest((HttpServletRequest) request); // Merge the new and the saved request diff --git a/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/filters/internal/SetCharacterEncodingFilter.java b/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/filters/internal/SetCharacterEncodingFilter.java index 650288c51cc8..3f78ef036bf4 100644 --- a/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/filters/internal/SetCharacterEncodingFilter.java +++ b/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/filters/internal/SetCharacterEncodingFilter.java @@ -21,12 +21,12 @@ import java.io.IOException; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -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.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; /** *

@@ -51,9 +51,13 @@ * characteristics of the incoming request (such as the values of the Accept-Language * and User-Agent headers, or a value stashed in the current user's session. *

+ *

+ * While the class is much older, the since annotation was moved to 42.0.0 because it implement a completely different API + * from Java point of view. * * @author Craig McClanahan * @version $Id$ + * @since 42.0.0 */ public class SetCharacterEncodingFilter implements Filter { diff --git a/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/filters/internal/SetHTTPHeaderFilter.java b/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/filters/internal/SetHTTPHeaderFilter.java index a306a2b297e1..f7ae02c175a6 100644 --- a/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/filters/internal/SetHTTPHeaderFilter.java +++ b/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/filters/internal/SetHTTPHeaderFilter.java @@ -21,19 +21,22 @@ import java.io.IOException; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.Filter; +import jakarta.servlet.FilterChain; +import jakarta.servlet.FilterConfig; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServletResponse; /** * Filter that set the desired header of the HTTP response to the desired value. + *

+ * While the class is much older, the since annotation was moved to 42.0.0 because it implement a completely + * different API from Java point of view. * * @version $Id$ - * @since 6.3M2 + * @since 42.0.0 */ public class SetHTTPHeaderFilter implements Filter { diff --git a/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/internal/CacheControlRequestInitializer.java b/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/internal/CacheControlRequestInitializer.java index 542c7a0429a3..9036a6ce85aa 100644 --- a/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/internal/CacheControlRequestInitializer.java +++ b/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/internal/CacheControlRequestInitializer.java @@ -47,8 +47,8 @@ public class CacheControlRequestInitializer implements RequestInitializer public void initialize(Request request) throws RequestInitializerException { // Indicate if the request explicitly disable getting resources from the cache - if (request instanceof ServletRequest - && !HttpServletUtils.isCacheReadAllowed(((ServletRequest) request).getHttpServletRequest())) { + if (request instanceof ServletRequest servletRequest + && !HttpServletUtils.isCacheReadAllowed(servletRequest.getJakartaHttpServletRequest())) { this.cacheControl.setCacheReadAllowed(false); } } diff --git a/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/internal/DefaultServletContainerInitializer.java b/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/internal/DefaultServletContainerInitializer.java index 6b710c25d00b..b9f404332e83 100644 --- a/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/internal/DefaultServletContainerInitializer.java +++ b/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/internal/DefaultServletContainerInitializer.java @@ -22,8 +22,6 @@ import javax.inject.Inject; import javax.inject.Singleton; import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; import org.xwiki.component.annotation.Component; import org.xwiki.component.manager.ComponentManager; @@ -41,17 +39,13 @@ import org.xwiki.context.ExecutionContext; import org.xwiki.context.ExecutionContextManager; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; + @Component @Singleton public class DefaultServletContainerInitializer implements ServletContainerInitializer { - // Implementation note: It's important that we don't use @Inject annotations here - // for RequestInitializerManager and ExecutionContextManager since we can have - // RequestInitializer and ExecutionContextInitializer components which try to access - // the Application Context in their initialize() method and we need it to be available - // (i.e. initializeApplicationContext() needs to have been called) before they are - // looked up (and thus initialized). - @Inject private ApplicationContextListenerManager applicationContextListenerManager; @@ -64,6 +58,40 @@ public class DefaultServletContainerInitializer implements ServletContainerIniti @Inject private ComponentManager componentManager; + @Override + public void initializeRequest(HttpServletRequest request, HttpServletResponse response) + throws ServletContainerException + { + // 1) Set the request and the response in the Container. From this point forward request initializers can use + // the Container object to get any data they want from the Request. + this.container.setRequest(new ServletRequest(request)); + if (response != null) { + this.container.setResponse(new ServletResponse(response)); + } + + // 2) Create an empty Execution context so that the Container initializers can put things in the + // execution context when they execute. + this.execution.setContext(new ExecutionContext()); + + // 3) Call the request initializers to populate the Request further. + try { + RequestInitializerManager manager = this.componentManager.getInstance(RequestInitializerManager.class); + manager.initializeRequest(this.container.getRequest()); + } catch (Exception e) { + throw new ServletContainerException("Failed to initialize request", e); + } + + // 4) Call Execution Context initializers to perform further Execution Context initializations + try { + ExecutionContextManager manager = this.componentManager.getInstance(ExecutionContextManager.class); + manager.initialize(this.execution.getContext()); + } catch (Exception e) { + throw new ServletContainerException("Failed to initialize Execution Context", e); + } + } + + // Deprecated + /** * @deprecated use the notion of Environment instead */ @@ -77,7 +105,8 @@ public void initializeApplicationContext(ServletContext servletContext) } @Override - public void initializeRequest(HttpServletRequest httpServletRequest, Object xwikiContext) + @Deprecated(since = "42.0.0") + public void initializeRequest(javax.servlet.http.HttpServletRequest httpServletRequest, Object xwikiContext) throws ServletContainerException { // 1) Create an empty request. From this point forward request initializers can use the @@ -118,19 +147,23 @@ public void initializeRequest(HttpServletRequest httpServletRequest, Object xwik } @Override - public void initializeRequest(HttpServletRequest httpServletRequest) throws ServletContainerException + @Deprecated(since = "42.0.0") + public void initializeRequest(javax.servlet.http.HttpServletRequest httpServletRequest) + throws ServletContainerException { initializeRequest(httpServletRequest, null); } @Override - public void initializeResponse(HttpServletResponse httpServletResponse) + @Deprecated(since = "42.0.0") + public void initializeResponse(javax.servlet.http.HttpServletResponse httpServletResponse) { this.container.setResponse(new ServletResponse(httpServletResponse)); } @Override - public void initializeSession(HttpServletRequest httpServletRequest) + @Deprecated(since = "42.0.0") + public void initializeSession(javax.servlet.http.HttpServletRequest httpServletRequest) { this.container.setSession(new ServletSession(httpServletRequest)); } diff --git a/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/internal/HttpSessionManager.java b/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/internal/HttpSessionManager.java index c60ed9b24550..0e52f5c4a38e 100644 --- a/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/internal/HttpSessionManager.java +++ b/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/internal/HttpSessionManager.java @@ -23,11 +23,11 @@ import java.util.List; import java.util.concurrent.ConcurrentLinkedQueue; -import javax.inject.Inject; -import javax.inject.Singleton; -import javax.servlet.http.HttpSession; -import javax.servlet.http.HttpSessionEvent; -import javax.servlet.http.HttpSessionListener; +import jakarta.inject.Inject; +import jakarta.inject.Singleton; +import jakarta.servlet.http.HttpSession; +import jakarta.servlet.http.HttpSessionEvent; +import jakarta.servlet.http.HttpSessionListener; import org.xwiki.component.annotation.Component; import org.xwiki.component.manager.ComponentLifecycleException; @@ -39,13 +39,15 @@ import org.xwiki.observation.ObservationManager; /** - * Manager in charge of keeping track of the {@link HttpSession}. - * One of the role of this component is to properly call {@link HttpSession#invalidate()} on all sessions before - * disposal of the component: this ensures that all listeners relying on the session disposal can be executed. + * Manager in charge of keeping track of the {@link HttpSession}. One of the role of this component is to properly call + * {@link HttpSession#invalidate()} on all sessions before disposal of the component: this ensures that all listeners + * relying on the session disposal can be executed. + *

+ * While the class is much older, the since annotation was moved to 42.0.0 because it implements a completely + * different API from Java point of view. * * @version $Id$ - * @since 14.5 - * @since 14.4.1 + * @since 42.0.0 */ @Component(roles = HttpSessionManager.class) @Singleton diff --git a/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/test/java/org/xwiki/container/servlet/internal/HttpSessionManagerTest.java b/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/test/java/org/xwiki/container/servlet/internal/HttpSessionManagerTest.java index 02ac3b975375..bcbd3e2cc5ff 100644 --- a/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/test/java/org/xwiki/container/servlet/internal/HttpSessionManagerTest.java +++ b/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/test/java/org/xwiki/container/servlet/internal/HttpSessionManagerTest.java @@ -21,8 +21,8 @@ import java.util.List; -import javax.servlet.http.HttpSession; -import javax.servlet.http.HttpSessionEvent; +import jakarta.servlet.http.HttpSession; +import jakarta.servlet.http.HttpSessionEvent; import org.junit.jupiter.api.Test; import org.xwiki.component.manager.ComponentLifecycleException; diff --git a/xwiki-platform-core/xwiki-platform-crypto/xwiki-platform-crypto-store/xwiki-platform-crypto-store-wiki/pom.xml b/xwiki-platform-core/xwiki-platform-crypto/xwiki-platform-crypto-store/xwiki-platform-crypto-store-wiki/pom.xml index c77466282b13..92f0ee385def 100644 --- a/xwiki-platform-core/xwiki-platform-crypto/xwiki-platform-crypto-store/xwiki-platform-crypto-store-wiki/pom.xml +++ b/xwiki-platform-core/xwiki-platform-crypto/xwiki-platform-crypto-store/xwiki-platform-crypto-store-wiki/pom.xml @@ -91,8 +91,8 @@ test - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api test diff --git a/xwiki-platform-core/xwiki-platform-csrf/pom.xml b/xwiki-platform-core/xwiki-platform-csrf/pom.xml index 540e9fc6a374..d68420aa5f3f 100644 --- a/xwiki-platform-core/xwiki-platform-csrf/pom.xml +++ b/xwiki-platform-core/xwiki-platform-csrf/pom.xml @@ -66,8 +66,8 @@ ${project.version} - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api commons-codec diff --git a/xwiki-platform-core/xwiki-platform-csrf/src/main/java/org/xwiki/csrf/internal/DefaultCSRFToken.java b/xwiki-platform-core/xwiki-platform-csrf/src/main/java/org/xwiki/csrf/internal/DefaultCSRFToken.java index 14047ca6eab7..855e89220568 100644 --- a/xwiki-platform-core/xwiki-platform-csrf/src/main/java/org/xwiki/csrf/internal/DefaultCSRFToken.java +++ b/xwiki-platform-core/xwiki-platform-csrf/src/main/java/org/xwiki/csrf/internal/DefaultCSRFToken.java @@ -28,7 +28,6 @@ import javax.inject.Inject; import javax.inject.Singleton; -import javax.servlet.http.HttpServletRequest; import org.apache.commons.codec.binary.Base64; import org.slf4j.Logger; @@ -44,6 +43,8 @@ import org.xwiki.csrf.CSRFTokenConfiguration; import org.xwiki.model.reference.DocumentReference; +import jakarta.servlet.http.HttpServletRequest; + /** * Concrete implementation of the {@link CSRFToken} component. *

@@ -70,7 +71,7 @@ public class DefaultCSRFToken implements CSRFToken, Initializable private static final String RESUBMIT_TEMPLATE = "resubmit"; /** Token storage (one token per user). */ - private final ConcurrentMap tokens = new ConcurrentHashMap(); + private final ConcurrentMap tokens = new ConcurrentHashMap<>(); /** Token for guest user. */ private String guestToken; @@ -168,8 +169,9 @@ public boolean isTokenValid(String token) } String storedToken = getToken(); if (token == null || token.equals("") || !storedToken.equals(token)) { - this.logger.warn("CSRFToken: Secret token verification failed, token: \"" + token - + "\", stored token: \"" + storedToken + "\""); + this.logger.warn("CSRFToken: Secret token verification failed, token: \"{}\", stored token: \"{}\"", token, + storedToken); + return false; } return true; @@ -238,9 +240,10 @@ private String urlEncode(String str) private HttpServletRequest getRequest() { Request request = this.container.getRequest(); - if (request instanceof ServletRequest) { - return ((ServletRequest) request).getHttpServletRequest(); + if (request instanceof ServletRequest servletRequest) { + return servletRequest.getJakartaHttpServletRequest(); } + throw new RuntimeException("Not supported request type"); } diff --git a/xwiki-platform-core/xwiki-platform-dashboard/xwiki-platform-dashboard-macro/pom.xml b/xwiki-platform-core/xwiki-platform-dashboard/xwiki-platform-dashboard-macro/pom.xml index d3e4705eab4d..16261940d208 100644 --- a/xwiki-platform-core/xwiki-platform-dashboard/xwiki-platform-dashboard-macro/pom.xml +++ b/xwiki-platform-core/xwiki-platform-dashboard/xwiki-platform-dashboard-macro/pom.xml @@ -82,13 +82,8 @@ test - javax.servlet - javax.servlet-api - test - - - org.mortbay.jasper - apache-el + org.glassfish.expressly + expressly test diff --git a/xwiki-platform-core/xwiki-platform-diff/xwiki-platform-diff-xml/pom.xml b/xwiki-platform-core/xwiki-platform-diff/xwiki-platform-diff-xml/pom.xml index 05b3f1f916f5..2da00b4bb24a 100644 --- a/xwiki-platform-core/xwiki-platform-diff/xwiki-platform-diff-xml/pom.xml +++ b/xwiki-platform-core/xwiki-platform-diff/xwiki-platform-diff-xml/pom.xml @@ -54,8 +54,8 @@ ${project.version} - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api org.xwiki.commons diff --git a/xwiki-platform-core/xwiki-platform-eventstream/xwiki-platform-eventstream-stores/xwiki-platform-eventstream-store-solr/pom.xml b/xwiki-platform-core/xwiki-platform-eventstream/xwiki-platform-eventstream-stores/xwiki-platform-eventstream-store-solr/pom.xml index 76bdc99c0ab6..40fbf189acc6 100644 --- a/xwiki-platform-core/xwiki-platform-eventstream/xwiki-platform-eventstream-stores/xwiki-platform-eventstream-store-solr/pom.xml +++ b/xwiki-platform-core/xwiki-platform-eventstream/xwiki-platform-eventstream-stores/xwiki-platform-eventstream-store-solr/pom.xml @@ -98,11 +98,6 @@ ${commons.version} test - - javax.servlet - javax.servlet-api - test - org.xwiki.platform xwiki-platform-search-solr-api diff --git a/xwiki-platform-core/xwiki-platform-export/xwiki-platform-export-pdf/xwiki-platform-export-pdf-api/pom.xml b/xwiki-platform-core/xwiki-platform-export/xwiki-platform-export-pdf/xwiki-platform-export-pdf-api/pom.xml index 7bc5cc523c27..a3afb5902b3a 100644 --- a/xwiki-platform-core/xwiki-platform-export/xwiki-platform-export-pdf/xwiki-platform-export-pdf-api/pom.xml +++ b/xwiki-platform-core/xwiki-platform-export/xwiki-platform-export-pdf/xwiki-platform-export-pdf-api/pom.xml @@ -78,8 +78,8 @@ ${project.version} - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api diff --git a/xwiki-platform-core/xwiki-platform-export/xwiki-platform-export-pdf/xwiki-platform-export-pdf-api/src/main/java/org/xwiki/export/pdf/browser/BrowserTab.java b/xwiki-platform-core/xwiki-platform-export/xwiki-platform-export-pdf/xwiki-platform-export-pdf-api/src/main/java/org/xwiki/export/pdf/browser/BrowserTab.java index 434a0cd54f54..4ace7285ff2e 100644 --- a/xwiki-platform-core/xwiki-platform-export/xwiki-platform-export-pdf/xwiki-platform-export-pdf-api/src/main/java/org/xwiki/export/pdf/browser/BrowserTab.java +++ b/xwiki-platform-core/xwiki-platform-export/xwiki-platform-export-pdf/xwiki-platform-export-pdf-api/src/main/java/org/xwiki/export/pdf/browser/BrowserTab.java @@ -23,7 +23,10 @@ import java.io.InputStream; import java.net.URL; -import javax.servlet.http.Cookie; +import org.xwiki.jakartabridge.servlet.JakartaServletBridge; +import org.xwiki.stability.Unstable; + +import jakarta.servlet.http.Cookie; /** * Represents a web browser tab. @@ -43,8 +46,42 @@ public interface BrowserTab extends AutoCloseable * @return {@code true} if the navigation was successful, {@code false} otherwise * @throws IOException if navigating to the specified web page fails * @since 14.9 + * @deprecated use {@link #navigate(URL, Cookie[], boolean, int)} instead + */ + @Deprecated(since = "42.0.0") + boolean navigate(URL url, javax.servlet.http.Cookie[] cookies, boolean wait, int timeout) throws IOException; + + /** + * Navigates to the specified web page, optionally waiting for it to be ready (fully loaded). + * + * @param url the URL of the web page we are going to navigate to + * @param cookies the cookies to use when loading the specified web page + * @param wait {@code true} to wait for the page to be ready, {@code false} otherwise + * @param timeout the number of seconds to wait for the web page to be ready before timing out + * @return {@code true} if the navigation was successful, {@code false} otherwise + * @throws IOException if navigating to the specified web page fails + * @since 42.0.0 */ - boolean navigate(URL url, Cookie[] cookies, boolean wait, int timeout) throws IOException; + @Unstable + default boolean navigate(URL url, Cookie[] cookies, boolean wait, int timeout) throws IOException + { + return navigate(url, JakartaServletBridge.toJavax(cookies), wait, timeout); + } + + /** + * Navigates to the specified web page, optionally waiting for it to be ready (fully loaded). + * + * @param url the URL of the web page we are going to navigate to + * @param cookies the cookies to use when loading the specified web page + * @param wait {@code true} to wait for the page to be ready, {@code false} otherwise + * @return {@code true} if the navigation was successful, {@code false} otherwise + * @throws IOException if navigating to the specified web page fails + */ + @Deprecated(since = "42.0.0") + default boolean navigate(URL url, javax.servlet.http.Cookie[] cookies, boolean wait) throws IOException + { + return navigate(url, cookies, wait, 60); + } /** * Navigates to the specified web page, optionally waiting for it to be ready (fully loaded). @@ -54,7 +91,9 @@ public interface BrowserTab extends AutoCloseable * @param wait {@code true} to wait for the page to be ready, {@code false} otherwise * @return {@code true} if the navigation was successful, {@code false} otherwise * @throws IOException if navigating to the specified web page fails + * @since 42.0.0 */ + @Unstable default boolean navigate(URL url, Cookie[] cookies, boolean wait) throws IOException { return navigate(url, cookies, wait, 60); @@ -70,7 +109,7 @@ default boolean navigate(URL url, Cookie[] cookies, boolean wait) throws IOExcep */ default boolean navigate(URL url, boolean wait) throws IOException { - return navigate(url, null, wait); + return navigate(url, (Cookie[]) null, wait); } /** diff --git a/xwiki-platform-core/xwiki-platform-export/xwiki-platform-export-pdf/xwiki-platform-export-pdf-api/src/main/java/org/xwiki/export/pdf/macro/PDFTocMacroParameters.java b/xwiki-platform-core/xwiki-platform-export/xwiki-platform-export-pdf/xwiki-platform-export-pdf-api/src/main/java/org/xwiki/export/pdf/macro/PDFTocMacroParameters.java index 574b09d4e120..66d1c94f4e7e 100644 --- a/xwiki-platform-core/xwiki-platform-export/xwiki-platform-export-pdf/xwiki-platform-export-pdf-api/src/main/java/org/xwiki/export/pdf/macro/PDFTocMacroParameters.java +++ b/xwiki-platform-core/xwiki-platform-export/xwiki-platform-export-pdf/xwiki-platform-export-pdf-api/src/main/java/org/xwiki/export/pdf/macro/PDFTocMacroParameters.java @@ -19,7 +19,7 @@ */ package org.xwiki.export.pdf.macro; -import javax.validation.constraints.Min; +import jakarta.validation.constraints.Min; import org.xwiki.export.pdf.internal.macro.PDFTocMacro; import org.xwiki.properties.annotation.PropertyDescription; diff --git a/xwiki-platform-core/xwiki-platform-export/xwiki-platform-export-pdf/xwiki-platform-export-pdf-api/src/test/java/org/xwiki/export/pdf/browser/BrowserPDFPrinterTest.java b/xwiki-platform-core/xwiki-platform-export/xwiki-platform-export-pdf/xwiki-platform-export-pdf-api/src/test/java/org/xwiki/export/pdf/browser/BrowserPDFPrinterTest.java index 342560b4aeb5..50db1700c181 100644 --- a/xwiki-platform-core/xwiki-platform-export/xwiki-platform-export-pdf/xwiki-platform-export-pdf-api/src/test/java/org/xwiki/export/pdf/browser/BrowserPDFPrinterTest.java +++ b/xwiki-platform-core/xwiki-platform-export/xwiki-platform-export-pdf/xwiki-platform-export-pdf-api/src/test/java/org/xwiki/export/pdf/browser/BrowserPDFPrinterTest.java @@ -232,7 +232,7 @@ void isAvailable() void navigate() throws Exception { URL url = new URL("http://xwiki.org"); - when(this.browserTab.navigate(url, null, false, 60)).thenReturn(true); + when(this.browserTab.navigate(url, (jakarta.servlet.http.Cookie[]) null, false, 60)).thenReturn(true); assertTrue(this.browserTab.navigate(url)); } } diff --git a/xwiki-platform-core/xwiki-platform-export/xwiki-platform-export-pdf/xwiki-platform-export-pdf-default/pom.xml b/xwiki-platform-core/xwiki-platform-export/xwiki-platform-export-pdf/xwiki-platform-export-pdf-default/pom.xml index fd82e8e04b58..543e654d9ead 100644 --- a/xwiki-platform-core/xwiki-platform-export/xwiki-platform-export-pdf/xwiki-platform-export-pdf-default/pom.xml +++ b/xwiki-platform-core/xwiki-platform-export/xwiki-platform-export-pdf/xwiki-platform-export-pdf-default/pom.xml @@ -65,8 +65,8 @@ ${project.version} - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api diff --git a/xwiki-platform-core/xwiki-platform-export/xwiki-platform-export-pdf/xwiki-platform-export-pdf-default/src/main/java/org/xwiki/export/pdf/internal/chrome/ChromeTab.java b/xwiki-platform-core/xwiki-platform-export/xwiki-platform-export-pdf/xwiki-platform-export-pdf-default/src/main/java/org/xwiki/export/pdf/internal/chrome/ChromeTab.java index 671fdcbfb94c..9c4c61501cce 100644 --- a/xwiki-platform-core/xwiki-platform-export/xwiki-platform-export-pdf/xwiki-platform-export-pdf-default/src/main/java/org/xwiki/export/pdf/internal/chrome/ChromeTab.java +++ b/xwiki-platform-core/xwiki-platform-export/xwiki-platform-export-pdf/xwiki-platform-export-pdf-default/src/main/java/org/xwiki/export/pdf/internal/chrome/ChromeTab.java @@ -29,13 +29,12 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import javax.servlet.http.Cookie; - import org.apache.commons.io.IOUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.xwiki.export.pdf.PDFExportConfiguration; import org.xwiki.export.pdf.browser.BrowserTab; +import org.xwiki.jakartabridge.servlet.JakartaServletBridge; import com.github.kklisura.cdt.protocol.commands.Network; import com.github.kklisura.cdt.protocol.commands.Page; @@ -50,6 +49,8 @@ import com.github.kklisura.cdt.protocol.types.target.TargetInfo; import com.github.kklisura.cdt.services.ChromeDevToolsService; +import jakarta.servlet.http.Cookie; + /** * Represents a Chrome web browser tab. * @@ -101,6 +102,12 @@ public void close() this.browserDevToolsService.getTarget().disposeBrowserContext(browserContextId); } + @Override + public boolean navigate(URL url, javax.servlet.http.Cookie[] cookies, boolean wait, int timeout) throws IOException + { + return navigate(url, JakartaServletBridge.toJakarta(cookies), wait, timeout); + } + @Override public boolean navigate(URL url, Cookie[] cookies, boolean wait, int timeout) throws IOException { diff --git a/xwiki-platform-core/xwiki-platform-export/xwiki-platform-export-pdf/xwiki-platform-export-pdf-default/src/test/java/org/xwiki/export/pdf/internal/chrome/ChromeTabTest.java b/xwiki-platform-core/xwiki-platform-export/xwiki-platform-export-pdf/xwiki-platform-export-pdf-default/src/test/java/org/xwiki/export/pdf/internal/chrome/ChromeTabTest.java index 17753f049b71..e80e81aeaefd 100644 --- a/xwiki-platform-core/xwiki-platform-export/xwiki-platform-export-pdf/xwiki-platform-export-pdf-default/src/test/java/org/xwiki/export/pdf/internal/chrome/ChromeTabTest.java +++ b/xwiki-platform-core/xwiki-platform-export/xwiki-platform-export-pdf/xwiki-platform-export-pdf-default/src/test/java/org/xwiki/export/pdf/internal/chrome/ChromeTabTest.java @@ -25,7 +25,7 @@ import java.nio.charset.StandardCharsets; import java.util.List; -import javax.servlet.http.Cookie; +import jakarta.servlet.http.Cookie; import org.apache.commons.io.IOUtils; import org.junit.jupiter.api.BeforeEach; @@ -168,7 +168,7 @@ void navigateWithError() throws Exception when(this.page.navigate(url.toString())).thenReturn(navigate); when(navigate.getErrorText()).thenReturn("Failed to navigate!"); - assertFalse(this.chromeTab.navigate(url, null, false)); + assertFalse(this.chromeTab.navigate(url, (Cookie[]) null, false)); } @Test @@ -192,7 +192,7 @@ void navigateWithWait() throws Exception when(evaluate.getResult()).thenReturn(result); when(result.getValue()).thenReturn("Page ready."); - assertTrue(this.chromeTab.navigate(url, null, true, 25)); + assertTrue(this.chromeTab.navigate(url, (Cookie[]) null, true, 25)); verify(this.runtime).enable(); } @@ -222,7 +222,7 @@ void navigateWithWaitAndException() throws Exception when(exception.getValue()).thenReturn("'xwiki-page-ready' module not found"); try { - this.chromeTab.navigate(url, null, true); + this.chromeTab.navigate(url, (Cookie[]) null, true); fail("Navigation should have thrown an exception."); } catch (IOException e) { assertEquals("Failed to wait for page to be ready. Root cause: 'xwiki-page-ready' module not found", diff --git a/xwiki-platform-core/xwiki-platform-extension/xwiki-platform-extension-distribution/pom.xml b/xwiki-platform-core/xwiki-platform-extension/xwiki-platform-extension-distribution/pom.xml index 532e758575da..6869856fa145 100644 --- a/xwiki-platform-core/xwiki-platform-extension/xwiki-platform-extension-distribution/pom.xml +++ b/xwiki-platform-core/xwiki-platform-extension/xwiki-platform-extension-distribution/pom.xml @@ -66,8 +66,8 @@ ${project.version} - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api diff --git a/xwiki-platform-core/xwiki-platform-extension/xwiki-platform-extension-handlers/xwiki-platform-extension-handler-xar/pom.xml b/xwiki-platform-core/xwiki-platform-extension/xwiki-platform-extension-handlers/xwiki-platform-extension-handler-xar/pom.xml index 14c9d2202217..a296d77e2628 100644 --- a/xwiki-platform-core/xwiki-platform-extension/xwiki-platform-extension-handlers/xwiki-platform-extension-handler-xar/pom.xml +++ b/xwiki-platform-core/xwiki-platform-extension/xwiki-platform-extension-handlers/xwiki-platform-extension-handler-xar/pom.xml @@ -132,11 +132,6 @@ ${commons.version} test - - javax.servlet - javax.servlet-api - test - org.xwiki.platform xwiki-platform-security-authorization-bridge diff --git a/xwiki-platform-core/xwiki-platform-extension/xwiki-platform-extension-index/pom.xml b/xwiki-platform-core/xwiki-platform-extension/xwiki-platform-extension-index/pom.xml index d2a5abb7a62e..f47bde9d2ae7 100644 --- a/xwiki-platform-core/xwiki-platform-extension/xwiki-platform-extension-index/pom.xml +++ b/xwiki-platform-core/xwiki-platform-extension/xwiki-platform-extension-index/pom.xml @@ -71,11 +71,6 @@ ${commons.version} test - - javax.servlet - javax.servlet-api - test - org.xwiki.platform xwiki-platform-search-solr-api diff --git a/xwiki-platform-core/xwiki-platform-extension/xwiki-platform-extension-script/pom.xml b/xwiki-platform-core/xwiki-platform-extension/xwiki-platform-extension-script/pom.xml index 886048301b47..e7d21a9756ab 100644 --- a/xwiki-platform-core/xwiki-platform-extension/xwiki-platform-extension-script/pom.xml +++ b/xwiki-platform-core/xwiki-platform-extension/xwiki-platform-extension-script/pom.xml @@ -78,11 +78,6 @@ pom test - - javax.servlet - javax.servlet-api - test - diff --git a/xwiki-platform-core/xwiki-platform-extension/xwiki-platform-extension-security/xwiki-platform-extension-security-api/pom.xml b/xwiki-platform-core/xwiki-platform-extension/xwiki-platform-extension-security/xwiki-platform-extension-security-api/pom.xml index d2c46a3d02c9..34f40bae0266 100644 --- a/xwiki-platform-core/xwiki-platform-extension/xwiki-platform-extension-security/xwiki-platform-extension-security-api/pom.xml +++ b/xwiki-platform-core/xwiki-platform-extension/xwiki-platform-extension-security/xwiki-platform-extension-security-api/pom.xml @@ -62,8 +62,8 @@ - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api test diff --git a/xwiki-platform-core/xwiki-platform-feed/xwiki-platform-feed-api/pom.xml b/xwiki-platform-core/xwiki-platform-feed/xwiki-platform-feed-api/pom.xml index e0c71f11c21c..1050cb8227fa 100644 --- a/xwiki-platform-core/xwiki-platform-feed/xwiki-platform-feed-api/pom.xml +++ b/xwiki-platform-core/xwiki-platform-feed/xwiki-platform-feed-api/pom.xml @@ -60,10 +60,7 @@ org.jdom jdom - - javax.servlet - javax.servlet-api - + org.xwiki.platform diff --git a/xwiki-platform-core/xwiki-platform-flamingo/xwiki-platform-flamingo-skin/xwiki-platform-flamingo-skin-test/xwiki-platform-flamingo-skin-test-docker/src/main/java/org/xwiki/test/TestMacroParameters.java b/xwiki-platform-core/xwiki-platform-flamingo/xwiki-platform-flamingo-skin/xwiki-platform-flamingo-skin-test/xwiki-platform-flamingo-skin-test-docker/src/main/java/org/xwiki/test/TestMacroParameters.java index 33fdd755f6c7..c20be5a78d81 100644 --- a/xwiki-platform-core/xwiki-platform-flamingo/xwiki-platform-flamingo-skin/xwiki-platform-flamingo-skin-test/xwiki-platform-flamingo-skin-test-docker/src/main/java/org/xwiki/test/TestMacroParameters.java +++ b/xwiki-platform-core/xwiki-platform-flamingo/xwiki-platform-flamingo-skin/xwiki-platform-flamingo-skin-test/xwiki-platform-flamingo-skin-test-docker/src/main/java/org/xwiki/test/TestMacroParameters.java @@ -19,7 +19,7 @@ */ package org.xwiki.test; -import javax.validation.constraints.AssertTrue; +import jakarta.validation.constraints.AssertTrue; /** * Java bean defining the parameters of {@link TestMacro}. diff --git a/xwiki-platform-core/xwiki-platform-icon/xwiki-platform-icon-default/pom.xml b/xwiki-platform-core/xwiki-platform-icon/xwiki-platform-icon-default/pom.xml index 0ee6e9d75450..972dc6eb8953 100644 --- a/xwiki-platform-core/xwiki-platform-icon/xwiki-platform-icon-default/pom.xml +++ b/xwiki-platform-core/xwiki-platform-icon/xwiki-platform-icon-default/pom.xml @@ -72,8 +72,8 @@ - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api test diff --git a/xwiki-platform-core/xwiki-platform-icon/xwiki-platform-icon-macro/pom.xml b/xwiki-platform-core/xwiki-platform-icon/xwiki-platform-icon-macro/pom.xml index 618f54c2e704..71b40721c798 100644 --- a/xwiki-platform-core/xwiki-platform-icon/xwiki-platform-icon-macro/pom.xml +++ b/xwiki-platform-core/xwiki-platform-icon/xwiki-platform-icon-macro/pom.xml @@ -87,13 +87,13 @@ test - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api test - org.mortbay.jasper - apache-el + org.glassfish.expressly + expressly test diff --git a/xwiki-platform-core/xwiki-platform-image/xwiki-platform-image-processing/xwiki-platform-image-processing-plugin/pom.xml b/xwiki-platform-core/xwiki-platform-image/xwiki-platform-image-processing/xwiki-platform-image-processing-plugin/pom.xml index 32194135931d..1141feb875eb 100644 --- a/xwiki-platform-core/xwiki-platform-image/xwiki-platform-image-processing/xwiki-platform-image-processing-plugin/pom.xml +++ b/xwiki-platform-core/xwiki-platform-image/xwiki-platform-image-processing/xwiki-platform-image-processing-plugin/pom.xml @@ -47,11 +47,6 @@ xwiki-platform-oldcore ${project.version} - - javax.servlet - javax.servlet-api - compile - diff --git a/xwiki-platform-core/xwiki-platform-image/xwiki-platform-image-style/xwiki-platform-image-style-api/pom.xml b/xwiki-platform-core/xwiki-platform-image/xwiki-platform-image-style/xwiki-platform-image-style-api/pom.xml index 312fb84e19a8..6b7ac607ae5f 100644 --- a/xwiki-platform-core/xwiki-platform-image/xwiki-platform-image-style/xwiki-platform-image-style-api/pom.xml +++ b/xwiki-platform-core/xwiki-platform-image/xwiki-platform-image-style/xwiki-platform-image-style-api/pom.xml @@ -56,8 +56,8 @@ test - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api test diff --git a/xwiki-platform-core/xwiki-platform-image/xwiki-platform-image-style/xwiki-platform-image-style-rest/pom.xml b/xwiki-platform-core/xwiki-platform-image/xwiki-platform-image-style/xwiki-platform-image-style-rest/pom.xml index 666286e8104f..ea659ca02118 100644 --- a/xwiki-platform-core/xwiki-platform-image/xwiki-platform-image-style/xwiki-platform-image-style-rest/pom.xml +++ b/xwiki-platform-core/xwiki-platform-image/xwiki-platform-image-style/xwiki-platform-image-style-rest/pom.xml @@ -75,8 +75,8 @@ test - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api test diff --git a/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-default/pom.xml b/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-default/pom.xml index a38eeb7d9ea6..1664d9d45f9c 100644 --- a/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-default/pom.xml +++ b/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-default/pom.xml @@ -60,8 +60,8 @@ test - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api test diff --git a/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-tree/xwiki-platform-index-tree-api/pom.xml b/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-tree/xwiki-platform-index-tree-api/pom.xml index d6d26a0b30bf..6e7d2d53410f 100644 --- a/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-tree/xwiki-platform-index-tree-api/pom.xml +++ b/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-tree/xwiki-platform-index-tree-api/pom.xml @@ -88,8 +88,8 @@ test - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api test diff --git a/xwiki-platform-core/xwiki-platform-job/xwiki-platform-job-handler/pom.xml b/xwiki-platform-core/xwiki-platform-job/xwiki-platform-job-handler/pom.xml index 3fa4b282ea78..8048618b520b 100644 --- a/xwiki-platform-core/xwiki-platform-job/xwiki-platform-job-handler/pom.xml +++ b/xwiki-platform-core/xwiki-platform-job/xwiki-platform-job-handler/pom.xml @@ -76,8 +76,8 @@ ${project.version} - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api diff --git a/xwiki-platform-core/xwiki-platform-legacy/xwiki-platform-legacy-events-hibernate/xwiki-platform-legacy-events-hibernate-api/pom.xml b/xwiki-platform-core/xwiki-platform-legacy/xwiki-platform-legacy-events-hibernate/xwiki-platform-legacy-events-hibernate-api/pom.xml index 02d0606f70c1..97c5be90ffa8 100644 --- a/xwiki-platform-core/xwiki-platform-legacy/xwiki-platform-legacy-events-hibernate/xwiki-platform-legacy-events-hibernate-api/pom.xml +++ b/xwiki-platform-core/xwiki-platform-legacy/xwiki-platform-legacy-events-hibernate/xwiki-platform-legacy-events-hibernate-api/pom.xml @@ -68,8 +68,8 @@ test - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api test diff --git a/xwiki-platform-core/xwiki-platform-legacy/xwiki-platform-legacy-mail/xwiki-platform-legacy-mail-send/xwiki-platform-legacy-mail-send-storage/pom.xml b/xwiki-platform-core/xwiki-platform-legacy/xwiki-platform-legacy-mail/xwiki-platform-legacy-mail-send/xwiki-platform-legacy-mail-send-storage/pom.xml index 6e0632eb78ce..f2ddfa529ea3 100644 --- a/xwiki-platform-core/xwiki-platform-legacy/xwiki-platform-legacy-mail/xwiki-platform-legacy-mail-send/xwiki-platform-legacy-mail-send-storage/pom.xml +++ b/xwiki-platform-core/xwiki-platform-legacy/xwiki-platform-legacy-mail/xwiki-platform-legacy-mail-send/xwiki-platform-legacy-mail-send-storage/pom.xml @@ -62,8 +62,8 @@ test - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api test diff --git a/xwiki-platform-core/xwiki-platform-legacy/xwiki-platform-legacy-messagestream/xwiki-platform-legacy-messagestream-api/pom.xml b/xwiki-platform-core/xwiki-platform-legacy/xwiki-platform-legacy-messagestream/xwiki-platform-legacy-messagestream-api/pom.xml index 4b9728141b7c..a333a2cea7f8 100644 --- a/xwiki-platform-core/xwiki-platform-legacy/xwiki-platform-legacy-messagestream/xwiki-platform-legacy-messagestream-api/pom.xml +++ b/xwiki-platform-core/xwiki-platform-legacy/xwiki-platform-legacy-messagestream/xwiki-platform-legacy-messagestream-api/pom.xml @@ -84,8 +84,8 @@ test - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api test diff --git a/xwiki-platform-core/xwiki-platform-legacy/xwiki-platform-legacy-rendering/xwiki-platform-legacy-rendering-wikimacro/xwiki-platform-legacy-rendering-wikimacro-store/pom.xml b/xwiki-platform-core/xwiki-platform-legacy/xwiki-platform-legacy-rendering/xwiki-platform-legacy-rendering-wikimacro/xwiki-platform-legacy-rendering-wikimacro-store/pom.xml index b07adbf8af8a..1777f12fd135 100644 --- a/xwiki-platform-core/xwiki-platform-legacy/xwiki-platform-legacy-rendering/xwiki-platform-legacy-rendering-wikimacro/xwiki-platform-legacy-rendering-wikimacro-store/pom.xml +++ b/xwiki-platform-core/xwiki-platform-legacy/xwiki-platform-legacy-rendering/xwiki-platform-legacy-rendering-wikimacro/xwiki-platform-legacy-rendering-wikimacro-store/pom.xml @@ -61,6 +61,7 @@ org.aspectj aspectjrt + org.xwiki.platform diff --git a/xwiki-platform-core/xwiki-platform-legacy/xwiki-platform-legacy-security/xwiki-platform-legacy-security-authentication/xwiki-platform-legacy-security-authentication-api/pom.xml b/xwiki-platform-core/xwiki-platform-legacy/xwiki-platform-legacy-security/xwiki-platform-legacy-security-authentication/xwiki-platform-legacy-security-authentication-api/pom.xml index 4e72fd21b808..c45dfeaaf8fc 100644 --- a/xwiki-platform-core/xwiki-platform-legacy/xwiki-platform-legacy-security/xwiki-platform-legacy-security-authentication/xwiki-platform-legacy-security-authentication-api/pom.xml +++ b/xwiki-platform-core/xwiki-platform-legacy/xwiki-platform-legacy-security/xwiki-platform-legacy-security-authentication/xwiki-platform-legacy-security-authentication-api/pom.xml @@ -60,8 +60,8 @@ aspectjrt - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api diff --git a/xwiki-platform-core/xwiki-platform-legacy/xwiki-platform-legacy-url/pom.xml b/xwiki-platform-core/xwiki-platform-legacy/xwiki-platform-legacy-url/pom.xml index 5b8b88c501f0..8e5152bc254d 100644 --- a/xwiki-platform-core/xwiki-platform-legacy/xwiki-platform-legacy-url/pom.xml +++ b/xwiki-platform-core/xwiki-platform-legacy/xwiki-platform-legacy-url/pom.xml @@ -48,8 +48,8 @@ - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api diff --git a/xwiki-platform-core/xwiki-platform-lesscss/xwiki-platform-lesscss-default/pom.xml b/xwiki-platform-core/xwiki-platform-lesscss/xwiki-platform-lesscss-default/pom.xml index caab88252070..bcda6a24e8bb 100644 --- a/xwiki-platform-core/xwiki-platform-lesscss/xwiki-platform-lesscss-default/pom.xml +++ b/xwiki-platform-core/xwiki-platform-lesscss/xwiki-platform-lesscss-default/pom.xml @@ -63,8 +63,8 @@ ${project.version} - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api com.github.sommeri diff --git a/xwiki-platform-core/xwiki-platform-lesscss/xwiki-platform-lesscss-script/pom.xml b/xwiki-platform-core/xwiki-platform-lesscss/xwiki-platform-lesscss-script/pom.xml index d55cbc241683..9f9f19b1d623 100644 --- a/xwiki-platform-core/xwiki-platform-lesscss/xwiki-platform-lesscss-script/pom.xml +++ b/xwiki-platform-core/xwiki-platform-lesscss/xwiki-platform-lesscss-script/pom.xml @@ -68,8 +68,8 @@ - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api test diff --git a/xwiki-platform-core/xwiki-platform-like/xwiki-platform-like-api/pom.xml b/xwiki-platform-core/xwiki-platform-like/xwiki-platform-like-api/pom.xml index 8e5c75dfcbad..0cd9a9f5dc61 100644 --- a/xwiki-platform-core/xwiki-platform-like/xwiki-platform-like-api/pom.xml +++ b/xwiki-platform-core/xwiki-platform-like/xwiki-platform-like-api/pom.xml @@ -91,8 +91,8 @@ - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api test diff --git a/xwiki-platform-core/xwiki-platform-linkchecker/xwiki-platform-linkchecker-api/pom.xml b/xwiki-platform-core/xwiki-platform-linkchecker/xwiki-platform-linkchecker-api/pom.xml index a39b060a9829..7dcde2f0ad48 100644 --- a/xwiki-platform-core/xwiki-platform-linkchecker/xwiki-platform-linkchecker-api/pom.xml +++ b/xwiki-platform-core/xwiki-platform-linkchecker/xwiki-platform-linkchecker-api/pom.xml @@ -61,8 +61,8 @@ - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api test diff --git a/xwiki-platform-core/xwiki-platform-livedata/xwiki-platform-livedata-livetable/pom.xml b/xwiki-platform-core/xwiki-platform-livedata/xwiki-platform-livedata-livetable/pom.xml index ac44950b8256..a0c64ffcd0e8 100644 --- a/xwiki-platform-core/xwiki-platform-livedata/xwiki-platform-livedata-livetable/pom.xml +++ b/xwiki-platform-core/xwiki-platform-livedata/xwiki-platform-livedata-livetable/pom.xml @@ -53,8 +53,8 @@ ${project.version} - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api diff --git a/xwiki-platform-core/xwiki-platform-livedata/xwiki-platform-livedata-rest/pom.xml b/xwiki-platform-core/xwiki-platform-livedata/xwiki-platform-livedata-rest/pom.xml index 09c9eba97149..b79ed73c383d 100644 --- a/xwiki-platform-core/xwiki-platform-livedata/xwiki-platform-livedata-rest/pom.xml +++ b/xwiki-platform-core/xwiki-platform-livedata/xwiki-platform-livedata-rest/pom.xml @@ -81,8 +81,8 @@ test - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api test diff --git a/xwiki-platform-core/xwiki-platform-livetable/xwiki-platform-livetable-ui/pom.xml b/xwiki-platform-core/xwiki-platform-livetable/xwiki-platform-livetable-ui/pom.xml index c7c89abc7589..d791d98193f0 100644 --- a/xwiki-platform-core/xwiki-platform-livetable/xwiki-platform-livetable-ui/pom.xml +++ b/xwiki-platform-core/xwiki-platform-livetable/xwiki-platform-livetable-ui/pom.xml @@ -75,11 +75,6 @@ runtime - - javax.servlet - javax.servlet-api - test - org.xwiki.platform xwiki-platform-test-page diff --git a/xwiki-platform-core/xwiki-platform-localization/xwiki-platform-localization-sources/xwiki-platform-localization-source-legacy/pom.xml b/xwiki-platform-core/xwiki-platform-localization/xwiki-platform-localization-sources/xwiki-platform-localization-source-legacy/pom.xml index e99ebdcb1635..dda256ccc958 100644 --- a/xwiki-platform-core/xwiki-platform-localization/xwiki-platform-localization-sources/xwiki-platform-localization-source-legacy/pom.xml +++ b/xwiki-platform-core/xwiki-platform-localization/xwiki-platform-localization-sources/xwiki-platform-localization-source-legacy/pom.xml @@ -64,7 +64,6 @@ - org.xwiki.platform xwiki-platform-test-oldcore @@ -72,13 +71,6 @@ pom test - - - - org.jmock - jmock-legacy - test - diff --git a/xwiki-platform-core/xwiki-platform-localization/xwiki-platform-localization-sources/xwiki-platform-localization-source-wiki/pom.xml b/xwiki-platform-core/xwiki-platform-localization/xwiki-platform-localization-sources/xwiki-platform-localization-source-wiki/pom.xml index e29955e41fca..de0136fb9611 100644 --- a/xwiki-platform-core/xwiki-platform-localization/xwiki-platform-localization-sources/xwiki-platform-localization-source-wiki/pom.xml +++ b/xwiki-platform-core/xwiki-platform-localization/xwiki-platform-localization-sources/xwiki-platform-localization-source-wiki/pom.xml @@ -68,7 +68,6 @@ - org.xwiki.platform xwiki-platform-test-oldcore @@ -76,13 +75,6 @@ pom test - - - - org.jmock - jmock-legacy - test - diff --git a/xwiki-platform-core/xwiki-platform-mail/xwiki-platform-mail-general/pom.xml b/xwiki-platform-core/xwiki-platform-mail/xwiki-platform-mail-general/pom.xml index 10963b47c6d4..b98ab620109d 100644 --- a/xwiki-platform-core/xwiki-platform-mail/xwiki-platform-mail-general/pom.xml +++ b/xwiki-platform-core/xwiki-platform-mail/xwiki-platform-mail-general/pom.xml @@ -67,13 +67,6 @@ ${commons.version} test - - - javax.servlet - javax.servlet-api - test - - org.xwiki.platform xwiki-platform-oldcore diff --git a/xwiki-platform-core/xwiki-platform-mail/xwiki-platform-mail-send/xwiki-platform-mail-send-default/pom.xml b/xwiki-platform-core/xwiki-platform-mail/xwiki-platform-mail-send/xwiki-platform-mail-send-default/pom.xml index de242c13ddd8..84fc7fbf635a 100644 --- a/xwiki-platform-core/xwiki-platform-mail/xwiki-platform-mail-send/xwiki-platform-mail-send-default/pom.xml +++ b/xwiki-platform-core/xwiki-platform-mail/xwiki-platform-mail-send/xwiki-platform-mail-send-default/pom.xml @@ -73,8 +73,8 @@ - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api org.xwiki.platform diff --git a/xwiki-platform-core/xwiki-platform-mail/xwiki-platform-mail-send/xwiki-platform-mail-send-storage/pom.xml b/xwiki-platform-core/xwiki-platform-mail/xwiki-platform-mail-send/xwiki-platform-mail-send-storage/pom.xml index 0f5c129828ac..4f2964f9191e 100644 --- a/xwiki-platform-core/xwiki-platform-mail/xwiki-platform-mail-send/xwiki-platform-mail-send-storage/pom.xml +++ b/xwiki-platform-core/xwiki-platform-mail/xwiki-platform-mail-send/xwiki-platform-mail-send-storage/pom.xml @@ -70,8 +70,8 @@ test - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api test diff --git a/xwiki-platform-core/xwiki-platform-mailsender/pom.xml b/xwiki-platform-core/xwiki-platform-mailsender/pom.xml index 758b3954391c..65211e27749c 100644 --- a/xwiki-platform-core/xwiki-platform-mailsender/pom.xml +++ b/xwiki-platform-core/xwiki-platform-mailsender/pom.xml @@ -44,6 +44,8 @@ xwiki-platform-oldcore ${project.version} + + com.icegreen greenmail-junit5 diff --git a/xwiki-platform-core/xwiki-platform-mentions/pom.xml b/xwiki-platform-core/xwiki-platform-mentions/pom.xml index 962d8901d68b..0442fb62464f 100644 --- a/xwiki-platform-core/xwiki-platform-mentions/pom.xml +++ b/xwiki-platform-core/xwiki-platform-mentions/pom.xml @@ -39,8 +39,8 @@ test - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api test diff --git a/xwiki-platform-core/xwiki-platform-model/xwiki-platform-model-validation/xwiki-platform-model-validation-default/pom.xml b/xwiki-platform-core/xwiki-platform-model/xwiki-platform-model-validation/xwiki-platform-model-validation-default/pom.xml index 7cd054436a29..5013a4a9ff7f 100644 --- a/xwiki-platform-core/xwiki-platform-model/xwiki-platform-model-validation/xwiki-platform-model-validation-default/pom.xml +++ b/xwiki-platform-core/xwiki-platform-model/xwiki-platform-model-validation/xwiki-platform-model-validation-default/pom.xml @@ -48,8 +48,8 @@ ${project.version} - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api diff --git a/xwiki-platform-core/xwiki-platform-model/xwiki-platform-model-validation/xwiki-platform-model-validation-default/src/main/resources/ApplicationResources_de.properties b/xwiki-platform-core/xwiki-platform-model/xwiki-platform-model-validation/xwiki-platform-model-validation-default/src/main/resources/ApplicationResources_de.properties deleted file mode 100644 index 0633301106ab..000000000000 --- a/xwiki-platform-core/xwiki-platform-model/xwiki-platform-model-validation/xwiki-platform-model-validation-default/src/main/resources/ApplicationResources_de.properties +++ /dev/null @@ -1,24 +0,0 @@ -# --------------------------------------------------------------------------- -# See the NOTICE file distributed with this work for additional -# information regarding copyright ownership. -# -# This is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as -# published by the Free Software Foundation; either version 2.1 of -# the License, or (at your option) any later version. -# -# This software is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this software; if not, write to the Free -# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -# 02110-1301 USA, or see the FSF site: http://www.fsf.org. -# --------------------------------------------------------------------------- -entitynamevalidation.ReplaceCharacterEntityNameValidation.name=Zeichenersetzung -entitynamevalidation.ReplaceCharacterEntityNameValidation.usage=Einige Zeichen sind bei dieser Strategie verboten und sollten ersetzt oder entfernt werden. Erkundige Dich bei deinem Administrator nach der genauen Liste der verbotenen Zeichen und nach dem zu verwendenden Ersatz. -## Missing: entitynamevalidation.ReplaceCharacterEntityNameValidation.usage=Some characters are forbidden with this strategy and should be replaced or removed. Ask your administrator to know exactly the list of forbidden characters, and the replacement to use. -entitynamevalidation.SlugEntityNameValidation.name=Vorformatierte Namen (keine Akzente, kein Leerzeichen, keine Sonderzeichen) -entitynamevalidation.SlugEntityNameValidation.usage=Alle Sonderzeichen, einschlie\u00DFlich Leerzeichen und Akzente, sind verboten. diff --git a/xwiki-platform-core/xwiki-platform-netflux/xwiki-platform-netflux-api/pom.xml b/xwiki-platform-core/xwiki-platform-netflux/xwiki-platform-netflux-api/pom.xml index ec23fcde3e5c..5eb3fe4e77bc 100644 --- a/xwiki-platform-core/xwiki-platform-netflux/xwiki-platform-netflux-api/pom.xml +++ b/xwiki-platform-core/xwiki-platform-netflux/xwiki-platform-netflux-api/pom.xml @@ -63,9 +63,10 @@ ${project.version} - javax.websocket - javax.websocket-api + jakarta.websocket + jakarta.websocket-client-api + org.xwiki.commons @@ -73,5 +74,15 @@ ${commons.version} test + + jakarta.servlet + jakarta.servlet-api + test + + + jakarta.websocket + jakarta.websocket-api + test + diff --git a/xwiki-platform-core/xwiki-platform-netflux/xwiki-platform-netflux-api/src/test/java/org/xwiki/netflux/internal/DefaultEntityChannelStoreTest.java b/xwiki-platform-core/xwiki-platform-netflux/xwiki-platform-netflux-api/src/test/java/org/xwiki/netflux/internal/DefaultEntityChannelStoreTest.java index 35dce1a5d652..c04a12100952 100644 --- a/xwiki-platform-core/xwiki-platform-netflux/xwiki-platform-netflux-api/src/test/java/org/xwiki/netflux/internal/DefaultEntityChannelStoreTest.java +++ b/xwiki-platform-core/xwiki-platform-netflux/xwiki-platform-netflux-api/src/test/java/org/xwiki/netflux/internal/DefaultEntityChannelStoreTest.java @@ -26,7 +26,7 @@ import java.util.List; -import javax.websocket.Session; +import jakarta.websocket.Session; import org.junit.jupiter.api.Test; import org.mockito.Mock; diff --git a/xwiki-platform-core/xwiki-platform-netflux/xwiki-platform-netflux-api/src/test/java/org/xwiki/netflux/internal/EntityChannelScriptAuthorBotTest.java b/xwiki-platform-core/xwiki-platform-netflux/xwiki-platform-netflux-api/src/test/java/org/xwiki/netflux/internal/EntityChannelScriptAuthorBotTest.java index 0a27fdb81c8a..bdce80c4e834 100644 --- a/xwiki-platform-core/xwiki-platform-netflux/xwiki-platform-netflux-api/src/test/java/org/xwiki/netflux/internal/EntityChannelScriptAuthorBotTest.java +++ b/xwiki-platform-core/xwiki-platform-netflux/xwiki-platform-netflux-api/src/test/java/org/xwiki/netflux/internal/EntityChannelScriptAuthorBotTest.java @@ -31,7 +31,7 @@ import java.util.List; import java.util.Optional; -import javax.websocket.Session; +import jakarta.websocket.Session; import org.junit.jupiter.api.Test; import org.xwiki.model.reference.DocumentReference; diff --git a/xwiki-platform-core/xwiki-platform-netflux/xwiki-platform-netflux-rest/pom.xml b/xwiki-platform-core/xwiki-platform-netflux/xwiki-platform-netflux-rest/pom.xml index 08aedd7ee800..b50856254737 100644 --- a/xwiki-platform-core/xwiki-platform-netflux/xwiki-platform-netflux-rest/pom.xml +++ b/xwiki-platform-core/xwiki-platform-netflux/xwiki-platform-netflux-rest/pom.xml @@ -59,6 +59,7 @@ jakarta.ws.rs jakarta.ws.rs-api + org.xwiki.commons @@ -72,8 +73,8 @@ test - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api test diff --git a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-api/pom.xml b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-api/pom.xml index c5715d640f7b..bd8ecf3056c3 100644 --- a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-api/pom.xml +++ b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-api/pom.xml @@ -72,8 +72,8 @@ test - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api test diff --git a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-default/pom.xml b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-default/pom.xml index 2eeb4f387aa6..277d87fd4169 100644 --- a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-default/pom.xml +++ b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-default/pom.xml @@ -58,11 +58,6 @@ ${commons.version} test - - javax.servlet - javax.servlet-api - test - org.xwiki.platform xwiki-platform-oldcore diff --git a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-watch/pom.xml b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-watch/pom.xml index 2177f96a5d93..7260e7b7da39 100644 --- a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-watch/pom.xml +++ b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-watch/pom.xml @@ -52,8 +52,8 @@ test - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api test diff --git a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-notifiers/xwiki-platform-notifications-notifiers-api/pom.xml b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-notifiers/xwiki-platform-notifications-notifiers-api/pom.xml index ba44da6c457a..7234503fa70e 100644 --- a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-notifiers/xwiki-platform-notifications-notifiers-api/pom.xml +++ b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-notifiers/xwiki-platform-notifications-notifiers-api/pom.xml @@ -81,11 +81,6 @@ ${rendering.version} test - - javax.servlet - javax.servlet-api - test - org.xwiki.platform xwiki-platform-test-oldcore diff --git a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-notifiers/xwiki-platform-notifications-notifiers-default/pom.xml b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-notifiers/xwiki-platform-notifications-notifiers-default/pom.xml index 9099676296b2..06de7cbd02e3 100644 --- a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-notifiers/xwiki-platform-notifications-notifiers-default/pom.xml +++ b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-notifiers/xwiki-platform-notifications-notifiers-default/pom.xml @@ -75,8 +75,8 @@ test - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api test diff --git a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-preferences/xwiki-platform-notifications-preferences-api/pom.xml b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-preferences/xwiki-platform-notifications-preferences-api/pom.xml index f202ad3ade51..4730e424be20 100644 --- a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-preferences/xwiki-platform-notifications-preferences-api/pom.xml +++ b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-preferences/xwiki-platform-notifications-preferences-api/pom.xml @@ -60,8 +60,8 @@ test - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api test diff --git a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-preferences/xwiki-platform-notifications-preferences-default/pom.xml b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-preferences/xwiki-platform-notifications-preferences-default/pom.xml index d94773cfe2ea..f070450af9e9 100644 --- a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-preferences/xwiki-platform-notifications-preferences-default/pom.xml +++ b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-preferences/xwiki-platform-notifications-preferences-default/pom.xml @@ -57,8 +57,8 @@ test - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api test diff --git a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-rest/pom.xml b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-rest/pom.xml index 6ae731c8545f..0691db0b9f8c 100644 --- a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-rest/pom.xml +++ b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-rest/pom.xml @@ -76,9 +76,8 @@ rome - javax.servlet - javax.servlet-api - compile + jakarta.servlet + jakarta.servlet-api org.xwiki.commons diff --git a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-sources/pom.xml b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-sources/pom.xml index 7cae4911ba0f..af45ce708464 100644 --- a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-sources/pom.xml +++ b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-sources/pom.xml @@ -75,8 +75,8 @@ test - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api test diff --git a/xwiki-platform-core/xwiki-platform-observation/xwiki-platform-observation-test/xwiki-platform-observation-test-tests/pom.xml b/xwiki-platform-core/xwiki-platform-observation/xwiki-platform-observation-test/xwiki-platform-observation-test-tests/pom.xml index bba846030e44..47f3a0e5f4a4 100644 --- a/xwiki-platform-core/xwiki-platform-observation/xwiki-platform-observation-test/xwiki-platform-observation-test-tests/pom.xml +++ b/xwiki-platform-core/xwiki-platform-observation/xwiki-platform-observation-test/xwiki-platform-observation-test-tests/pom.xml @@ -105,8 +105,8 @@ test - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api test diff --git a/xwiki-platform-core/xwiki-platform-oldcore/pom.xml b/xwiki-platform-core/xwiki-platform-oldcore/pom.xml index bc81507c79ec..44a947909909 100644 --- a/xwiki-platform-core/xwiki-platform-oldcore/pom.xml +++ b/xwiki-platform-core/xwiki-platform-oldcore/pom.xml @@ -130,6 +130,10 @@ javax.servlet javax.servlet-api + + jakarta.servlet + jakarta.servlet-api + - - org.mortbay.jasper - apache-el - test - org.xwiki.platform xwiki-platform-index-api @@ -901,7 +903,7 @@ **/web/ViewrevAction.java, **/web/XWikiAction.java, **/web/XWikiConfigurationService.java, - **/web/XWikiContextInitializationFilter.java, + **/web/XWikiContextInitializer.java, **/web/XWikiDefaultURLFactory.java, **/web/XWikiEngineContext.java, **/web/XWikiForm.java, diff --git a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/XWiki.java b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/XWiki.java index ffd62af567ce..ec7c0943a8bb 100644 --- a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/XWiki.java +++ b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/XWiki.java @@ -1129,6 +1129,7 @@ private static EntityResourceReference initializeResourceFromURL(XWikiContext co return entityResourceReference; } + @Deprecated(since = "42.0.0") public static URL getRequestURL(XWikiRequest request) throws XWikiException { return HttpServletUtils.getSourceURL(request); @@ -3227,6 +3228,7 @@ public String getLanguagePreference(XWikiContext context) * @return A list of language codes, in the client preference order; might be empty if the header is not well * formed. */ + @Deprecated(since = "42.0.0") private List getAcceptedLanguages(XWikiRequest request) { List result = new ArrayList(); @@ -5716,6 +5718,7 @@ public int checkActive(String user, XWikiContext context) throws XWikiException /** * @since 2.3M1 */ + @Deprecated(since = "42.0.0") public DocumentReference getDocumentReference(XWikiRequest request, XWikiContext context) { DocumentReference reference; @@ -5782,6 +5785,7 @@ public static String stripSegmentFromPath(String path, String segment) return path.substring(segment.length()); } + @Deprecated(since = "42.0.0") public boolean prepareDocuments(XWikiRequest request, XWikiContext context, VelocityContext vcontext) throws XWikiException { diff --git a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/XWikiContext.java b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/XWikiContext.java index 69e37bc70cad..491a54f08fa3 100644 --- a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/XWikiContext.java +++ b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/XWikiContext.java @@ -269,11 +269,13 @@ public void setEngineContext(XWikiEngineContext engine_context) this.engine_context = engine_context; } + @Deprecated(since = "42.0.0") public XWikiRequest getRequest() { return this.request; } + @Deprecated(since = "42.0.0") public void setRequest(XWikiRequest request) { this.request = request; @@ -289,11 +291,13 @@ public void setAction(String action) this.action = action; } + @Deprecated(since = "42.0.0") public XWikiResponse getResponse() { return this.response; } + @Deprecated(since = "42.0.0") public void setResponse(XWikiResponse response) { this.response = response; diff --git a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/api/Context.java b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/api/Context.java index 674723936f93..98794122572b 100644 --- a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/api/Context.java +++ b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/api/Context.java @@ -64,7 +64,8 @@ public Context(XWikiContext context) */ public XWikiRequest getRequest() { - return new ScriptXWikiServletRequest(getXWikiContext().getRequest(), getContextualAuthorizationManager()); + XWikiRequest request = getXWikiContext().getRequest(); + return request != null ? new ScriptXWikiServletRequest(request, getContextualAuthorizationManager()) : request; } /** diff --git a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/internal/DefaultXWikiContextInitializer.java b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/internal/DefaultXWikiContextInitializer.java index db9b82b11646..4dd75c94273b 100644 --- a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/internal/DefaultXWikiContextInitializer.java +++ b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/internal/DefaultXWikiContextInitializer.java @@ -19,11 +19,6 @@ */ package com.xpn.xwiki.internal; -import javax.inject.Inject; -import javax.inject.Named; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - import org.slf4j.Logger; import org.xwiki.component.annotation.Component; import org.xwiki.component.annotation.InstantiationStrategy; @@ -33,6 +28,7 @@ import org.xwiki.container.servlet.ServletRequest; import org.xwiki.container.servlet.ServletResponse; import org.xwiki.context.ExecutionContext; +import org.xwiki.jakartabridge.servlet.JakartaServletBridge; import org.xwiki.model.reference.DocumentReference; import org.xwiki.model.reference.DocumentReferenceResolver; import org.xwiki.model.reference.SpaceReference; @@ -50,6 +46,11 @@ import com.xpn.xwiki.web.XWikiServletRequest; import com.xpn.xwiki.web.XWikiServletResponse; +import jakarta.inject.Inject; +import jakarta.inject.Named; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; + /** * Default implementation of {@link XWikiContextInitializer}. * @@ -103,18 +104,11 @@ public XWikiContext initialize(ExecutionContext econtext) throws XWikiException XWikiContext xcontext; - if (!(request instanceof ServletRequest)) { - if (this.fallbackOnStub) { - xcontext = this.contextProvider.createStubContext(); - } else { - throw new XWikiException(XWikiException.MODULE_XWIKI_USER, XWikiException.ERROR_XWIKI_USER_INIT, - "Unsupported request type [" + request.getClass() + "]"); - } - } else { + if (request instanceof ServletRequest servletRequest) { try { - HttpServletRequest httpServletRequest = ((ServletRequest) request).getHttpServletRequest(); + HttpServletRequest httpServletRequest = servletRequest.getJakartaHttpServletRequest(); HttpServletResponse httpServletReponse = - ((ServletResponse) this.container.getResponse()).getHttpServletResponse(); + ((ServletResponse) this.container.getResponse()).getJakartaHttpServletResponse(); xcontext = initializeXWikiContext(httpServletRequest, httpServletReponse); @@ -134,6 +128,13 @@ public XWikiContext initialize(ExecutionContext econtext) throws XWikiException "Failed to initialize XWikiContext", e); } } + } else { + if (this.fallbackOnStub) { + xcontext = this.contextProvider.createStubContext(); + } else { + throw new XWikiException(XWikiException.MODULE_XWIKI_USER, XWikiException.ERROR_XWIKI_USER_INIT, + "Unsupported request type [" + request.getClass() + "]"); + } } // Put the XWikiContext in the ExecutionContext @@ -147,9 +148,10 @@ public XWikiContext initialize(ExecutionContext econtext) throws XWikiException private static XWikiContext initializeXWikiContext(HttpServletRequest request, HttpServletResponse response) throws XWikiException { - XWikiServletContext xwikiEngine = new XWikiServletContext(request.getServletContext()); - XWikiServletRequest xwikiRequest = new XWikiServletRequest(request); - XWikiServletResponse xwikiResponse = new XWikiServletResponse(response); + XWikiServletContext xwikiEngine = + new XWikiServletContext(JakartaServletBridge.toJavax(request.getServletContext())); + XWikiServletRequest xwikiRequest = new XWikiServletRequest(JakartaServletBridge.toJavax(request)); + XWikiServletResponse xwikiResponse = new XWikiServletResponse(JakartaServletBridge.toJavax(response)); // Create the XWiki context. XWikiContext context = Utils.prepareContext("", xwikiRequest, xwikiResponse, xwikiEngine); diff --git a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/internal/web/LegacyAction.java b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/internal/web/LegacyAction.java index 15a09520e8f1..097bf0dcfbc7 100644 --- a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/internal/web/LegacyAction.java +++ b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/internal/web/LegacyAction.java @@ -19,13 +19,14 @@ */ package com.xpn.xwiki.internal.web; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - import org.xwiki.component.annotation.Role; +import org.xwiki.jakartabridge.servlet.JakartaServletBridge; import com.xpn.xwiki.web.XWikiAction; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; + /** * A component role for the old {@link XWikiAction} based entry points. * @@ -41,6 +42,23 @@ public interface LegacyAction * @param servletRequest the request passed to the servlet * @param servletResponse the response passed to the servlet * @throws Exception when the action produces an unexptected error + * @deprecated use {@link #execute(HttpServletRequest, HttpServletResponse)} instead + */ + @Deprecated(since = "42.0.0") + default void execute(javax.servlet.http.HttpServletRequest servletRequest, + javax.servlet.http.HttpServletResponse servletResponse) throws Exception + { + execute(JakartaServletBridge.toJakarta(servletRequest), JakartaServletBridge.toJakarta(servletResponse)); + } + + /** + * @param servletRequest the request passed to the servlet + * @param servletResponse the response passed to the servlet + * @throws Exception when the action produces an unexptected error + * @since 42.0.0 */ - void execute(HttpServletRequest servletRequest, HttpServletResponse servletResponse) throws Exception; + default void execute(HttpServletRequest servletRequest, HttpServletResponse servletResponse) throws Exception + { + execute(JakartaServletBridge.toJavax(servletRequest), JakartaServletBridge.toJavax(servletResponse)); + } } diff --git a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/render/ScriptHttpSession.java b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/render/ScriptHttpSession.java index 06547a79c272..21ee9230f85a 100644 --- a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/render/ScriptHttpSession.java +++ b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/render/ScriptHttpSession.java @@ -37,7 +37,10 @@ * @version $Id$ * @since 12.4RC1 * @since 11.10.5 + * @deprecated use the container script service instead */ +//TODO: uncomment the annotation when XWiki Standard scripts are fully migrated to the new API +//@Deprecated(since = "42.0.0") public class ScriptHttpSession implements HttpSession, HttpSessionContext { private static final String KEY_SAFESESSION = ScriptHttpSession.class.getName(); diff --git a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/render/ScriptXWikiServletRequest.java b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/render/ScriptXWikiServletRequest.java index 81e486d2330a..afffced80730 100644 --- a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/render/ScriptXWikiServletRequest.java +++ b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/render/ScriptXWikiServletRequest.java @@ -39,7 +39,10 @@ * @since 12.3RC1 * @since 12.2.1 * @since 11.10.5 + * @deprecated use the container script service instead */ +//TODO: uncomment the annotation when XWiki Standard scripts are fully migrated to the new API +//@Deprecated(since = "42.0.0") public class ScriptXWikiServletRequest extends WrappingXWikiRequest { /** diff --git a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/util/Util.java b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/util/Util.java index 66163c1b3774..ee0c4839b465 100644 --- a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/util/Util.java +++ b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/util/Util.java @@ -193,6 +193,7 @@ public static PatternCache getPatterns() return patterns; } + @Deprecated(since = "42.0.0") public static Map getObject(XWikiRequest request, String prefix) { @SuppressWarnings("unchecked") diff --git a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/ActionFilter.java b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/ActionFilter.java index 38b0fe51d9a8..3d5afcc9cc69 100644 --- a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/ActionFilter.java +++ b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/ActionFilter.java @@ -24,14 +24,14 @@ import java.util.Objects; import java.util.stream.Stream; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.RequestDispatcher; -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.RequestDispatcher; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServletRequest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -46,8 +46,8 @@ * XHTML form has only one target URL. In previous versions of XWiki this was accomplished using javascript code, with a * fall-back on a pseudo-dispatcher inside the {@link PreviewAction}, which was on obvious case of bad code design. *

- * The filter dispatches requests based on the presence of a request parameter starting with {@code action_} followed - * by the name of the action that should actually process the request. For example, the button that does + * The filter dispatches requests based on the presence of a request parameter starting with {@code action_} followed by + * the name of the action that should actually process the request. For example, the button that does * {@code Save and Continue} looks like: * *

@@ -56,9 +56,13 @@
  *
  * As a result, when clicking the button, the request is not sent to the form's target ({@code preview}), but is
  * actually forwarded internally to {@code /bin/saveandcontinue/The/Document}.
+ * 

+ * While the class is much older, the since annotation was moved to 42.0.0 because it implement a completely + * different API from Java point of view. * * @version $Id$ * @since 1.8M1 + * @since 42.0.0 */ public class ActionFilter implements Filter { @@ -83,31 +87,28 @@ public void init(FilterConfig filterConfig) throws ServletException { } - @SuppressWarnings("unchecked") @Override - public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, - ServletException + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) + throws IOException, ServletException { // Only HTTP requests can be dispatched. - if (request instanceof HttpServletRequest - && !Boolean.parseBoolean((String) request.getAttribute(ATTRIBUTE_ACTION_DISPATCHED))) - { - HttpServletRequest hrequest = (HttpServletRequest) request; + if (request instanceof HttpServletRequest hrequest + && !Boolean.parseBoolean((String) request.getAttribute(ATTRIBUTE_ACTION_DISPATCHED))) { Enumeration parameterNames = hrequest.getParameterNames(); while (parameterNames.hasMoreElements()) { String parameter = parameterNames.nextElement(); - + // If some xactions are passed as parameter, the parameters prefixed with 'action_' are only taken into // account if they are part of the xaction list. Otherwise, all the parameters prefixed with 'action_' // are accepted. String[] xactions = request.getParameterValues("xaction"); - if (parameter.startsWith(ACTION_PREFIX) && (xactions == null || Stream.of(xactions) - .anyMatch(it -> Objects.equals(parameter, String.format("action_%s", it))))) - { + if (parameter.startsWith(ACTION_PREFIX) && (xactions == null + || Stream.of(xactions).anyMatch(it -> Objects.equals(parameter, String.format("action_%s", it))))) { String targetURL = getTargetURL(hrequest, parameter); RequestDispatcher dispatcher = hrequest.getRequestDispatcher(targetURL); if (dispatcher != null) { - LOGGER.debug("Forwarding request to " + targetURL); + LOGGER.debug("Forwarding request to [{}]", targetURL); + request.setAttribute(ATTRIBUTE_ACTION_DISPATCHED, "true"); dispatcher.forward(hrequest, response); // Allow multiple calls to this filter as long as they are not nested. @@ -136,8 +137,8 @@ public void destroy() * * @param request the original request * @param action the action parameter, starting with {@code action_} - * @return The rebuilt URL path, with the specified action in place of the original action. Note that unlike - * the HTTP path, this does not contain the application context part. + * @return The rebuilt URL path, with the specified action in place of the original action. Note that unlike the + * HTTP path, this does not contain the application context part. */ private String getTargetURL(HttpServletRequest request, String action) { @@ -163,9 +164,8 @@ private String getTargetURL(HttpServletRequest request, String action) ConfigurationSource configuration = Utils.getComponent(ConfigurationSource.class, XWikiCfgConfigurationSource.ROLEHINT); if ("1".equals(configuration.getProperty("xwiki.virtual.usepath", "1"))) { - if (servletPath.equals(PATH_SEPARATOR - + configuration.getProperty("xwiki.virtual.usepath.servletpath", "wiki"))) - { + if (servletPath + .equals(PATH_SEPARATOR + configuration.getProperty("xwiki.virtual.usepath.servletpath", "wiki"))) { // Move the wiki name together with the servlet path servletPath += path.substring(0, index); index = path.indexOf(PATH_SEPARATOR, index + 1); diff --git a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/CommentAddAction.java b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/CommentAddAction.java index 8484241350f6..7b568c19ac37 100644 --- a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/CommentAddAction.java +++ b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/CommentAddAction.java @@ -190,6 +190,7 @@ private boolean checkCaptcha(XWikiContext context) throws XWikiException } } + @Deprecated(since = "42.0.0") protected void handleTemporaryUploadedFiles(XWikiDocument document, XWikiRequest request) throws XWikiException { String[] uploadedFiles = request.getParameterValues("uploadedFiles"); diff --git a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/DownloadAction.java b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/DownloadAction.java index 7e3a0fd33b07..c668086b9628 100644 --- a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/DownloadAction.java +++ b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/DownloadAction.java @@ -296,6 +296,7 @@ private void writeByteRange(final XWikiAttachment attachment, Long start, Long e * @param context the XWikiContext just in case it is needed to load the attachment content * @throws XWikiException if something goes wrong */ + @Deprecated(since = "42.0.0") protected void sendContent(final XWikiAttachment attachment, final XWikiRequest request, final XWikiResponse response, final XWikiContext context) throws XWikiException { diff --git a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/HomePageRedirectServlet.java b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/HomePageRedirectServlet.java index 624e22640048..2827958ebfb3 100644 --- a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/HomePageRedirectServlet.java +++ b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/HomePageRedirectServlet.java @@ -21,15 +21,20 @@ import java.io.IOException; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; /** * A simple action that redirects to the main page of the wiki. This is to allow users to enter a URL like * http://localhost:8080/xwiki and be redirected automatically to * http://localhost:8080/xwiki/bin/view/Main/. + *

+ * While the class is much older, the since annotation was moved to 42.0.0 because it implement a completely different API + * from Java point of view. + * + * @since 42.0.0 */ public class HomePageRedirectServlet extends HttpServlet { @@ -39,7 +44,6 @@ public class HomePageRedirectServlet extends HttpServlet @Override public void init() throws ServletException { - super.init(); // TODO: we cannot use the XWiki API to determine the right URL, because this is a servlet and the core // is reachable mainly from Struts. Getting access to the core requires too much duplication, so for the // moment we're going the easy way: hardcoded values. diff --git a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/LegacyActionServlet.java b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/LegacyActionServlet.java index e876b1fd02d3..f0348391cf3a 100644 --- a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/LegacyActionServlet.java +++ b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/LegacyActionServlet.java @@ -23,11 +23,6 @@ import java.net.URL; import java.util.Collections; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - import org.xwiki.component.manager.ComponentLookupException; import org.xwiki.component.manager.ComponentManager; import org.xwiki.component.util.DefaultParameterizedType; @@ -39,12 +34,20 @@ import com.xpn.xwiki.internal.web.LegacyAction; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; + /** * Executed the right right action depending on the XWiki configuration (for example leading to view action by default * if enabled, etc.). + *

+ * While the class is much older, the since annotation was moved to 42.0.0 because it implement a completely different + * API from Java point of view. * * @version $Id$ - * @since 13.0 + * @since 42.0.0 */ public class LegacyActionServlet extends HttpServlet { diff --git a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/SkinAction.java b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/SkinAction.java index dd694284bd29..d1f8381eb52c 100644 --- a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/SkinAction.java +++ b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/SkinAction.java @@ -530,6 +530,7 @@ protected void setupHeaders(XWikiResponse response, String mimetype, Date lastCh * @since 11.3.6 * @since 10.11.10 */ + @Deprecated(since = "42.0.0") protected void setupHeaders(XWikiResponse response, String mimetype, Date lastChanged, long length) { if (!StringUtils.isBlank(mimetype)) { diff --git a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/Utils.java b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/Utils.java index 1ecf2509d92e..ece9a557ed75 100644 --- a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/Utils.java +++ b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/Utils.java @@ -242,6 +242,7 @@ public static void parseTemplate(String template, boolean write, XWikiContext co * @param defaultRedirect the default value to use if no {@code xredirect} parameter is present * @return the destination URL, as specified in the {@code xredirect} parameter, or the specified default URL */ + @Deprecated(since = "42.0.0") public static String getRedirect(XWikiRequest request, String defaultRedirect) { String redirect = request.getParameter("xredirect"); @@ -327,6 +328,7 @@ public static String getRedirect(String action, XWikiContext context) * @return the name of the requested template, as specified in the {@code xpage} parameter, or the specified default * template */ + @Deprecated(since = "42.0.0") public static String getPage(XWikiRequest request, String defaultpage) { String page = request.getParameter("xpage"); @@ -389,6 +391,7 @@ public static byte[] getContent(List filelist, String name) throws XWi return null; } + @Deprecated(since = "42.0.0") public static XWikiContext prepareContext(String action, XWikiRequest request, XWikiResponse response, XWikiEngineContext engine_context) throws XWikiException { diff --git a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/WrappingXWikiRequest.java b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/WrappingXWikiRequest.java index 1a50d89ff66c..303932891696 100644 --- a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/WrappingXWikiRequest.java +++ b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/WrappingXWikiRequest.java @@ -19,32 +19,11 @@ */ package com.xpn.xwiki.web; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.security.Principal; -import java.util.Collection; -import java.util.Enumeration; -import java.util.Locale; -import java.util.Map; -import java.util.Optional; - -import javax.servlet.AsyncContext; -import javax.servlet.DispatcherType; -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.ServletInputStream; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; -import javax.servlet.http.HttpUpgradeHandler; -import javax.servlet.http.Part; +import javax.servlet.http.HttpServletRequestWrapper; -import org.xwiki.user.UserReference; +import org.xwiki.container.Container; /** * A wrapper around {@link XWikiRequest}. @@ -52,8 +31,11 @@ * @version $Id$ * @since 12.4RC1 * @since 11.10.5 + * @deprecated use the {@link Container} API instead */ -public class WrappingXWikiRequest implements XWikiRequest +//TODO: uncomment the annotation when XWiki Standard scripts are fully migrated to the new API +//@Deprecated(since = "42.0.0") +public class WrappingXWikiRequest extends HttpServletRequestWrapper implements XWikiRequest { protected final XWikiRequest request; @@ -62,13 +44,9 @@ public class WrappingXWikiRequest implements XWikiRequest */ public WrappingXWikiRequest(XWikiRequest request) { - this.request = request; - } + super(request); - @Override - public ServletContext getServletContext() - { - return this.request.getServletContext(); + this.request = request; } @Override @@ -77,415 +55,6 @@ public HttpServletRequest getHttpServletRequest() return this.request.getHttpServletRequest(); } - @Override - public HttpSession getSession() - { - return this.request.getSession(); - } - - @Override - public HttpSession getSession(boolean create) - { - return this.request.getSession(create); - } - - @Override - public String getAuthType() - { - return this.request.getAuthType(); - } - - @Override - public Cookie[] getCookies() - { - return this.request.getCookies(); - } - - @Override - public long getDateHeader(String name) - { - return this.request.getDateHeader(name); - } - - @Override - public String getHeader(String name) - { - return this.request.getHeader(name); - } - - @Override - public Enumeration getHeaders(String name) - { - return this.request.getHeaders(name); - } - - @Override - public Enumeration getHeaderNames() - { - return this.request.getHeaderNames(); - } - - @Override - public int getIntHeader(String name) - { - return this.request.getIntHeader(name); - } - - @Override - public String getMethod() - { - return this.request.getMethod(); - } - - @Override - public String getPathInfo() - { - return this.request.getPathInfo(); - } - - @Override - public String getPathTranslated() - { - return this.request.getPathTranslated(); - } - - @Override - public String getContextPath() - { - return this.request.getContextPath(); - } - - @Override - public String getQueryString() - { - return this.request.getQueryString(); - } - - @Override - public String getRemoteUser() - { - return this.request.getRemoteUser(); - } - - @Override - public boolean isUserInRole(String role) - { - return this.request.isUserInRole(role); - } - - @Override - public Principal getUserPrincipal() - { - return this.request.getUserPrincipal(); - } - - @Override - public String getRequestedSessionId() - { - return this.request.getRequestedSessionId(); - } - - @Override - public String getRequestURI() - { - return this.request.getRequestURI(); - } - - @Override - public StringBuffer getRequestURL() - { - return this.request.getRequestURL(); - } - - @Override - public String getServletPath() - { - return this.request.getServletPath(); - } - - @Override - public String changeSessionId() - { - return this.request.changeSessionId(); - } - - @Override - public boolean isRequestedSessionIdValid() - { - return this.request.isRequestedSessionIdValid(); - } - - @Override - public boolean isRequestedSessionIdFromCookie() - { - return this.request.isRequestedSessionIdFromCookie(); - } - - @Override - public boolean isRequestedSessionIdFromURL() - { - return this.request.isRequestedSessionIdFromURL(); - } - - @Override - public boolean isRequestedSessionIdFromUrl() - { - return this.request.isRequestedSessionIdFromUrl(); - } - - @Override - public boolean authenticate(HttpServletResponse response) throws IOException, ServletException - { - return this.request.authenticate(response); - } - - @Override - public void login(String username, String password) throws ServletException - { - this.request.login(username, password); - } - - @Override - public void logout() throws ServletException - { - this.request.logout(); - } - - @Override - public Collection getParts() throws IOException, ServletException - { - return this.request.getParts(); - } - - @Override - public Part getPart(String name) throws IOException, ServletException - { - return this.request.getPart(name); - } - - @Override - public T upgrade(Class handlerClass) throws IOException, ServletException - { - return this.request.upgrade(handlerClass); - } - - @Override - public Object getAttribute(String name) - { - return this.request.getAttribute(name); - } - - @Override - public Enumeration getAttributeNames() - { - return this.request.getAttributeNames(); - } - - @Override - public String getCharacterEncoding() - { - return this.request.getCharacterEncoding(); - } - - @Override - public void setCharacterEncoding(String env) throws UnsupportedEncodingException - { - this.request.setCharacterEncoding(env); - } - - @Override - public int getContentLength() - { - return this.request.getContentLength(); - } - - @Override - public long getContentLengthLong() - { - return this.request.getContentLengthLong(); - } - - @Override - public String getContentType() - { - return this.request.getContentType(); - } - - @Override - public ServletInputStream getInputStream() throws IOException - { - return this.request.getInputStream(); - } - - @Override - public String getParameter(String name) - { - return this.request.getParameter(name); - } - - @Override - public Enumeration getParameterNames() - { - return this.request.getParameterNames(); - } - - @Override - public String[] getParameterValues(String name) - { - return this.request.getParameterValues(name); - } - - @Override - public Map getParameterMap() - { - return this.request.getParameterMap(); - } - - @Override - public String getProtocol() - { - return this.request.getProtocol(); - } - - @Override - public String getScheme() - { - return this.request.getScheme(); - } - - @Override - public String getServerName() - { - return this.request.getServerName(); - } - - @Override - public int getServerPort() - { - return this.request.getServerPort(); - } - - @Override - public BufferedReader getReader() throws IOException - { - return this.request.getReader(); - } - - @Override - public String getRemoteAddr() - { - return this.request.getRemoteAddr(); - } - - @Override - public String getRemoteHost() - { - return this.request.getRemoteHost(); - } - - @Override - public void setAttribute(String name, Object o) - { - this.request.setAttribute(name, o); - } - - @Override - public void removeAttribute(String name) - { - this.request.removeAttribute(name); - } - - @Override - public Locale getLocale() - { - return this.request.getLocale(); - } - - @Override - public Enumeration getLocales() - { - return this.request.getLocales(); - } - - @Override - public boolean isSecure() - { - return this.request.isSecure(); - } - - @Override - public RequestDispatcher getRequestDispatcher(String path) - { - return this.request.getRequestDispatcher(path); - } - - @Override - public String getRealPath(String path) - { - return this.request.getRealPath(path); - } - - @Override - public int getRemotePort() - { - return this.request.getRemotePort(); - } - - @Override - public String getLocalName() - { - return this.request.getLocalName(); - } - - @Override - public String getLocalAddr() - { - return this.request.getLocalAddr(); - } - - @Override - public int getLocalPort() - { - return this.request.getLocalPort(); - } - - @Override - public AsyncContext startAsync() throws IllegalStateException - { - return this.request.startAsync(); - } - - @Override - public AsyncContext startAsync(ServletRequest servletRequest, ServletResponse servletResponse) - throws IllegalStateException - { - return this.request.startAsync(servletRequest, servletResponse); - } - - @Override - public boolean isAsyncStarted() - { - return this.request.isAsyncStarted(); - } - - @Override - public boolean isAsyncSupported() - { - return this.request.isAsyncSupported(); - } - - @Override - public AsyncContext getAsyncContext() - { - return this.request.getAsyncContext(); - } - - @Override - public DispatcherType getDispatcherType() - { - return this.request.getDispatcherType(); - } - @Override public String get(String name) { @@ -497,10 +66,4 @@ public Cookie getCookie(String cookieName) { return this.request.getCookie(cookieName); } - - @Override - public Optional getEffectiveAuthor() - { - return this.request.getEffectiveAuthor(); - } } diff --git a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/XWikiAction.java b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/XWikiAction.java index 4797c1f76b83..96db46a1ecb0 100644 --- a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/XWikiAction.java +++ b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/XWikiAction.java @@ -33,8 +33,6 @@ import javax.inject.Named; import javax.script.ScriptContext; import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.exception.ExceptionUtils; @@ -56,6 +54,7 @@ import org.xwiki.context.ExecutionContext; import org.xwiki.csrf.CSRFToken; import org.xwiki.internal.web.DocExistValidator; +import org.xwiki.jakartabridge.servlet.JakartaServletBridge; import org.xwiki.job.event.status.JobProgressManager; import org.xwiki.job.internal.DefaultJobProgress; import org.xwiki.localization.ContextualLocalizationManager; @@ -106,6 +105,9 @@ import com.xpn.xwiki.plugin.fileupload.FileUploadPlugin; import com.xpn.xwiki.redirection.RedirectionFilter; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; + /** *

* Root class for most XWiki actions. It provides a common framework that allows actions to execute just the specific @@ -333,7 +335,8 @@ public void execute(HttpServletRequest servletRequest, HttpServletResponse servl // Initialize the XWiki Context which is the main object used to pass information across // classes/methods. It's also wrapping the request, response, and all container objects // in general. - context = initializeXWikiContext(servletRequest, servletResponse); + context = + initializeXWikiContext(JakartaServletBridge.toJavax(servletRequest), JakartaServletBridge.toJavax(servletResponse)); // From this line forward all information can be found in the XWiki Context. execute(context); @@ -831,8 +834,9 @@ private void renderInit(XWikiContext xcontext) throws Exception xcontext.setFinished(true); } - protected XWikiContext initializeXWikiContext(HttpServletRequest servletRequest, - HttpServletResponse servletResponse) + @Deprecated(since = "42.0.0") + protected XWikiContext initializeXWikiContext(javax.servlet.http.HttpServletRequest servletRequest, + javax.servlet.http.HttpServletResponse servletResponse) throws XWikiException, ServletException, InstantiationException, IllegalAccessException { XWikiForm form; @@ -854,8 +858,9 @@ protected String getName() return this.componentDescriptor.getRoleHint(); } - protected XWikiContext initializeXWikiContext(HttpServletRequest servletRequest, - HttpServletResponse servletResponse, XWikiForm form) throws XWikiException, ServletException + @Deprecated(since = "42.0.0") + protected XWikiContext initializeXWikiContext(javax.servlet.http.HttpServletRequest servletRequest, + javax.servlet.http.HttpServletResponse servletResponse, XWikiForm form) throws XWikiException, ServletException { String action = getName(); @@ -910,8 +915,8 @@ public String getRealPath(String path) { Request request = this.container.getRequest(); - if (request instanceof ServletRequest) { - return ((ServletRequest) request).getHttpServletRequest().getServletContext().getRealPath(path); + if (request instanceof ServletRequest servletRequest) { + return servletRequest.getJakartaHttpServletRequest().getServletContext().getRealPath(path); } return null; diff --git a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/XWikiContextInitializationFilter.java b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/XWikiContextInitializationFilter.java index 374ce5c727d8..647436884ee2 100644 --- a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/XWikiContextInitializationFilter.java +++ b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/XWikiContextInitializationFilter.java @@ -20,7 +20,6 @@ package com.xpn.xwiki.web; import java.io.IOException; -import java.lang.reflect.Type; import javax.servlet.Filter; import javax.servlet.FilterChain; @@ -28,43 +27,27 @@ import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import org.xwiki.container.Container; -import org.xwiki.container.servlet.ServletContainerException; -import org.xwiki.container.servlet.ServletContainerInitializer; -import org.xwiki.context.Execution; -import org.xwiki.model.reference.DocumentReference; +import org.xwiki.jakartabridge.servlet.JakartaServletBridge; -import com.xpn.xwiki.XWiki; import com.xpn.xwiki.XWikiContext; -import com.xpn.xwiki.XWikiException; -import com.xpn.xwiki.user.api.XWikiRightService; -import com.xpn.xwiki.user.api.XWikiUser; /** * This filter can be used to initialize the XWiki context before processing a request. * * @version $Id$ * @since 13.4RC1 + * @deprecated use {@link XWikiContextInitializer} instead */ +@Deprecated(since = "42.0.0") public class XWikiContextInitializationFilter implements Filter { - /** - * The filter configuration object. - */ - private FilterConfig filterConfig; - - /** - * XWiki context mode. - */ - private int mode; + private final XWikiContextInitializer jakarta = new XWikiContextInitializer(); @Override public void destroy() { - this.filterConfig = null; + this.jakarta.destroy(); } @Override @@ -72,30 +55,31 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha throws IOException, ServletException { try { - // Only HTTP requests are supported. - if (request instanceof HttpServletRequest) { - initializeXWikiContext(request, response); - } - chain.doFilter(request, response); - } finally { - if (request instanceof HttpServletRequest) { - cleanupComponents(); - } + this.jakarta.doFilter(JakartaServletBridge.toJakarta(request), JakartaServletBridge.toJakarta(response), + JakartaServletBridge.toJakarta(chain)); + } catch (jakarta.servlet.ServletException e) { + throw new ServletException(e); } } @Override public void init(FilterConfig filterConfig) throws ServletException { - this.filterConfig = filterConfig; - try { - this.mode = Integer.parseInt(filterConfig.getInitParameter("mode")); - } catch (Exception e) { - this.mode = -1; + this.jakarta.init(JakartaServletBridge.toJakarta(filterConfig)); + } catch (jakarta.servlet.ServletException e) { + throw new ServletException(e); } } + /** + * @param context the XWiki context + * @throws ServletException if the container component initialization fails + */ + protected void initializeContainerComponent(XWikiContext context) throws ServletException + { + } + /** * Initializes the XWiki context. * @@ -105,65 +89,7 @@ public void init(FilterConfig filterConfig) throws ServletException */ protected void initializeXWikiContext(ServletRequest request, ServletResponse response) throws ServletException { - try { - // Not all request types specify an action (e.g. GWT-RPC) so we default to the empty string. - String action = ""; - XWikiServletContext xwikiEngine = new XWikiServletContext(this.filterConfig.getServletContext()); - XWikiServletRequest xwikiRequest = new XWikiServletRequest((HttpServletRequest) request); - XWikiServletResponse xwikiResponse = new XWikiServletResponse((HttpServletResponse) response); - - // Create the XWiki context. - XWikiContext context = Utils.prepareContext(action, xwikiRequest, xwikiResponse, xwikiEngine); - - // Overwrite the context mode set in the prepareContext() call just above if the mode filter initialization - // parameter is specified. - if (this.mode >= 0) { - context.setMode(this.mode); - } - - // Initialize the Container component which is the new way of transporting the Context in the new component - // architecture. Further initialization might require the Container component. - initializeContainerComponent(context); - - // Initialize the XWiki database. XWiki#getXWiki(XWikiContext) calls XWikiContext.setWiki(XWiki). - XWiki xwiki = XWiki.getXWiki(context); - - // Initialize the URL factory. - context.setURLFactory(xwiki.getURLFactoryService().createURLFactory(context.getMode(), context)); - - // Prepare the localized resources, according to the selected language. - xwiki.prepareResources(context); - - // Initialize the current user. - XWikiUser user = context.getWiki().checkAuth(context); - if (user != null) { - DocumentReference userReference = user.getUserReference(); - context.setUserReference( - XWikiRightService.GUEST_USER.equals(userReference.getName()) ? null : userReference); - } - } catch (XWikiException e) { - throw new ServletException("Failed to initialize the XWiki context.", e); - } - } - - /** - * @param context the XWiki context - * @throws ServletException if the container component initialization fails - */ - protected void initializeContainerComponent(XWikiContext context) throws ServletException - { - // Initialize the Container fields (request, response, session). Note that this is a bridge between the old core - // and the component architecture. In the new component architecture we use ThreadLocal to transport the - // request, response and session to components which require them. - ServletContainerInitializer containerInitializer = Utils.getComponent((Type) ServletContainerInitializer.class); - - try { - containerInitializer.initializeRequest(context.getRequest().getHttpServletRequest(), context); - containerInitializer.initializeResponse(context.getResponse()); - containerInitializer.initializeSession(context.getRequest().getHttpServletRequest()); - } catch (ServletContainerException e) { - throw new ServletException("Failed to initialize Request/Response or Session", e); - } + } /** @@ -172,12 +98,5 @@ protected void initializeContainerComponent(XWikiContext context) throws Servlet */ protected void cleanupComponents() { - Container container = Utils.getComponent((Type) Container.class); - container.removeRequest(); - container.removeResponse(); - container.removeSession(); - - Execution execution = Utils.getComponent((Type) Execution.class); - execution.removeContext(); } } diff --git a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/XWikiContextInitializer.java b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/XWikiContextInitializer.java new file mode 100644 index 000000000000..e2152b659b99 --- /dev/null +++ b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/XWikiContextInitializer.java @@ -0,0 +1,193 @@ +/* + * See the NOTICE file distributed with this work for additional + * information regarding copyright ownership. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package com.xpn.xwiki.web; + +import java.io.IOException; +import java.lang.reflect.Type; + +import org.xwiki.container.Container; +import org.xwiki.container.servlet.ServletContainerException; +import org.xwiki.container.servlet.ServletContainerInitializer; +import org.xwiki.context.Execution; +import org.xwiki.jakartabridge.servlet.JakartaServletBridge; +import org.xwiki.model.reference.DocumentReference; + +import com.xpn.xwiki.XWiki; +import com.xpn.xwiki.XWikiContext; +import com.xpn.xwiki.XWikiException; +import com.xpn.xwiki.user.api.XWikiRightService; +import com.xpn.xwiki.user.api.XWikiUser; + +import jakarta.servlet.Filter; +import jakarta.servlet.FilterChain; +import jakarta.servlet.FilterConfig; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; + +/** + * This filter can be used to initialize the XWiki context before processing a request. + *

+ * While the class is much older, the since annotation was moved to 42.0.0 because it implement a completely different + * API from Java point of view. + * + * @version $Id$ + * @since 42.0.0 + */ +public class XWikiContextInitializer implements Filter +{ + /** + * XWiki context mode. + */ + private int mode; + + @Override + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) + throws IOException, ServletException + { + try { + // Only HTTP requests are supported. + if (request instanceof HttpServletRequest) { + initializeXWikiContext(request, response); + } + chain.doFilter(request, response); + } finally { + if (request instanceof HttpServletRequest) { + cleanupComponents(); + } + } + } + + @Override + public void init(FilterConfig filterConfig) throws ServletException + { + try { + this.mode = Integer.parseInt(filterConfig.getInitParameter("mode")); + } catch (Exception e) { + this.mode = -1; + } + } + + /** + * Initializes the XWiki context. + * + * @param request the request being processed + * @param response the response + * @throws ServletException if the initialization fails + * @deprecated use {@link #initializeXWikiContext(ServletRequest, ServletResponse)} instead + */ + @Deprecated(since = "42.0.0") + protected void initializeXWikiContext(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response) + throws ServletException + { + initializeXWikiContext(JakartaServletBridge.toJakarta(request), JakartaServletBridge.toJakarta(response)); + } + + /** + * Initializes the XWiki context. + * + * @param request the request being processed + * @param response the response + * @throws ServletException if the initialization fails + * @since 42.0.0 + */ + protected void initializeXWikiContext(ServletRequest request, ServletResponse response) throws ServletException + { + try { + // Not all request types specify an action (e.g. GWT-RPC) so we default to the empty string. + String action = ""; + XWikiServletContext xwikiEngine = + new XWikiServletContext(JakartaServletBridge.toJavax(request.getServletContext())); + XWikiServletRequest xwikiRequest = + new XWikiServletRequest(JakartaServletBridge.toJavax((HttpServletRequest) request)); + XWikiServletResponse xwikiResponse = + new XWikiServletResponse(JakartaServletBridge.toJavax((HttpServletResponse) response)); + + // Create the XWiki context. + XWikiContext context = Utils.prepareContext(action, xwikiRequest, xwikiResponse, xwikiEngine); + + // Overwrite the context mode set in the prepareContext() call just above if the mode filter initialization + // parameter is specified. + if (this.mode >= 0) { + context.setMode(this.mode); + } + + // Initialize the Container component which is the new way of transporting the Context in the new component + // architecture. Further initialization might require the Container component. + initializeContainerComponent(context); + + // Initialize the XWiki database. XWiki#getXWiki(XWikiContext) calls XWikiContext.setWiki(XWiki). + XWiki xwiki = XWiki.getXWiki(context); + + // Initialize the URL factory. + context.setURLFactory(xwiki.getURLFactoryService().createURLFactory(context.getMode(), context)); + + // Prepare the localized resources, according to the selected language. + xwiki.prepareResources(context); + + // Initialize the current user. + XWikiUser user = context.getWiki().checkAuth(context); + if (user != null) { + DocumentReference userReference = user.getUserReference(); + context.setUserReference( + XWikiRightService.GUEST_USER.equals(userReference.getName()) ? null : userReference); + } + } catch (XWikiException e) { + throw new ServletException("Failed to initialize the XWiki context.", e); + } + } + + /** + * @param context the XWiki context + * @throws ServletException if the container component initialization fails + */ + protected void initializeContainerComponent(XWikiContext context) throws ServletException + { + // Initialize the Container fields (request, response, session). Note that this is a bridge between the old core + // and the component architecture. In the new component architecture we use ThreadLocal to transport the + // request, response and session to components which require them. + ServletContainerInitializer containerInitializer = Utils.getComponent((Type) ServletContainerInitializer.class); + + try { + containerInitializer.initializeRequest(context.getRequest().getHttpServletRequest(), context); + containerInitializer.initializeResponse(context.getResponse()); + containerInitializer.initializeSession(context.getRequest().getHttpServletRequest()); + } catch (ServletContainerException e) { + throw new ServletException("Failed to initialize Request/Response or Session", e); + } + } + + /** + * We must ensure we clean the ThreadLocal variables located in the Container and Execution components as otherwise + * we will have a potential memory leak. + */ + protected void cleanupComponents() + { + Container container = Utils.getComponent((Type) Container.class); + container.removeRequest(); + container.removeResponse(); + container.removeSession(); + + Execution execution = Utils.getComponent((Type) Execution.class); + execution.removeContext(); + } +} diff --git a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/XWikiForm.java b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/XWikiForm.java index d141b0518276..5bd97cdf2f83 100644 --- a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/XWikiForm.java +++ b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/XWikiForm.java @@ -56,12 +56,14 @@ public void reset(HttpServletRequest request) * @param request The servlet request we are processing * @since 13.0 */ + @Deprecated(since = "42.0.0") public void reset(XWikiRequest request) { this.request = request; readRequest(); } + @Deprecated(since = "42.0.0") public XWikiRequest getRequest() { return this.request; diff --git a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/XWikiRequest.java b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/XWikiRequest.java index a39e3612217f..c14a2a176665 100644 --- a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/XWikiRequest.java +++ b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/XWikiRequest.java @@ -27,6 +27,11 @@ import org.xwiki.stability.Unstable; import org.xwiki.user.UserReference; +/** + * @version $Id$ + * @deprecated use the {@link org.xwiki.container.Container} API instead + */ +@Deprecated(since = "17-jakarta") public interface XWikiRequest extends HttpServletRequest { String get(String name); diff --git a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/XWikiResponse.java b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/XWikiResponse.java index b3de82729421..55f314b054da 100644 --- a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/XWikiResponse.java +++ b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/XWikiResponse.java @@ -21,6 +21,11 @@ import javax.servlet.http.HttpServletResponse; +/** + * @version $Id$ + * @deprecated use {@link org.xwiki.container.Container} API instead + */ +@Deprecated(since = "42.0.0") public interface XWikiResponse extends HttpServletResponse { /** diff --git a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/XWikiServletContext.java b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/XWikiServletContext.java index 98ecd06b161a..f738f6d8252a 100644 --- a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/XWikiServletContext.java +++ b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/XWikiServletContext.java @@ -25,6 +25,13 @@ import javax.servlet.ServletContext; +/** + * Servlet based implementation of {@link XWikiEngineContext}. + * + * @version $Id$ + * @deprecated use the {@link org.xwiki.container.Container} API instead + */ +@Deprecated(since = "42.0.0") public class XWikiServletContext implements XWikiEngineContext { private ServletContext scontext; diff --git a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/XWikiServletRequest.java b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/XWikiServletRequest.java index f77e5ec2c7c2..2c2f6ad21d9c 100644 --- a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/XWikiServletRequest.java +++ b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/XWikiServletRequest.java @@ -34,6 +34,7 @@ * * @version $Id$ */ +@Deprecated(since = "42.0.0") public class XWikiServletRequest extends HttpServletRequestWrapper implements XWikiRequest { public static final String ATTRIBUTE_EFFECTIVE_AUTHOR = XWikiRequest.class.getName() + "#effectiveAuthor"; diff --git a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/XWikiServletRequestStub.java b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/XWikiServletRequestStub.java index a1efa9b0d9cf..dace3db8c70f 100644 --- a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/XWikiServletRequestStub.java +++ b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/XWikiServletRequestStub.java @@ -64,6 +64,7 @@ * * @version $Id$ */ +@Deprecated(since = "42.0.0") public class XWikiServletRequestStub implements XWikiRequest { /** diff --git a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/XWikiServletResponse.java b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/XWikiServletResponse.java index 1974c4eeb355..b3b61043ad8b 100644 --- a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/XWikiServletResponse.java +++ b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/XWikiServletResponse.java @@ -32,6 +32,7 @@ import org.slf4j.LoggerFactory; import org.xwiki.url.URLSecurityManager; +@Deprecated(since = "42.0.0") public class XWikiServletResponse extends HttpServletResponseWrapper implements XWikiResponse { private static final Logger LOGGER = LoggerFactory.getLogger(XWikiServletResponse.class); diff --git a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/XWikiServletResponseStub.java b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/XWikiServletResponseStub.java index 5aa18a4c4b24..28f00ce3b7e8 100644 --- a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/XWikiServletResponseStub.java +++ b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/XWikiServletResponseStub.java @@ -30,12 +30,17 @@ import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletResponse; +import org.xwiki.container.Container; + /** * This stub is intended to simulate a servlet request in a daemon context, in order to be able to create a custom XWiki * context. This trick is used in to give a daemon thread access to the XWiki api. * * @version $Id$ + * @deprecated use the {@link Container} API instead */ +// TODO: uncomment the annotation when XWiki Standard scripts are fully migrated to the new API +//@Deprecated(since = "42.0.0") public class XWikiServletResponseStub implements XWikiResponse { private OutputStream outputStream; diff --git a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/XWikiServletURLFactory.java b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/XWikiServletURLFactory.java index d2c852bce1d0..223acb09ba24 100644 --- a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/XWikiServletURLFactory.java +++ b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/XWikiServletURLFactory.java @@ -54,6 +54,7 @@ import com.xpn.xwiki.doc.XWikiAttachment; import com.xpn.xwiki.doc.XWikiDocument; +@Deprecated(since = "42.0.0") public class XWikiServletURLFactory extends XWikiDefaultURLFactory { private static final Logger LOGGER = LoggerFactory.getLogger(XWikiServletURLFactory.class); diff --git a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/org/xwiki/internal/script/XWikiScriptContextInitializer.java b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/org/xwiki/internal/script/XWikiScriptContextInitializer.java index f1f0353f45c4..cd211dd07b7e 100644 --- a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/org/xwiki/internal/script/XWikiScriptContextInitializer.java +++ b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/org/xwiki/internal/script/XWikiScriptContextInitializer.java @@ -83,9 +83,13 @@ public void initialize(ScriptContext scriptContext) // It's safe to overwrite the following bindings because they don't have a real state. Moreover the request and // the response objects from the XWiki context can be replaced so the script bindings have to be synchronized. - scriptContext.setAttribute("request", new ScriptXWikiServletRequest(xcontext.getRequest(), this.authorization), - ScriptContext.ENGINE_SCOPE); - scriptContext.setAttribute("response", xcontext.getResponse(), ScriptContext.ENGINE_SCOPE); + if (xcontext.getRequest() != null) { + scriptContext.setAttribute("request", + new ScriptXWikiServletRequest(xcontext.getRequest(), this.authorization), ScriptContext.ENGINE_SCOPE); + } + if (xcontext.getResponse() != null) { + scriptContext.setAttribute("response", xcontext.getResponse(), ScriptContext.ENGINE_SCOPE); + } // Current document Document docAPI = null; diff --git a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/org/xwiki/store/TemporaryAttachmentSessionsManager.java b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/org/xwiki/store/TemporaryAttachmentSessionsManager.java index 0105b2439de5..3cf4493d0b2e 100644 --- a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/org/xwiki/store/TemporaryAttachmentSessionsManager.java +++ b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/org/xwiki/store/TemporaryAttachmentSessionsManager.java @@ -23,21 +23,22 @@ import java.util.List; import java.util.Optional; -import javax.servlet.http.Part; - import org.xwiki.attachment.validation.AttachmentValidationException; import org.xwiki.component.annotation.Role; +import org.xwiki.jakartabridge.servlet.JakartaServletBridge; import org.xwiki.model.reference.AttachmentReference; import org.xwiki.model.reference.DocumentReference; +import org.xwiki.stability.Unstable; import com.xpn.xwiki.doc.XWikiAttachment; import com.xpn.xwiki.doc.XWikiDocument; +import jakarta.servlet.http.Part; + /** - * Interface for operations related to temporary upload of attachments. - * The idea of this API is to allow obtaining directly a temporary {@link XWikiAttachment} from a {@link Part} and to - * keep it in cache until it's saved. - * The manager is handling a separated map of attachments for each {@link javax.servlet.http.HttpSession}. + * Interface for operations related to temporary upload of attachments. The idea of this API is to allow obtaining + * directly a temporary {@link XWikiAttachment} from a {@link Part} and to keep it in cache until it's saved. The + * manager is handling a separated map of attachments for each {@link jakarta.servlet.http.HttpSession}. * * @version $Id$ * @since 14.3RC1 @@ -53,11 +54,35 @@ public interface TemporaryAttachmentSessionsManager * @param part the actual data that is uploaded. * @return an attachment that is not saved yet but cached and contains the data of the given part. * @throws TemporaryAttachmentException in case of problem when reading the part - * @throws AttachmentValidationException in case of error when validating the attachment (e.g., the maximum - * filesize is reached) + * @throws AttachmentValidationException in case of error when validating the attachment (e.g., the maximum filesize + * is reached) + * @deprecated use {@link #uploadAttachment(DocumentReference, Part)} instead */ - XWikiAttachment uploadAttachment(DocumentReference documentReference, Part part) - throws TemporaryAttachmentException, AttachmentValidationException; + @Deprecated(since = "42.0.0") + default XWikiAttachment uploadAttachment(DocumentReference documentReference, javax.servlet.http.Part part) + throws TemporaryAttachmentException, AttachmentValidationException + { + return uploadAttachment(documentReference, part, null); + } + + /** + * Temporary store the given {@link Part} to a cached {@link XWikiAttachment} attached to the given + * {@link DocumentReference}. + * + * @param documentReference the reference of the document that the attachment should be attached to. + * @param part the actual data that is uploaded. + * @return an attachment that is not saved yet but cached and contains the data of the given part. + * @throws TemporaryAttachmentException in case of problem when reading the part + * @throws AttachmentValidationException in case of error when validating the attachment (e.g., the maximum filesize + * is reached) + * @since 42.0.0 + */ + @Unstable + default XWikiAttachment uploadAttachment(DocumentReference documentReference, Part part) + throws TemporaryAttachmentException, AttachmentValidationException + { + return uploadAttachment(documentReference, part, null); + } /** * Temporary store the given {@link Part} to a cached {@link XWikiAttachment} attached to the given @@ -66,22 +91,45 @@ XWikiAttachment uploadAttachment(DocumentReference documentReference, Part part) * @param documentReference the reference of the document that the attachment should be attached to * @param part the actual data that is uploaded * @param filename an optional filename used instead of using {@link Part#getSubmittedFileName()}, ignored when - * {@code null} or blank + * {@code null} or blank * @return an attachment that is not saved yet but cached and contains the data of the given part * @throws TemporaryAttachmentException in case of problem when reading the part - * @throws AttachmentValidationException in case of error when validating the attachment (e.g., the maximum - * filesize is reached) + * @throws AttachmentValidationException in case of error when validating the attachment (e.g., the maximum filesize + * is reached) * @since 14.9RC1 + * @deprecated use {@link #uploadAttachment(DocumentReference, Part, String)} instead */ - XWikiAttachment uploadAttachment(DocumentReference documentReference, Part part, String filename) + @Deprecated(since = "42.0.0") + XWikiAttachment uploadAttachment(DocumentReference documentReference, javax.servlet.http.Part part, String filename) throws TemporaryAttachmentException, AttachmentValidationException; /** - * Allow to temporarily attach the given instance of {@link XWikiAttachment} to the given document reference. - * This can be useful if an API manipulates an {@link XWikiAttachment} without saving it, and want it to be - * discoverable when parsing a document through the download action for example. - * Note that consumer of this API needs to be aware that the file attached to the {@link XWikiAttachment} might be - * deleted at the end of the session, as any temporary attachment. + * Temporary store the given {@link Part} to a cached {@link XWikiAttachment} attached to the given + * {@link DocumentReference}. + * + * @param documentReference the reference of the document that the attachment should be attached to + * @param part the actual data that is uploaded + * @param filename an optional filename used instead of using {@link Part#getSubmittedFileName()}, ignored when + * {@code null} or blank + * @return an attachment that is not saved yet but cached and contains the data of the given part + * @throws TemporaryAttachmentException in case of problem when reading the part + * @throws AttachmentValidationException in case of error when validating the attachment (e.g., the maximum filesize + * is reached) + * @since 42.0.0 + */ + @Unstable + default XWikiAttachment uploadAttachment(DocumentReference documentReference, Part part, String filename) + throws TemporaryAttachmentException, AttachmentValidationException + { + return uploadAttachment(documentReference, JakartaServletBridge.toJavax(part), filename); + } + + /** + * Allow to temporarily attach the given instance of {@link XWikiAttachment} to the given document reference. This + * can be useful if an API manipulates an {@link XWikiAttachment} without saving it, and want it to be discoverable + * when parsing a document through the download action for example. Note that consumer of this API needs to be aware + * that the file attached to the {@link XWikiAttachment} might be deleted at the end of the session, as any + * temporary attachment. * * @param attachment the attachment to be temporarily attached to the document * @param documentReference the reference of the document to link this attachment to @@ -129,7 +177,7 @@ default Optional getUploadedAttachment(AttachmentReference atta * @param documentReference the reference for which to retrieve the temporary attachment. * @param filename the filename to look for. * @return {@code true} if the attachment have been found for deletion, {@code false} if no matching attachment - * could be find. + * could be find. */ boolean removeUploadedAttachment(DocumentReference documentReference, String filename); @@ -139,17 +187,17 @@ default Optional getUploadedAttachment(AttachmentReference atta * * @param documentReference the reference for which to retrieve the temporary attachments. * @return {@code true} if there was some temporary attachments in cache for the given document reference in the - * current user session, {@code false} if there was no matching temporary attachment in cache. + * current user session, {@code false} if there was no matching temporary attachment in cache. */ boolean removeUploadedAttachments(DocumentReference documentReference); /** * This method aims at attaching the {@link XWikiAttachment} that might have been previously temporary upload to the - * {@link XWikiDocument} they are targeting. - * This method should only be called before performing a save of the document to actually persist them. Also note - * that this method cannot call {@link #removeUploadedAttachment(DocumentReference, String)} as removing the - * attachment would delete the data before they can be properly saved in the persistent storage. So the consumer of - * the API should take care of properly calling this API when needed. + * {@link XWikiDocument} they are targeting. This method should only be called before performing a save of the + * document to actually persist them. Also note that this method cannot call + * {@link #removeUploadedAttachment(DocumentReference, String)} as removing the attachment would delete the data + * before they can be properly saved in the persistent storage. So the consumer of the API should take care of + * properly calling this API when needed. * * @param document the actual document instance that should receive the attachments * @param fileNames the names of the uploaded files to attach diff --git a/xwiki-platform-core/xwiki-platform-oldcore/src/test/java/com/xpn/xwiki/test/AbstractBridgedComponentTestCase.java b/xwiki-platform-core/xwiki-platform-oldcore/src/test/java/com/xpn/xwiki/test/AbstractBridgedComponentTestCase.java index df69c6bd7b38..194c2e7d3484 100644 --- a/xwiki-platform-core/xwiki-platform-oldcore/src/test/java/com/xpn/xwiki/test/AbstractBridgedComponentTestCase.java +++ b/xwiki-platform-core/xwiki-platform-oldcore/src/test/java/com/xpn/xwiki/test/AbstractBridgedComponentTestCase.java @@ -103,7 +103,7 @@ public void setUp() throws Exception will(returnValue(null)); allowing(mockServletContext).getResourceAsStream("/WEB-INF/xwiki.cfg"); will(returnValue(null)); - allowing(mockServletContext).getAttribute("javax.servlet.context.tempdir"); + allowing(mockServletContext).getAttribute("jakarta.servlet.context.tempdir"); will(returnValue(new File(System.getProperty("java.io.tmpdir")))); }}); diff --git a/xwiki-platform-core/xwiki-platform-oldcore/src/test/java/com/xpn/xwiki/web/ActionFilterTest.java b/xwiki-platform-core/xwiki-platform-oldcore/src/test/java/com/xpn/xwiki/web/ActionFilterTest.java index f5911a91b607..ec4f07d3049f 100644 --- a/xwiki-platform-core/xwiki-platform-oldcore/src/test/java/com/xpn/xwiki/web/ActionFilterTest.java +++ b/xwiki-platform-core/xwiki-platform-oldcore/src/test/java/com/xpn/xwiki/web/ActionFilterTest.java @@ -19,10 +19,10 @@ */ package com.xpn.xwiki.web; -import javax.servlet.FilterChain; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.FilterChain; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServletRequest; import org.junit.jupiter.api.Test; import org.xwiki.component.manager.ComponentManager; diff --git a/xwiki-platform-core/xwiki-platform-ratings/xwiki-platform-ratings-api/pom.xml b/xwiki-platform-core/xwiki-platform-ratings/xwiki-platform-ratings-api/pom.xml index a503785f6a61..f2527f84c14d 100644 --- a/xwiki-platform-core/xwiki-platform-ratings/xwiki-platform-ratings-api/pom.xml +++ b/xwiki-platform-core/xwiki-platform-ratings/xwiki-platform-ratings-api/pom.xml @@ -68,8 +68,8 @@ - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api test diff --git a/xwiki-platform-core/xwiki-platform-realtime/xwiki-platform-realtime-api/pom.xml b/xwiki-platform-core/xwiki-platform-realtime/xwiki-platform-realtime-api/pom.xml index 699af5566d52..719c6b625d8c 100644 --- a/xwiki-platform-core/xwiki-platform-realtime/xwiki-platform-realtime-api/pom.xml +++ b/xwiki-platform-core/xwiki-platform-realtime/xwiki-platform-realtime-api/pom.xml @@ -67,8 +67,8 @@ test - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api test diff --git a/xwiki-platform-core/xwiki-platform-refactoring/xwiki-platform-refactoring-default/pom.xml b/xwiki-platform-core/xwiki-platform-refactoring/xwiki-platform-refactoring-default/pom.xml index e4876481011a..ce28a84e90d5 100644 --- a/xwiki-platform-core/xwiki-platform-refactoring/xwiki-platform-refactoring-default/pom.xml +++ b/xwiki-platform-core/xwiki-platform-refactoring/xwiki-platform-refactoring-default/pom.xml @@ -62,11 +62,6 @@ - - javax.servlet - javax.servlet-api - test - org.xwiki.commons xwiki-commons-tool-test-component diff --git a/xwiki-platform-core/xwiki-platform-rendering/xwiki-platform-rendering-async/xwiki-platform-rendering-async-macro/pom.xml b/xwiki-platform-core/xwiki-platform-rendering/xwiki-platform-rendering-async/xwiki-platform-rendering-async-macro/pom.xml index 8f9df2711f9c..9fc337d4ec7f 100644 --- a/xwiki-platform-core/xwiki-platform-rendering/xwiki-platform-rendering-async/xwiki-platform-rendering-async-macro/pom.xml +++ b/xwiki-platform-core/xwiki-platform-rendering/xwiki-platform-rendering-async/xwiki-platform-rendering-async-macro/pom.xml @@ -83,13 +83,13 @@ test - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api test - org.mortbay.jasper - apache-el + org.glassfish.expressly + expressly test diff --git a/xwiki-platform-core/xwiki-platform-rendering/xwiki-platform-rendering-macros/pom.xml b/xwiki-platform-core/xwiki-platform-rendering/xwiki-platform-rendering-macros/pom.xml index 21f4c6ac8350..1b48fd3ddf89 100644 --- a/xwiki-platform-core/xwiki-platform-rendering/xwiki-platform-rendering-macros/pom.xml +++ b/xwiki-platform-core/xwiki-platform-rendering/xwiki-platform-rendering-macros/pom.xml @@ -64,8 +64,8 @@ test - org.mortbay.jasper - apache-el + org.glassfish.expressly + expressly test diff --git a/xwiki-platform-core/xwiki-platform-rendering/xwiki-platform-rendering-macros/xwiki-platform-rendering-macro-context/pom.xml b/xwiki-platform-core/xwiki-platform-rendering/xwiki-platform-rendering-macros/xwiki-platform-rendering-macro-context/pom.xml index b541bdb3cece..61c9dfdc0327 100644 --- a/xwiki-platform-core/xwiki-platform-rendering/xwiki-platform-rendering-macros/xwiki-platform-rendering-macro-context/pom.xml +++ b/xwiki-platform-core/xwiki-platform-rendering/xwiki-platform-rendering-macros/xwiki-platform-rendering-macro-context/pom.xml @@ -69,13 +69,13 @@ test - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api test - org.mortbay.jasper - apache-el + org.glassfish.expressly + expressly test diff --git a/xwiki-platform-core/xwiki-platform-rendering/xwiki-platform-rendering-wikimacro/xwiki-platform-rendering-wikimacro-store/pom.xml b/xwiki-platform-core/xwiki-platform-rendering/xwiki-platform-rendering-wikimacro/xwiki-platform-rendering-wikimacro-store/pom.xml index 5a044eb60947..320dd6c97ab9 100644 --- a/xwiki-platform-core/xwiki-platform-rendering/xwiki-platform-rendering-wikimacro/xwiki-platform-rendering-wikimacro-store/pom.xml +++ b/xwiki-platform-core/xwiki-platform-rendering/xwiki-platform-rendering-wikimacro/xwiki-platform-rendering-wikimacro-store/pom.xml @@ -162,14 +162,8 @@ test - org.mortbay.jasper - apache-el - test - - - - org.jmock - jmock-legacy + org.glassfish.expressly + expressly test diff --git a/xwiki-platform-core/xwiki-platform-rendering/xwiki-platform-rendering-xwiki/pom.xml b/xwiki-platform-core/xwiki-platform-rendering/xwiki-platform-rendering-xwiki/pom.xml index 9027d04b8fdd..9defd0c33e58 100644 --- a/xwiki-platform-core/xwiki-platform-rendering/xwiki-platform-rendering-xwiki/pom.xml +++ b/xwiki-platform-core/xwiki-platform-rendering/xwiki-platform-rendering-xwiki/pom.xml @@ -119,11 +119,6 @@ xwiki-platform-localization-api ${project.version} - diff --git a/xwiki-platform-core/xwiki-platform-resource/xwiki-platform-resource-servlet/pom.xml b/xwiki-platform-core/xwiki-platform-resource/xwiki-platform-resource-servlet/pom.xml index 6f13aa19af27..ecd5364dea3d 100644 --- a/xwiki-platform-core/xwiki-platform-resource/xwiki-platform-resource-servlet/pom.xml +++ b/xwiki-platform-core/xwiki-platform-resource/xwiki-platform-resource-servlet/pom.xml @@ -48,10 +48,11 @@ xwiki-platform-tika-detect ${project.version} - - javax.servlet - javax.servlet-api + + jakarta.servlet + jakarta.servlet-api + org.xwiki.commons diff --git a/xwiki-platform-core/xwiki-platform-resource/xwiki-platform-resource-servlet/src/main/java/org/xwiki/resource/servlet/AbstractServletResourceReferenceHandler.java b/xwiki-platform-core/xwiki-platform-resource/xwiki-platform-resource-servlet/src/main/java/org/xwiki/resource/servlet/AbstractServletResourceReferenceHandler.java index 7cdb6d3004be..374304fa83c4 100644 --- a/xwiki-platform-core/xwiki-platform-resource/xwiki-platform-resource-servlet/src/main/java/org/xwiki/resource/servlet/AbstractServletResourceReferenceHandler.java +++ b/xwiki-platform-core/xwiki-platform-resource/xwiki-platform-resource-servlet/src/main/java/org/xwiki/resource/servlet/AbstractServletResourceReferenceHandler.java @@ -27,9 +27,6 @@ import java.util.Date; import java.util.Objects; -import javax.inject.Inject; -import javax.servlet.http.HttpServletResponse; - import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; import org.apache.http.HttpHeaders; @@ -48,6 +45,9 @@ import org.xwiki.resource.ResourceType; import org.xwiki.tika.internal.TikaUtils; +import jakarta.inject.Inject; +import jakarta.servlet.http.HttpServletResponse; + /** * Base class for {@link ResourceReferenceHandler}s that can handle servlet resource requests. * @@ -122,18 +122,19 @@ private boolean shouldBrowserUseCachedContent(R resourceReference) // If the request contains an "If-Modified-Since" header and the requested resource has not been modified then // return a 304 Not Modified to tell the browser to use its cached version. Request request = this.container.getRequest(); - if (request instanceof ServletRequest - && ((ServletRequest) request).getHttpServletRequest().getHeader("If-Modified-Since") != null - && isResourceCacheable(resourceReference)) - { + if (request instanceof ServletRequest servletRequest + && servletRequest.getJakartaHttpServletRequest().getHeader("If-Modified-Since") != null + && isResourceCacheable(resourceReference)) { // The user probably used F5 to reload the page and the browser checks if there are changes. Response response = this.container.getResponse(); - if (response instanceof ServletResponse) { + if (response instanceof ServletResponse servletResponse) { // Return the 304 Not Modified. - ((ServletResponse) response).getHttpServletResponse().setStatus(HttpServletResponse.SC_NOT_MODIFIED); + servletResponse.getJakartaHttpServletResponse().setStatus(HttpServletResponse.SC_NOT_MODIFIED); + return true; } } + return false; } @@ -169,7 +170,7 @@ private void serveResource(R resourceReference, InputStream rawResourceStream) throws ResourceReferenceHandlerException { InputStream resourceStream = rawResourceStream; - + // Make sure the resource stream supports mark & reset which is needed in order be able to detect the // content type without affecting the stream (Tika may need to read a few bytes from the start of the // stream, in which case it will mark & reset the stream). @@ -189,8 +190,8 @@ private void serveResource(R resourceReference, InputStream rawResourceStream) } /** - * Computes the content type of the resource. By default the content type is inferred by {@link - * TikaUtils#detect(InputStream, String)} based on the resource content and name. + * Computes the content type of the resource. By default the content type is inferred by + * {@link TikaUtils#detect(InputStream, String)} based on the resource content and name. * * @param resourceStream the stream of the requested resource * @param resourceReference the reference of the request resource @@ -198,8 +199,7 @@ private void serveResource(R resourceReference, InputStream rawResourceStream) * @throws IOException in case of error during the content type analysis * @since 13.3RC1 */ - protected String getContentType(InputStream resourceStream, R resourceReference) - throws IOException + protected String getContentType(InputStream resourceStream, R resourceReference) throws IOException { return TikaUtils.detect(resourceStream, getResourceName(resourceReference)); } @@ -228,7 +228,7 @@ private void setResponseHeaders(Response response, R resourceReference) if (!(response instanceof ServletResponse)) { return; } - HttpServletResponse httpResponse = ((ServletResponse) response).getHttpServletResponse(); + HttpServletResponse httpResponse = ((ServletResponse) response).getJakartaHttpServletResponse(); // Cache the resource if possible. if (isResourceCacheable(resourceReference)) { @@ -288,8 +288,9 @@ private void sendError(int statusCode, String message, Object... parameters) throws ResourceReferenceHandlerException { Response response = this.container.getResponse(); - if (response instanceof ServletResponse) { - HttpServletResponse httpResponse = ((ServletResponse) response).getHttpServletResponse(); + if (response instanceof ServletResponse servletResponse) { + HttpServletResponse httpResponse = servletResponse.getJakartaHttpServletResponse(); + try { httpResponse.sendError(statusCode, String.format(message, parameters)); } catch (IOException e) { diff --git a/xwiki-platform-core/xwiki-platform-resource/xwiki-platform-resource-servlet/src/main/java/org/xwiki/resource/servlet/ResourceReferenceHandlerServlet.java b/xwiki-platform-core/xwiki-platform-resource/xwiki-platform-resource-servlet/src/main/java/org/xwiki/resource/servlet/ResourceReferenceHandlerServlet.java index c0b733882a84..00ec33ca78a0 100644 --- a/xwiki-platform-core/xwiki-platform-resource/xwiki-platform-resource-servlet/src/main/java/org/xwiki/resource/servlet/ResourceReferenceHandlerServlet.java +++ b/xwiki-platform-core/xwiki-platform-resource/xwiki-platform-resource-servlet/src/main/java/org/xwiki/resource/servlet/ResourceReferenceHandlerServlet.java @@ -23,11 +23,6 @@ import java.lang.reflect.Type; import java.util.Collections; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - import org.xwiki.component.manager.ComponentLookupException; import org.xwiki.component.manager.ComponentManager; import org.xwiki.component.util.DefaultParameterizedType; @@ -42,14 +37,22 @@ import org.xwiki.resource.ResourceType; import org.xwiki.url.ExtendedURL; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; + /** * Handles any Resource Reference discovered by the Routing Filter and put in the HTTP Request. Any module who wish to * add a new Resource Type in the XWiki URL simply needs to register a Handler component (of role * {@link org.xwiki.resource.ResourceReferenceHandler}) and any URL matching the corresponding {@link ResourceType} will * be handled. + *

+ * While the class is much older, the since annotation was moved to 42.0.0 because it implements a completely + * different API from Java point of view. * * @version $Id$ - * @since 7.1M1 + * @since 42.0.0 */ public class ResourceReferenceHandlerServlet extends HttpServlet { @@ -58,7 +61,7 @@ public class ResourceReferenceHandlerServlet extends HttpServlet */ private static final long serialVersionUID = 1L; - private ComponentManager rootComponentManager; + private transient ComponentManager rootComponentManager; @Override public void init() throws ServletException @@ -136,9 +139,7 @@ private void initializeContainerComponent(HttpServletRequest httpRequest, HttpSe throw new ServletException("Failed to locate a ServletContainerInitializer component", e); } try { - containerInitializer.initializeRequest(httpRequest); - containerInitializer.initializeResponse(httpResponse); - containerInitializer.initializeSession(httpRequest); + containerInitializer.initializeRequest(httpRequest, httpResponse); } catch (ServletContainerException e) { throw new ServletException("Failed to initialize Request/Response or Session", e); } diff --git a/xwiki-platform-core/xwiki-platform-resource/xwiki-platform-resource-servlet/src/main/java/org/xwiki/resource/servlet/RoutingFilter.java b/xwiki-platform-core/xwiki-platform-resource/xwiki-platform-resource-servlet/src/main/java/org/xwiki/resource/servlet/RoutingFilter.java index 96683321275a..b2fa1d1456f2 100644 --- a/xwiki-platform-core/xwiki-platform-resource/xwiki-platform-resource-servlet/src/main/java/org/xwiki/resource/servlet/RoutingFilter.java +++ b/xwiki-platform-core/xwiki-platform-resource/xwiki-platform-resource-servlet/src/main/java/org/xwiki/resource/servlet/RoutingFilter.java @@ -24,14 +24,14 @@ import java.net.URL; import java.util.Collections; -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; import org.apache.commons.lang3.StringUtils; import org.xwiki.component.manager.ComponentLookupException; @@ -46,23 +46,26 @@ /** * Decides how to route an incoming URL into the XWiki system. There are various possibilities: *

    - *
  • If there's a registered component of type {@link org.xwiki.resource.ResourceReferenceHandler} matching the - * {@link ResourceType} passed in the URL (for example when using the {@code standard} URL scheme, the Resource - * Type is the segment path just after the Context Path, i.e. {@code bin} in - * {@code http:///xwiki/bin/view/Space/Page}), then the {@code resourceReferenceHandler} Servlet is - * called to handle it.
  • - *
  • If not, then continue executing the rest of the {@code web.xml} file, thus bridging to the old system, - * including the existing Struts Action Servlet.
  • + *
  • If there's a registered component of type {@link org.xwiki.resource.ResourceReferenceHandler} matching the + * {@link ResourceType} passed in the URL (for example when using the {@code standard} URL scheme, the Resource Type is + * the segment path just after the Context Path, i.e. {@code bin} in {@code http:///xwiki/bin/view/Space/Page}), + * then the {@code resourceReferenceHandler} Servlet is called to handle it.
  • + *
  • If not, then continue executing the rest of the {@code web.xml} file, thus bridging to the old system, including + * the existing Struts Action Servlet.
  • *
* As time progresses it is expected that more and more Resource Types will have registered * {@link org.xwiki.resource.ResourceReferenceHandler}. + *

+ * While the class is much older, the since annotation was moved to 42.0.0 because it implement a completely different + * API from Java point of view. * * @version $Id$ - * @since 7.1M1 + * @since 42.0.0 */ public class RoutingFilter implements Filter { static final String RESOURCE_TYPE_NAME = "resourceType"; + static final String RESOURCE_EXTENDEDURL = "resourceURL"; private ComponentManager rootComponentManager; @@ -169,8 +172,8 @@ private ResourceTypeResolver getResourceTypeResolver() throws Servl { ResourceTypeResolver urlResourceTypeResolver; try { - urlResourceTypeResolver = this.rootComponentManager.getInstance( - new DefaultParameterizedType(null, ResourceTypeResolver.class, ExtendedURL.class)); + urlResourceTypeResolver = this.rootComponentManager + .getInstance(new DefaultParameterizedType(null, ResourceTypeResolver.class, ExtendedURL.class)); } catch (ComponentLookupException e) { // Should not happen since an ExtendedURL Resource Type Resolver should exist on the system. throw new ServletException("Failed to locate an ExtendedURL Resource Type Resolver component", e); @@ -208,7 +211,8 @@ private URL getRequestURL(HttpServletRequest request) throws ServletException // Shouldn't happen normally! throw new ServletException( String.format("Failed to reconstruct URL from HTTP Servlet Request (URL [%s], Query String [%s])", - request.getRequestURL(), request.getQueryString()), e); + request.getRequestURL(), request.getQueryString()), + e); } return url; } diff --git a/xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-jersey/pom.xml b/xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-jersey/pom.xml index 411202419ed7..443b7c5bb5e9 100644 --- a/xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-jersey/pom.xml +++ b/xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-jersey/pom.xml @@ -84,8 +84,13 @@ aopalliance - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api + + + org.xwiki.commons + xwiki-commons-jakartabridge-servlet + ${commons.version} diff --git a/xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-jersey/src/main/java/org/xwiki/rest/jersey/internal/JerseyServletContainer.java b/xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-jersey/src/main/java/org/xwiki/rest/jersey/internal/JerseyServletContainer.java index 630611267ede..aaa994920a13 100644 --- a/xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-jersey/src/main/java/org/xwiki/rest/jersey/internal/JerseyServletContainer.java +++ b/xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-jersey/src/main/java/org/xwiki/rest/jersey/internal/JerseyServletContainer.java @@ -24,28 +24,32 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicInteger; -import javax.inject.Inject; -import javax.inject.Named; -import javax.inject.Singleton; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServlet; - import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.servlet.ServletContainer; import org.xwiki.component.annotation.Component; import org.xwiki.component.descriptor.ComponentDescriptor; import org.xwiki.component.manager.ComponentManager; +import org.xwiki.jakartabridge.servlet.JakartaServletBridge; import org.xwiki.rest.XWikiRestComponent; +import jakarta.inject.Inject; +import jakarta.inject.Named; +import jakarta.inject.Singleton; +import jakarta.servlet.ServletContext; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServlet; + /** * Encapsulate the Jersey {@link ServletContainer} to control it's initialization and reload (when a REST component is * registered/unregistered). + *

+ * While the class is much older, the since annotation was moved to 42.0.0 because it implement a completely different + * API from Java point of view. * * @version $Id$ - * @since 16.2.0RC1 + * @since 42.0.0 */ @Component(roles = JerseyServletContainer.class) @Singleton @@ -66,7 +70,11 @@ public void init() throws ServletException { // Create and initialize the Jersey servlet ServletContainer newContainer = new ServletContainer(createResourceConfig()); - newContainer.init(getServletConfig()); + try { + newContainer.init(JakartaServletBridge.toJavax(getServletConfig())); + } catch (javax.servlet.ServletException e) { + throw new ServletException(e); + } // Remember the previous container ServletContainer previousContainer = this.container; @@ -128,7 +136,9 @@ public void service(ServletRequest req, ServletResponse res) throws ServletExcep try { // Execute the request - this.container.service(req, res); + this.container.service(JakartaServletBridge.toJavax(req), JakartaServletBridge.toJavax(res)); + } catch (javax.servlet.ServletException e) { + throw new ServletException(e); } finally { // Decrement the counter counter.decrementAndGet(); @@ -159,6 +169,6 @@ public void destroy() @Override public ServletContext getServletContext() { - return this.container.getServletContext(); + return JakartaServletBridge.toJakarta(this.container.getServletContext()); } } diff --git a/xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-jersey/src/main/java/org/xwiki/rest/jersey/internal/XWikiRESTServlet.java b/xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-jersey/src/main/java/org/xwiki/rest/jersey/internal/XWikiRESTServlet.java index b433c07cbc31..9051119406c9 100644 --- a/xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-jersey/src/main/java/org/xwiki/rest/jersey/internal/XWikiRESTServlet.java +++ b/xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-jersey/src/main/java/org/xwiki/rest/jersey/internal/XWikiRESTServlet.java @@ -21,25 +21,28 @@ import java.io.IOException; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServlet; - import org.glassfish.jersey.servlet.ServletContainer; import org.glassfish.jersey.servlet.ServletProperties; import org.xwiki.component.manager.ComponentLookupException; import org.xwiki.component.manager.ComponentManager; +import jakarta.servlet.ServletContext; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServlet; + /** * Extends {@link ServletContainer} to add XWiki specific pieces. *

    *
  • Injection of XWikiResource components
  • *
+ *

+ * While the class is much older, the since annotation was moved to 42.0.0 because it implement a completely different + * API from Java point of view. * * @version $Id$ - * @since 16.2.0RC1 + * @since 42.0.0 */ public class XWikiRESTServlet extends HttpServlet { diff --git a/xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-server/pom.xml b/xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-server/pom.xml index 2c6eb9fd608b..26e909739050 100644 --- a/xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-server/pom.xml +++ b/xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-server/pom.xml @@ -129,6 +129,10 @@ javax.servlet javax.servlet-api + + jakarta.servlet + jakarta.servlet-api + org.xwiki.platform diff --git a/xwiki-platform-core/xwiki-platform-scheduler/xwiki-platform-scheduler-api/pom.xml b/xwiki-platform-core/xwiki-platform-scheduler/xwiki-platform-scheduler-api/pom.xml index 81e8b42c14ee..f11f7aca06e7 100644 --- a/xwiki-platform-core/xwiki-platform-scheduler/xwiki-platform-scheduler-api/pom.xml +++ b/xwiki-platform-core/xwiki-platform-scheduler/xwiki-platform-scheduler-api/pom.xml @@ -47,8 +47,8 @@ quartz - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api org.xwiki.platform diff --git a/xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-api/pom.xml b/xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-api/pom.xml index a9eed7936a46..6402cbffada3 100644 --- a/xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-api/pom.xml +++ b/xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-api/pom.xml @@ -134,11 +134,6 @@ ${commons.version} test - - javax.servlet - javax.servlet-api - test - org.xwiki.platform xwiki-platform-test-oldcore diff --git a/xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-authentication/xwiki-platform-security-authentication-api/pom.xml b/xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-authentication/xwiki-platform-security-authentication-api/pom.xml index f9b75b45624d..e39660077517 100644 --- a/xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-authentication/xwiki-platform-security-authentication-api/pom.xml +++ b/xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-authentication/xwiki-platform-security-authentication-api/pom.xml @@ -77,8 +77,13 @@ ${project.version} - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api + + + org.xwiki.commons + xwiki-commons-jakartabridge-servlet + ${commons.version} diff --git a/xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-authentication/xwiki-platform-security-authentication-api/src/main/java/org/xwiki/security/authentication/AuthenticationFailureManager.java b/xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-authentication/xwiki-platform-security-authentication-api/src/main/java/org/xwiki/security/authentication/AuthenticationFailureManager.java index 33318e7dd175..8a3db61c99cd 100644 --- a/xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-authentication/xwiki-platform-security-authentication-api/src/main/java/org/xwiki/security/authentication/AuthenticationFailureManager.java +++ b/xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-authentication/xwiki-platform-security-authentication-api/src/main/java/org/xwiki/security/authentication/AuthenticationFailureManager.java @@ -19,10 +19,12 @@ */ package org.xwiki.security.authentication; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; import org.xwiki.component.annotation.Role; +import org.xwiki.jakartabridge.servlet.JakartaServletBridge; import org.xwiki.model.reference.DocumentReference; +import org.xwiki.stability.Unstable; /** * Manager of the authentication failures strategies. @@ -35,12 +37,33 @@ public interface AuthenticationFailureManager { /** * Record that the given username fails to authenticate. + * * @param username the username that fails the authentication. Should be the username typed by the user and not a - * computed login. + * computed login. * @param request a wrapping of the request used for the authentication. * @return true if the authentication failure limits defined by the configuration has been reached. + * @deprecated use {@link #recordAuthenticationFailure(String, HttpServletRequest)} */ - boolean recordAuthenticationFailure(String username, HttpServletRequest request); + @Deprecated(since = "42.0.0") + default boolean recordAuthenticationFailure(String username, javax.servlet.http.HttpServletRequest request) + { + return recordAuthenticationFailure(username, JakartaServletBridge.toJakarta(request)); + } + + /** + * Record that the given username fails to authenticate. + * + * @param username the username that fails the authentication. Should be the username typed by the user and not a + * computed login. + * @param request a wrapping of the request used for the authentication. + * @return true if the authentication failure limits defined by the configuration has been reached. + * @since 42.0.0 + */ + @Unstable + default boolean recordAuthenticationFailure(String username, HttpServletRequest request) + { + return recordAuthenticationFailure(username, JakartaServletBridge.toJavax(request)); + } /** * Remove all records of authentication failure for the given user. @@ -56,19 +79,62 @@ public interface AuthenticationFailureManager * not a computed login. * @param request a wrapping of the request used for the authentication. * @return the aggregated form information to add to the standard login form, or an empty string. + * @deprecated use {@link #getForm(String, HttpServletRequest)} instead + */ + @Deprecated(since = "42.0.0") + default String getForm(String username, javax.servlet.http.HttpServletRequest request) + { + return getForm(username, JakartaServletBridge.toJakarta(request)); + } + + /** + * If the user reached the authentication failure limit, aggregate form information returned by the different + * strategies (see {@link AuthenticationFailureStrategy#getForm(String)}). Else return an empty string. + * @param username the username that is used for the authentication. Should be the username typed by the user and + * not a computed login. + * @param request a wrapping of the request used for the authentication. + * @return the aggregated form information to add to the standard login form, or an empty string. + * @since 42.0.0 */ - String getForm(String username, HttpServletRequest request); + @Unstable + default String getForm(String username, HttpServletRequest request) + { + return getForm(username, JakartaServletBridge.toJavax(request)); + } /** * If the user reached the authentication failure limit, validate the form information against the different - * strategies used and return the result - * (see {@link AuthenticationFailureStrategy#validateForm(String, HttpServletRequest)}). Else returns true. + * strategies used and return the result (see + * {@link AuthenticationFailureStrategy#validateForm(String, HttpServletRequest)}). Else returns true. + * * @param username the username that is used for the authentication. Should be the username typed by the user and - * not a computed login. + * not a computed login. + * @param request a wrapping of the request used for the authentication. + * @return true if all strategies validate the request or if the user didn't reach the limit. + * @deprecated use {@link #validateForm(String, HttpServletRequest)} instead + */ + @Deprecated(since = "42.0.0") + default boolean validateForm(String username, javax.servlet.http.HttpServletRequest request) + { + return validateForm(username, JakartaServletBridge.toJakarta(request)); + } + + /** + * If the user reached the authentication failure limit, validate the form information against the different + * strategies used and return the result (see + * {@link AuthenticationFailureStrategy#validateForm(String, HttpServletRequest)}). Else returns true. + * + * @param username the username that is used for the authentication. Should be the username typed by the user and + * not a computed login. * @param request a wrapping of the request used for the authentication. * @return true if all strategies validate the request or if the user didn't reach the limit. + * @since 42.0.0 */ - boolean validateForm(String username, HttpServletRequest request); + @Unstable + default boolean validateForm(String username, HttpServletRequest request) + { + return validateForm(username, JakartaServletBridge.toJavax(request)); + } /** * If the user reached the authentication failure limit, aggregate the error message of the different strategies diff --git a/xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-authentication/xwiki-platform-security-authentication-api/src/main/java/org/xwiki/security/authentication/AuthenticationFailureStrategy.java b/xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-authentication/xwiki-platform-security-authentication-api/src/main/java/org/xwiki/security/authentication/AuthenticationFailureStrategy.java index a57f5b319fba..1abca3995d49 100644 --- a/xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-authentication/xwiki-platform-security-authentication-api/src/main/java/org/xwiki/security/authentication/AuthenticationFailureStrategy.java +++ b/xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-authentication/xwiki-platform-security-authentication-api/src/main/java/org/xwiki/security/authentication/AuthenticationFailureStrategy.java @@ -19,9 +19,11 @@ */ package org.xwiki.security.authentication; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; import org.xwiki.component.annotation.Role; +import org.xwiki.jakartabridge.servlet.JakartaServletBridge; +import org.xwiki.stability.Unstable; /** * Describes a strategy to perform in case the limit of authentication failures is reached. @@ -57,8 +59,25 @@ public interface AuthenticationFailureStrategy * @param username the username used for the authentication failure. * @param request the authentication request. * @return true if the authentication request can be validated, i.e. if the user should be authorized to login. + * @deprecated use {@link #validateForm(String, HttpServletRequest)} instead */ - boolean validateForm(String username, HttpServletRequest request); + @Deprecated(since = "42.0.0") + default boolean validateForm(String username, javax.servlet.http.HttpServletRequest request) + { + return validateForm(username, JakartaServletBridge.toJakarta(request)); + } + + /** + * @param username the username used for the authentication failure. + * @param request the authentication request. + * @return true if the authentication request can be validated, i.e. if the user should be authorized to login. + * @since 42.0.0 + */ + @Unstable + default boolean validateForm(String username, HttpServletRequest request) + { + return validateForm(username, JakartaServletBridge.toJavax(request)); + } /** * Notify the strategy about an authentication failure limit reached. diff --git a/xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-authentication/xwiki-platform-security-authentication-default/pom.xml b/xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-authentication/xwiki-platform-security-authentication-default/pom.xml index 1c88419398d4..3588219f20d2 100644 --- a/xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-authentication/xwiki-platform-security-authentication-default/pom.xml +++ b/xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-authentication/xwiki-platform-security-authentication-default/pom.xml @@ -31,7 +31,7 @@ Default implementation of the Authentication API ${basedir}/src/checkstyle/checkstyle-suppressions.xml - 0.80 + 0.79 Authentication API Implementation @@ -78,8 +78,8 @@ ${project.version} - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api diff --git a/xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-authentication/xwiki-platform-security-authentication-default/src/main/java/org/xwiki/security/authentication/internal/CaptchaAuthenticationFailureStrategy.java b/xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-authentication/xwiki-platform-security-authentication-default/src/main/java/org/xwiki/security/authentication/internal/CaptchaAuthenticationFailureStrategy.java index 965a00579ce7..0aa393e1cb94 100644 --- a/xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-authentication/xwiki-platform-security-authentication-default/src/main/java/org/xwiki/security/authentication/internal/CaptchaAuthenticationFailureStrategy.java +++ b/xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-authentication/xwiki-platform-security-authentication-default/src/main/java/org/xwiki/security/authentication/internal/CaptchaAuthenticationFailureStrategy.java @@ -25,7 +25,6 @@ import javax.inject.Inject; import javax.inject.Named; import javax.inject.Singleton; -import javax.servlet.http.HttpServletRequest; import org.apache.commons.lang3.exception.ExceptionUtils; import org.slf4j.Logger; @@ -38,10 +37,11 @@ import org.xwiki.localization.ContextualLocalizationManager; import org.xwiki.security.authentication.AuthenticationFailureStrategy; +import jakarta.servlet.http.HttpServletRequest; + /** - * Captcha Strategy for repeated authentication failures. - * The main idea of this strategy is to add a captcha form field in the login form and to ask user to fill it for - * validating their authentication. + * Captcha Strategy for repeated authentication failures. The main idea of this strategy is to add a captcha form field + * in the login form and to ask user to fill it for validating their authentication. * * @version $Id$ * @since 11.6RC1 @@ -54,8 +54,8 @@ public class CaptchaAuthenticationFailureStrategy implements AuthenticationFailu /** * Exception message thrown by jCaptcha library when no captcha is registered for the session id. */ - private static final String UNEXISTING_CAPTCHA_EXCEPTION = "Invalid ID, could not validate unexisting or already " - + "validated captcha"; + private static final String UNEXISTING_CAPTCHA_EXCEPTION = + "Invalid ID, could not validate unexisting or already " + "validated captcha"; @Inject private CaptchaConfiguration captchaConfiguration; diff --git a/xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-authentication/xwiki-platform-security-authentication-default/src/main/java/org/xwiki/security/authentication/internal/DefaultAuthenticationFailureManager.java b/xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-authentication/xwiki-platform-security-authentication-default/src/main/java/org/xwiki/security/authentication/internal/DefaultAuthenticationFailureManager.java index 2a8359b30f68..5e055761601d 100644 --- a/xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-authentication/xwiki-platform-security-authentication-default/src/main/java/org/xwiki/security/authentication/internal/DefaultAuthenticationFailureManager.java +++ b/xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-authentication/xwiki-platform-security-authentication-default/src/main/java/org/xwiki/security/authentication/internal/DefaultAuthenticationFailureManager.java @@ -32,7 +32,6 @@ import javax.inject.Named; import javax.inject.Provider; import javax.inject.Singleton; -import javax.servlet.http.HttpServletRequest; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; @@ -58,6 +57,8 @@ import com.xpn.xwiki.XWikiContext; import com.xpn.xwiki.user.api.XWikiUser; +import jakarta.servlet.http.HttpServletRequest; + /** * Default implementation for {@link AuthenticationFailureManager}. * @@ -134,8 +135,8 @@ private void buildStrategyList() this.failureStrategyList = new LinkedList<>(); for (String failureStrategyName : this.failureStrategyNames) { try { - this.failureStrategyList.add(this.componentManager.getInstance(AuthenticationFailureStrategy.class, - failureStrategyName)); + this.failureStrategyList + .add(this.componentManager.getInstance(AuthenticationFailureStrategy.class, failureStrategyName)); } catch (ComponentLookupException e) { logger.error("Error while getting authentication failure strategy [{}]. ", failureStrategyName, e); } @@ -156,9 +157,7 @@ private boolean isAuthenticationSecurityEnabled() { // historically the feature was considered as disabled if max attempts = 0, max time = 0 or the strategy list // was empty. We keep that as possible way to say it's disabled. - return configuration.isAuthenticationSecurityEnabled() - && getMaxNbAttempts() != 0 - && getMaxTime() != 0 + return configuration.isAuthenticationSecurityEnabled() && getMaxNbAttempts() != 0 && getMaxTime() != 0 && !getFailureStrategyList().isEmpty(); } @@ -169,9 +168,9 @@ private void clearRecords() } /** - * Determine which username we should skip. - * We don't handle empty usernames to avoid triggering the security mechanism for nothing and having unexpected - * behaviours. + * Determine which username we should skip. We don't handle empty usernames to avoid triggering the security + * mechanism for nothing and having unexpected behaviours. + * * @param username the username to check. * @return {@code true} if the username is empty. */ @@ -350,14 +349,14 @@ private int getMaxNbAttempts() } /** - * This class aims at storing the authentication failure record information about a login. - * It only stores the first failing date and the number of failing attempts since then. - * Those two are resetted if another failure happens outside of the given time window. - * (See {@link AuthenticationConfiguration#getTimeWindow()}) + * This class aims at storing the authentication failure record information about a login. It only stores the first + * failing date and the number of failing attempts since then. Those two are resetted if another failure happens + * outside of the given time window. (See {@link AuthenticationConfiguration#getTimeWindow()}) */ class AuthFailureRecord { private long firstFailingDate; + private int nbAttempts; AuthFailureRecord() @@ -374,12 +373,12 @@ void incrementAttemptOrReset() this.firstFailingDate = new Date().getTime(); this.nbAttempts++; - // If the threshold not reached yet and we're out of the time window, we can reset the data. + // If the threshold not reached yet and we're out of the time window, we can reset the data. } else if (firstFailingDate + getMaxTime() < new Date().getTime()) { this.firstFailingDate = new Date().getTime(); this.nbAttempts = 1; - // Else the threshold not reached but we are in the time window: we increment the number of attempts. + // Else the threshold not reached but we are in the time window: we increment the number of attempts. } else { this.nbAttempts++; } diff --git a/xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-authentication/xwiki-platform-security-authentication-default/src/main/java/org/xwiki/security/authentication/internal/DisableAccountFailureStrategy.java b/xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-authentication/xwiki-platform-security-authentication-default/src/main/java/org/xwiki/security/authentication/internal/DisableAccountFailureStrategy.java index 38cff2df7285..1e71b99a025a 100644 --- a/xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-authentication/xwiki-platform-security-authentication-default/src/main/java/org/xwiki/security/authentication/internal/DisableAccountFailureStrategy.java +++ b/xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-authentication/xwiki-platform-security-authentication-default/src/main/java/org/xwiki/security/authentication/internal/DisableAccountFailureStrategy.java @@ -26,7 +26,6 @@ import javax.inject.Named; import javax.inject.Provider; import javax.inject.Singleton; -import javax.servlet.http.HttpServletRequest; import org.xwiki.bridge.event.DocumentUpdatedEvent; import org.xwiki.component.annotation.Component; @@ -45,6 +44,8 @@ import com.xpn.xwiki.objects.BaseObject; import com.xpn.xwiki.user.api.XWikiUser; +import jakarta.servlet.http.HttpServletRequest; + /** * A strategy to disable authentication in case of repeated failure with a login. *

@@ -109,6 +110,7 @@ public boolean validateForm(String username, HttpServletRequest request) if (userDocumentReference != null) { return !new XWikiUser(userDocumentReference).isDisabled(this.contextProvider.get()); } + return false; } diff --git a/xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-authentication/xwiki-platform-security-authentication-default/src/test/java/org/xwiki/security/authentication/internal/DefaultAuthenticationFailureManagerTest.java b/xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-authentication/xwiki-platform-security-authentication-default/src/test/java/org/xwiki/security/authentication/internal/DefaultAuthenticationFailureManagerTest.java index c37fed206dd5..22d4e5972686 100644 --- a/xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-authentication/xwiki-platform-security-authentication-default/src/test/java/org/xwiki/security/authentication/internal/DefaultAuthenticationFailureManagerTest.java +++ b/xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-authentication/xwiki-platform-security-authentication-default/src/test/java/org/xwiki/security/authentication/internal/DefaultAuthenticationFailureManagerTest.java @@ -25,8 +25,8 @@ import javax.inject.Named; import javax.inject.Provider; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpSession; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpSession; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -74,7 +74,7 @@ * @since 11.6RC1 */ @ComponentTest -public class DefaultAuthenticationFailureManagerTest +class DefaultAuthenticationFailureManagerTest { @InjectMockComponents private DefaultAuthenticationFailureManager defaultAuthenticationFailureManager; @@ -163,7 +163,7 @@ private HttpServletRequest getRequest(String sessionId) * Ensure that a AuthenticationFailureEvent is triggered. */ @Test - public void authenticationFailureIsTriggered() + void authenticationFailureIsTriggered() { assertFalse(this.defaultAuthenticationFailureManager.recordAuthenticationFailure(this.failingLogin, getRequest("something"))); @@ -234,7 +234,7 @@ void authenticationFailureEmptyLogin() * Ensure that the time window configuration is taken into account properly. */ @Test - public void repeatedAuthenticationFailureOutOfTimeWindow() throws InterruptedException + void repeatedAuthenticationFailureOutOfTimeWindow() throws InterruptedException { HttpServletRequest request = getRequest("anotherId"); when(configuration.getTimeWindow()).thenReturn(1); @@ -258,7 +258,7 @@ public void repeatedAuthenticationFailureOutOfTimeWindow() throws InterruptedExc * Ensure that the max attempt configuration is taken into account properly. */ @Test - public void repeatedAuthenticationFailureDifferentThreshold() + void repeatedAuthenticationFailureDifferentThreshold() { HttpServletRequest request = getRequest("foobar"); when(configuration.getMaxAuthorizedAttempts()).thenReturn(5); @@ -281,7 +281,7 @@ public void repeatedAuthenticationFailureDifferentThreshold() * Ensure that the failure record reset is working properly. */ @Test - public void resetAuthFailureRecord() + void resetAuthFailureRecord() { HttpServletRequest request = getRequest("reset"); assertFalse(this.defaultAuthenticationFailureManager.recordAuthenticationFailure(this.failingLogin, request)); @@ -304,7 +304,7 @@ public void resetAuthFailureRecord() * Ensure that the failure record reset is working properly. */ @Test - public void resetAuthFailureRecordWithDocumentReference() + void resetAuthFailureRecordWithDocumentReference() { HttpServletRequest request = getRequest("reset2"); assertFalse(this.defaultAuthenticationFailureManager.recordAuthenticationFailure(this.failingLogin, request)); @@ -327,7 +327,7 @@ public void resetAuthFailureRecordWithDocumentReference() * Ensure that the threshold mechanism works properly with different login. */ @Test - public void recordAuthFailureDifferentLogin() + void recordAuthFailureDifferentLogin() { HttpServletRequest request = getRequest("multilogin"); String login1 = this.failingLogin.toLowerCase(); @@ -390,7 +390,7 @@ void recordAuthenticationFailureWithFailingSession() * Ensure that the authentication threshold auth is deactivated if max attempt is set to 0 */ @Test - public void deactivateThresholdAuthWithMaxAttempt() + void deactivateThresholdAuthWithMaxAttempt() { HttpServletRequest request = getRequest("manyattempt"); when(this.configuration.getMaxAuthorizedAttempts()).thenReturn(0); @@ -410,7 +410,7 @@ public void deactivateThresholdAuthWithMaxAttempt() * Ensure that the authentication threshold auth is deactivated if time window is set to 0 */ @Test - public void deactivateThresholdAuthWithTimeWindow() + void deactivateThresholdAuthWithTimeWindow() { HttpServletRequest request = getRequest("manyattempt2"); when(this.configuration.getTimeWindow()).thenReturn(0); @@ -430,7 +430,7 @@ public void deactivateThresholdAuthWithTimeWindow() * Validate that getForm is working properly. */ @Test - public void getForm() + void getForm() { HttpServletRequest request = getRequest("getForm"); String formStrategy1 = "formStrategy1"; @@ -468,7 +468,7 @@ void getFormFailingSession() * Validate that getErrorMessages is working properly. */ @Test - public void getErrorMessages() + void getErrorMessages() { HttpServletRequest request = getRequest("errorMsg"); String errorMessage1 = "errorMessage1"; @@ -489,7 +489,7 @@ public void getErrorMessages() * Validate that getForm is working properly. */ @Test - public void validateForm() + void validateForm() { HttpServletRequest request = getRequest("validate"); String login1 = this.failingLogin; @@ -506,13 +506,13 @@ public void validateForm() this.defaultAuthenticationFailureManager.recordAuthenticationFailure(login2, request); this.defaultAuthenticationFailureManager.recordAuthenticationFailure(login2, request); - when(this.strategy1.validateForm(login1, null)).thenReturn(true); - when(this.strategy2.validateForm(login1, null)).thenReturn(true); - assertTrue(this.defaultAuthenticationFailureManager.validateForm(login1, null)); + when(this.strategy1.validateForm(login1, (HttpServletRequest) null)).thenReturn(true); + when(this.strategy2.validateForm(login1, (HttpServletRequest) null)).thenReturn(true); + assertTrue(this.defaultAuthenticationFailureManager.validateForm(login1, (HttpServletRequest) null)); - when(this.strategy1.validateForm(login2, null)).thenReturn(true); - when(this.strategy2.validateForm(login2, null)).thenReturn(false); - assertFalse(this.defaultAuthenticationFailureManager.validateForm(login2, null)); + when(this.strategy1.validateForm(login2, (HttpServletRequest) null)).thenReturn(true); + when(this.strategy2.validateForm(login2, (HttpServletRequest) null)).thenReturn(false); + assertFalse(this.defaultAuthenticationFailureManager.validateForm(login2, (HttpServletRequest) null)); } @Test @@ -531,7 +531,7 @@ void validateFormFailingSession() * Validate that getUser is working properly. */ @Test - public void getUserNotFound() throws XWikiException + void getUserNotFound() throws XWikiException { when(context.getMainXWiki()).thenReturn("mainwiki"); when(context.getWikiId()).thenReturn("currentwiki"); @@ -553,7 +553,7 @@ public void getUserNotFound() throws XWikiException * Validate that getUser is working properly. */ @Test - public void getUserGlobalFound() throws XWikiException + void getUserGlobalFound() throws XWikiException { when(context.getMainXWiki()).thenReturn("mainwiki"); DocumentReference globalReference = new DocumentReference("mainwiki", "XWiki", "foo"); @@ -575,7 +575,7 @@ public void getUserGlobalFound() throws XWikiException * Validate that getUser is working properly. */ @Test - public void getUserLocalFound() throws XWikiException + void getUserLocalFound() throws XWikiException { when(context.getMainXWiki()).thenReturn("mainwiki"); when(context.getWikiId()).thenReturn("currentwiki"); @@ -597,7 +597,7 @@ public void getUserLocalFound() throws XWikiException } @Test - public void strategiesAreRebuildInCaseOfReset() + void strategiesAreRebuildInCaseOfReset() { HttpServletRequest request = getRequest("reset"); when(configuration.getFailureStrategies()).thenReturn(new String[] { "strategy1" }); diff --git a/xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-authentication/xwiki-platform-security-authentication-default/src/test/java/org/xwiki/security/authentication/internal/DisableAccountFailureStrategyTest.java b/xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-authentication/xwiki-platform-security-authentication-default/src/test/java/org/xwiki/security/authentication/internal/DisableAccountFailureStrategyTest.java index f5cabc1afc92..d033d8b7638f 100644 --- a/xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-authentication/xwiki-platform-security-authentication-default/src/test/java/org/xwiki/security/authentication/internal/DisableAccountFailureStrategyTest.java +++ b/xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-authentication/xwiki-platform-security-authentication-default/src/test/java/org/xwiki/security/authentication/internal/DisableAccountFailureStrategyTest.java @@ -19,6 +19,12 @@ */ package org.xwiki.security.authentication.internal; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + import javax.inject.Provider; import org.junit.jupiter.api.BeforeEach; @@ -32,16 +38,9 @@ import org.xwiki.test.junit5.mockito.InjectMockComponents; import org.xwiki.test.junit5.mockito.MockComponent; -import com.xpn.xwiki.XWikiException; import com.xpn.xwiki.doc.XWikiDocument; import com.xpn.xwiki.objects.BaseObject; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - /** * Unit tests for {@link DisableAccountFailureStrategy}. * @@ -49,7 +48,7 @@ * @since 11.8RC1 */ @ComponentTest -public class DisableAccountFailureStrategyTest +class DisableAccountFailureStrategyTest { @InjectMockComponents(role = AuthenticationFailureStrategy.class) private DisableAccountFailureStrategy disableStrategy; @@ -61,7 +60,7 @@ public class DisableAccountFailureStrategyTest private XWikiDocument updatedDocument; @BeforeEach - public void configure() throws XWikiException + public void configure() { DocumentReference documentReference = new DocumentReference("test", "Some", "Page"); @@ -81,7 +80,7 @@ public void configure() throws XWikiException } @Test - public void resetAuthenticationFailureCounterWhenAccountIsActivated() + void resetAuthenticationFailureCounterWhenAccountIsActivated() { when(this.updatedDocument.getOriginalDocument().getXObject(DisableAccountFailureStrategy.USER_CLASS_REFERENCE) .getIntValue("active")).thenReturn(0); @@ -95,7 +94,7 @@ public void resetAuthenticationFailureCounterWhenAccountIsActivated() } @Test - public void dontResetAuthenticationFailureCounterWhenAccountRemainsInactive() + void dontResetAuthenticationFailureCounterWhenAccountRemainsInactive() { when(this.updatedDocument.getOriginalDocument().getXObject(DisableAccountFailureStrategy.USER_CLASS_REFERENCE) .getIntValue("active")).thenReturn(0); @@ -109,7 +108,7 @@ public void dontResetAuthenticationFailureCounterWhenAccountRemainsInactive() } @Test - public void dontResetAuthenticationFailureCounterWhenAccountRemainsActive() + void dontResetAuthenticationFailureCounterWhenAccountRemainsActive() { when(this.updatedDocument.getOriginalDocument().getXObject(DisableAccountFailureStrategy.USER_CLASS_REFERENCE) .getIntValue("active")).thenReturn(1); @@ -123,7 +122,7 @@ public void dontResetAuthenticationFailureCounterWhenAccountRemainsActive() } @Test - public void dontResetAuthenticationFailureCounterWhenAccountIsDeactivated() + void dontResetAuthenticationFailureCounterWhenAccountIsDeactivated() { when(this.updatedDocument.getOriginalDocument().getXObject(DisableAccountFailureStrategy.USER_CLASS_REFERENCE) .getIntValue("active")).thenReturn(1); @@ -137,7 +136,7 @@ public void dontResetAuthenticationFailureCounterWhenAccountIsDeactivated() } @Test - public void onDocumentUpdatedNoUserAccount() + void onDocumentUpdatedNoUserAccount() { when(this.updatedDocument.getXObject(DisableAccountFailureStrategy.USER_CLASS_REFERENCE)).thenReturn(null); @@ -147,7 +146,7 @@ public void onDocumentUpdatedNoUserAccount() } @Test - public void onDocumentUpdatedNoUserAccountStateChange() + void onDocumentUpdatedNoUserAccountStateChange() { disableStrategy.onEvent(new DocumentUpdatedEvent(), updatedDocument, null); @@ -155,8 +154,8 @@ public void onDocumentUpdatedNoUserAccountStateChange() } @Test - public void validateFormReturnsFalseWhenUserNotFound() + void validateFormReturnsFalseWhenUserNotFound() { - assertFalse(this.disableStrategy.validateForm("Foo", null)); + assertFalse(this.disableStrategy.validateForm("Foo", (javax.servlet.http.HttpServletRequest) null)); } } diff --git a/xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-authentication/xwiki-platform-security-authentication-script/pom.xml b/xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-authentication/xwiki-platform-security-authentication-script/pom.xml index 2e032bacadea..4b301589bb90 100644 --- a/xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-authentication/xwiki-platform-security-authentication-script/pom.xml +++ b/xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-authentication/xwiki-platform-security-authentication-script/pom.xml @@ -62,8 +62,8 @@ test - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api diff --git a/xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-requiredrights/xwiki-platform-security-requiredrights-default/pom.xml b/xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-requiredrights/xwiki-platform-security-requiredrights-default/pom.xml index 6c60a6806f02..546c719dec72 100644 --- a/xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-requiredrights/xwiki-platform-security-requiredrights-default/pom.xml +++ b/xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-requiredrights/xwiki-platform-security-requiredrights-default/pom.xml @@ -57,6 +57,8 @@ xwiki-platform-rendering-macro-script ${project.version} + + org.xwiki.platform xwiki-platform-test-oldcore diff --git a/xwiki-platform-core/xwiki-platform-skin/xwiki-platform-skin-skinx/pom.xml b/xwiki-platform-core/xwiki-platform-skin/xwiki-platform-skin-skinx/pom.xml index 1c9dca5f33c7..cfb10995cf18 100644 --- a/xwiki-platform-core/xwiki-platform-skin/xwiki-platform-skin-skinx/pom.xml +++ b/xwiki-platform-core/xwiki-platform-skin/xwiki-platform-skin-skinx/pom.xml @@ -41,8 +41,8 @@ aspectjrt - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api org.xwiki.platform diff --git a/xwiki-platform-core/xwiki-platform-store/xwiki-platform-store-filesystem-oldcore/pom.xml b/xwiki-platform-core/xwiki-platform-store/xwiki-platform-store-filesystem-oldcore/pom.xml index b532e9ffc9ad..83d1bdb417da 100644 --- a/xwiki-platform-core/xwiki-platform-store/xwiki-platform-store-filesystem-oldcore/pom.xml +++ b/xwiki-platform-core/xwiki-platform-store/xwiki-platform-store-filesystem-oldcore/pom.xml @@ -99,8 +99,8 @@ ${commons.version} - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api org.xwiki.platform diff --git a/xwiki-platform-core/xwiki-platform-store/xwiki-platform-store-filesystem-oldcore/src/main/java/org/xwiki/store/filesystem/internal/DefaultTemporaryAttachmentSessionsManager.java b/xwiki-platform-core/xwiki-platform-store/xwiki-platform-store-filesystem-oldcore/src/main/java/org/xwiki/store/filesystem/internal/DefaultTemporaryAttachmentSessionsManager.java index 2279a858b089..3619ed1e139c 100644 --- a/xwiki-platform-core/xwiki-platform-store/xwiki-platform-store-filesystem-oldcore/src/main/java/org/xwiki/store/filesystem/internal/DefaultTemporaryAttachmentSessionsManager.java +++ b/xwiki-platform-core/xwiki-platform-store/xwiki-platform-store-filesystem-oldcore/src/main/java/org/xwiki/store/filesystem/internal/DefaultTemporaryAttachmentSessionsManager.java @@ -27,15 +27,15 @@ import javax.inject.Inject; import javax.inject.Provider; import javax.inject.Singleton; -import javax.servlet.http.HttpSession; -import javax.servlet.http.Part; import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; import org.xwiki.attachment.validation.AttachmentValidationException; import org.xwiki.attachment.validation.AttachmentValidator; import org.xwiki.component.annotation.Component; +import org.xwiki.container.Container; +import org.xwiki.container.servlet.ServletSession; import org.xwiki.internal.attachment.XWikiAttachmentAccessWrapper; +import org.xwiki.jakartabridge.servlet.JakartaServletBridge; import org.xwiki.model.reference.DocumentReference; import org.xwiki.store.TemporaryAttachmentException; import org.xwiki.store.TemporaryAttachmentSessionsManager; @@ -44,6 +44,9 @@ import com.xpn.xwiki.doc.XWikiAttachment; import com.xpn.xwiki.doc.XWikiDocument; +import jakarta.servlet.http.HttpSession; +import jakarta.servlet.http.Part; + /** * Default implementation of {@link TemporaryAttachmentSessionsManager}. * @@ -63,12 +66,11 @@ public class DefaultTemporaryAttachmentSessionsManager implements TemporaryAttac private Provider attachmentValidator; @Inject - private Logger logger; + private Provider container; private HttpSession getSession() { - XWikiContext context = this.contextProvider.get(); - return context.getRequest().getSession(); + return ((ServletSession) this.container.get().getSession()).getJakartaHttpSession(); } private TemporaryAttachmentSession getOrCreateSession() @@ -90,6 +92,14 @@ public XWikiAttachment uploadAttachment(DocumentReference documentReference, Par return uploadAttachment(documentReference, part, null); } + @Override + @Deprecated + public XWikiAttachment uploadAttachment(DocumentReference documentReference, javax.servlet.http.Part part, + String filename) throws TemporaryAttachmentException, AttachmentValidationException + { + return uploadAttachment(documentReference, JakartaServletBridge.toJakarta(part), filename); + } + @Override public XWikiAttachment uploadAttachment(DocumentReference documentReference, Part part, String filename) throws TemporaryAttachmentException, AttachmentValidationException @@ -107,7 +117,7 @@ public XWikiAttachment uploadAttachment(DocumentReference documentReference, Par xWikiAttachment.setFilename(actualFilename); xWikiAttachment.setContent(part.getInputStream()); xWikiAttachment.setAuthorReference(context.getUserReference()); - // Initialize an empty document with the right document reference and locale. We don't set the actual + // Initialize an empty document with the right document reference and locale. We don't set the actual // document since it's a temporary attachment, but it is still useful to have a minimal knowledge of the // document it is stored for. xWikiAttachment.setDoc(new XWikiDocument(documentReference, documentReference.getLocale()), false); diff --git a/xwiki-platform-core/xwiki-platform-store/xwiki-platform-store-filesystem-oldcore/src/test/java/org/xwiki/store/filesystem/internal/DefaultTemporaryAttachmentSessionsManagerTest.java b/xwiki-platform-core/xwiki-platform-store/xwiki-platform-store-filesystem-oldcore/src/test/java/org/xwiki/store/filesystem/internal/DefaultTemporaryAttachmentSessionsManagerTest.java index dbc7d1d46da8..2b1e5152d669 100644 --- a/xwiki-platform-core/xwiki-platform-store/xwiki-platform-store-filesystem-oldcore/src/test/java/org/xwiki/store/filesystem/internal/DefaultTemporaryAttachmentSessionsManagerTest.java +++ b/xwiki-platform-core/xwiki-platform-store/xwiki-platform-store-filesystem-oldcore/src/test/java/org/xwiki/store/filesystem/internal/DefaultTemporaryAttachmentSessionsManagerTest.java @@ -19,8 +19,23 @@ */ package org.xwiki.store.filesystem.internal; +import static com.xpn.xwiki.plugin.fileupload.FileUploadPlugin.UPLOAD_MAXSIZE_PARAMETER; +import static java.nio.charset.StandardCharsets.UTF_8; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.doAnswer; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoInteractions; +import static org.mockito.Mockito.when; + import java.io.ByteArrayInputStream; -import java.io.File; import java.io.InputStream; import java.util.Arrays; import java.util.Collections; @@ -28,7 +43,6 @@ import java.util.Optional; import javax.inject.Provider; -import javax.servlet.http.HttpSession; import javax.servlet.http.Part; import org.junit.jupiter.api.BeforeEach; @@ -39,11 +53,13 @@ import org.mockito.Mock; import org.xwiki.attachment.validation.AttachmentValidationException; import org.xwiki.attachment.validation.AttachmentValidator; -import org.xwiki.environment.Environment; +import org.xwiki.container.Container; +import org.xwiki.container.servlet.ServletSession; import org.xwiki.model.reference.DocumentReference; import org.xwiki.model.reference.SpaceReference; import org.xwiki.store.TemporaryAttachmentException; -import org.xwiki.test.junit5.XWikiTempDir; +import org.xwiki.test.TestEnvironment; +import org.xwiki.test.annotation.ComponentList; import org.xwiki.test.junit5.mockito.ComponentTest; import org.xwiki.test.junit5.mockito.InjectMockComponents; import org.xwiki.test.junit5.mockito.MockComponent; @@ -54,23 +70,8 @@ import com.xpn.xwiki.doc.XWikiAttachment; import com.xpn.xwiki.doc.XWikiDocument; import com.xpn.xwiki.web.Utils; -import com.xpn.xwiki.web.XWikiRequest; -import static com.xpn.xwiki.plugin.fileupload.FileUploadPlugin.UPLOAD_MAXSIZE_PARAMETER; -import static java.nio.charset.StandardCharsets.UTF_8; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.doAnswer; -import static org.mockito.Mockito.doThrow; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoInteractions; -import static org.mockito.Mockito.when; +import jakarta.servlet.http.HttpSession; /** * Tests for {@link DefaultTemporaryAttachmentSessionsManager}. @@ -79,6 +80,7 @@ * @since 14.3RC1 */ @ComponentTest +@ComponentList(TestEnvironment.class) class DefaultTemporaryAttachmentSessionsManagerTest { private static final String ATTRIBUTE_KEY = "xwikiTemporaryAttachments"; @@ -92,12 +94,12 @@ class DefaultTemporaryAttachmentSessionsManagerTest @MockComponent private Provider attachmentValidatorProvider; + @MockComponent + private Container container; + @Mock private AttachmentValidator attachmentValidator; - @XWikiTempDir - private File tmpDir; - @Mock private XWikiContext context; @@ -109,14 +111,11 @@ void setup(MockitoComponentManager mockitoComponentManager) throws Exception { when(this.contextProvider.get()).thenReturn(this.context); - XWikiRequest xWikiRequest = mock(XWikiRequest.class); - when(xWikiRequest.getSession()).thenReturn(this.httpSession); - when(this.context.getRequest()).thenReturn(xWikiRequest); + ServletSession session = mock(ServletSession.class); + when(session.getJakartaHttpSession()).thenReturn(this.httpSession); + when(this.container.getSession()).thenReturn(session); Utils.setComponentManager(mockitoComponentManager); - Environment environment = mockitoComponentManager.registerMockComponent(Environment.class); - when(environment.getTemporaryDirectory()).thenReturn(this.tmpDir); - when(this.attachmentValidatorProvider.get()).thenReturn(this.attachmentValidator); } diff --git a/xwiki-platform-core/xwiki-platform-tag/xwiki-platform-tag-api/pom.xml b/xwiki-platform-core/xwiki-platform-tag/xwiki-platform-tag-api/pom.xml index 4d36872825d0..b3968809f62f 100644 --- a/xwiki-platform-core/xwiki-platform-tag/xwiki-platform-tag-api/pom.xml +++ b/xwiki-platform-core/xwiki-platform-tag/xwiki-platform-tag-api/pom.xml @@ -65,10 +65,5 @@ ${commons.version} test - - javax.servlet - javax.servlet-api - test - diff --git a/xwiki-platform-core/xwiki-platform-test/xwiki-platform-test-docker/pom.xml b/xwiki-platform-core/xwiki-platform-test/xwiki-platform-test-docker/pom.xml index e63f99f4d730..93e6cb5581b6 100644 --- a/xwiki-platform-core/xwiki-platform-test/xwiki-platform-test-docker/pom.xml +++ b/xwiki-platform-core/xwiki-platform-test/xwiki-platform-test-docker/pom.xml @@ -165,8 +165,8 @@ commons-httpclient - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api compile diff --git a/xwiki-platform-core/xwiki-platform-test/xwiki-platform-test-integration/pom.xml b/xwiki-platform-core/xwiki-platform-test/xwiki-platform-test-integration/pom.xml index 5b2ce822e5c0..3d71d348f415 100644 --- a/xwiki-platform-core/xwiki-platform-test/xwiki-platform-test-integration/pom.xml +++ b/xwiki-platform-core/xwiki-platform-test/xwiki-platform-test-integration/pom.xml @@ -79,8 +79,8 @@ - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api org.xwiki.platform diff --git a/xwiki-platform-core/xwiki-platform-test/xwiki-platform-test-oldcore/pom.xml b/xwiki-platform-core/xwiki-platform-test/xwiki-platform-test-oldcore/pom.xml index 06e98a4ffea1..b7eb2559d4d2 100644 --- a/xwiki-platform-core/xwiki-platform-test/xwiki-platform-test-oldcore/pom.xml +++ b/xwiki-platform-core/xwiki-platform-test/xwiki-platform-test-oldcore/pom.xml @@ -49,15 +49,15 @@ test-jar - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api compile - + - org.mortbay.jasper - apache-el + org.glassfish.expressly + expressly runtime diff --git a/xwiki-platform-core/xwiki-platform-test/xwiki-platform-test-page/pom.xml b/xwiki-platform-core/xwiki-platform-test/xwiki-platform-test-page/pom.xml index f1cb85aab56b..e589a5b30b99 100644 --- a/xwiki-platform-core/xwiki-platform-test/xwiki-platform-test-page/pom.xml +++ b/xwiki-platform-core/xwiki-platform-test/xwiki-platform-test-page/pom.xml @@ -108,6 +108,10 @@ xwiki-platform-rendering-transformation-macro ${project.version} + + jakarta.servlet + jakarta.servlet-api + org.jsoup jsoup diff --git a/xwiki-platform-core/xwiki-platform-url/xwiki-platform-url-container/pom.xml b/xwiki-platform-core/xwiki-platform-url/xwiki-platform-url-container/pom.xml index 38264eb444ae..7b22b44c22e8 100644 --- a/xwiki-platform-core/xwiki-platform-url/xwiki-platform-url-container/pom.xml +++ b/xwiki-platform-core/xwiki-platform-url/xwiki-platform-url-container/pom.xml @@ -75,8 +75,8 @@ commons-lang3 - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api diff --git a/xwiki-platform-core/xwiki-platform-url/xwiki-platform-url-default/pom.xml b/xwiki-platform-core/xwiki-platform-url/xwiki-platform-url-default/pom.xml index ddcb37674d70..8bb8ae370fe2 100644 --- a/xwiki-platform-core/xwiki-platform-url/xwiki-platform-url-default/pom.xml +++ b/xwiki-platform-core/xwiki-platform-url/xwiki-platform-url-default/pom.xml @@ -54,8 +54,8 @@ - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api diff --git a/xwiki-platform-core/xwiki-platform-url/xwiki-platform-url-schemes/xwiki-platform-url-scheme-standard/pom.xml b/xwiki-platform-core/xwiki-platform-url/xwiki-platform-url-schemes/xwiki-platform-url-scheme-standard/pom.xml index 1885594a1a6e..053b8ba156cf 100644 --- a/xwiki-platform-core/xwiki-platform-url/xwiki-platform-url-schemes/xwiki-platform-url-scheme-standard/pom.xml +++ b/xwiki-platform-core/xwiki-platform-url/xwiki-platform-url-schemes/xwiki-platform-url-scheme-standard/pom.xml @@ -65,8 +65,8 @@ ${project.version} - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api diff --git a/xwiki-platform-core/xwiki-platform-user/xwiki-platform-user-default/pom.xml b/xwiki-platform-core/xwiki-platform-user/xwiki-platform-user-default/pom.xml index f508e91b9385..819ffae7a844 100644 --- a/xwiki-platform-core/xwiki-platform-user/xwiki-platform-user-default/pom.xml +++ b/xwiki-platform-core/xwiki-platform-user/xwiki-platform-user-default/pom.xml @@ -64,6 +64,7 @@ xwiki-platform-configuration-default ${project.version} + org.xwiki.platform diff --git a/xwiki-platform-core/xwiki-platform-user/xwiki-platform-user-resource/pom.xml b/xwiki-platform-core/xwiki-platform-user/xwiki-platform-user-resource/pom.xml index 7af9d66c2e98..00f544f2e09e 100644 --- a/xwiki-platform-core/xwiki-platform-user/xwiki-platform-user-resource/pom.xml +++ b/xwiki-platform-core/xwiki-platform-user/xwiki-platform-user-resource/pom.xml @@ -59,8 +59,8 @@ test - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api test diff --git a/xwiki-platform-core/xwiki-platform-velocity/xwiki-platform-velocity-webapp/pom.xml b/xwiki-platform-core/xwiki-platform-velocity/xwiki-platform-velocity-webapp/pom.xml index 572600bbc7ef..e4f73abdef5d 100644 --- a/xwiki-platform-core/xwiki-platform-velocity/xwiki-platform-velocity-webapp/pom.xml +++ b/xwiki-platform-core/xwiki-platform-velocity/xwiki-platform-velocity-webapp/pom.xml @@ -46,8 +46,8 @@ ${project.version} - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api diff --git a/xwiki-platform-core/xwiki-platform-vfs/xwiki-platform-vfs-api/pom.xml b/xwiki-platform-core/xwiki-platform-vfs/xwiki-platform-vfs-api/pom.xml index ace14cb17585..eb96e2e87fa8 100644 --- a/xwiki-platform-core/xwiki-platform-vfs/xwiki-platform-vfs-api/pom.xml +++ b/xwiki-platform-core/xwiki-platform-vfs/xwiki-platform-vfs-api/pom.xml @@ -223,8 +223,8 @@ - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api test diff --git a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/WEB-INF/jetty-web.xml b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/WEB-INF/jetty-web.xml index 489e4a8e6d2d..474918d675ad 100644 --- a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/WEB-INF/jetty-web.xml +++ b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/WEB-INF/jetty-web.xml @@ -1,5 +1,5 @@ - + - + - ConversionFilter + HTMLConversionFilter org.xwiki.wysiwyg.filter.ConversionFilter @@ -101,13 +101,13 @@ XWikiContextInitializationFilter - com.xpn.xwiki.web.XWikiContextInitializationFilter + com.xpn.xwiki.web.XWikiContextInitializer XWikiRESTContextInitializationFilter - com.xpn.xwiki.web.XWikiContextInitializationFilter + com.xpn.xwiki.web.XWikiContextInitializer mode @@ -177,7 +177,7 @@ - ConversionFilter + HTMLConversionFilter action REQUEST INCLUDE @@ -226,7 +226,7 @@ - org.xwiki.container.servlet.XWikiServletContextListener + org.xwiki.container.servlet.XWikiServletContextInitializer diff --git a/xwiki-platform-core/xwiki-platform-webjars/xwiki-platform-webjars-api/pom.xml b/xwiki-platform-core/xwiki-platform-webjars/xwiki-platform-webjars-api/pom.xml index 16475e5e4373..d7ab4e6df06e 100644 --- a/xwiki-platform-core/xwiki-platform-webjars/xwiki-platform-webjars-api/pom.xml +++ b/xwiki-platform-core/xwiki-platform-webjars/xwiki-platform-webjars-api/pom.xml @@ -99,8 +99,8 @@ ${project.version} - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api diff --git a/xwiki-platform-core/xwiki-platform-webjars/xwiki-platform-webjars-api/src/test/java/org/xwiki/webjars/internal/WebJarsResourceReferenceHandlerTest.java b/xwiki-platform-core/xwiki-platform-webjars/xwiki-platform-webjars-api/src/test/java/org/xwiki/webjars/internal/WebJarsResourceReferenceHandlerTest.java index 33ccf91b7342..711d6ab97ccc 100644 --- a/xwiki-platform-core/xwiki-platform-webjars/xwiki-platform-webjars-api/src/test/java/org/xwiki/webjars/internal/WebJarsResourceReferenceHandlerTest.java +++ b/xwiki-platform-core/xwiki-platform-webjars/xwiki-platform-webjars-api/src/test/java/org/xwiki/webjars/internal/WebJarsResourceReferenceHandlerTest.java @@ -19,6 +19,23 @@ */ package org.xwiki.webjars.internal; +import static ch.qos.logback.classic.Level.ERROR; +import static java.util.Arrays.asList; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotSame; +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyLong; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoInteractions; +import static org.mockito.Mockito.when; +import static org.xwiki.test.LogLevel.DEBUG; + import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.InputStream; @@ -26,8 +43,6 @@ import java.util.Date; import javax.inject.Named; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; import org.apache.commons.io.input.CharSequenceInputStream; import org.apache.velocity.exception.VelocityException; @@ -49,22 +64,8 @@ import org.xwiki.test.junit5.mockito.MockComponent; import org.xwiki.webjars.internal.filter.WebJarsResourceFilter; -import static ch.qos.logback.classic.Level.ERROR; -import static java.util.Arrays.asList; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotSame; -import static org.junit.jupiter.api.Assertions.assertSame; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyLong; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoInteractions; -import static org.mockito.Mockito.when; -import static org.xwiki.test.LogLevel.DEBUG; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; /** * Unit tests for {@link WebJarsResourceReferenceHandler}. @@ -114,11 +115,11 @@ void setUp() throws Exception when(this.response.getOutputStream()).thenReturn(responseOutputStream); HttpServletResponse httpResponse = mock(HttpServletResponse.class); - when(this.response.getHttpServletResponse()).thenReturn(httpResponse); + when(this.response.getJakartaHttpServletResponse()).thenReturn(httpResponse); when(this.container.getResponse()).thenReturn(this.response); HttpServletRequest httpRequest = mock(HttpServletRequest.class); - when(this.request.getHttpServletRequest()).thenReturn(httpRequest); + when(this.request.getJakartaHttpServletRequest()).thenReturn(httpRequest); when(this.container.getRequest()).thenReturn(this.request); when(this.classLoaderManager.getURLClassLoader("wiki:wiki", true)).thenReturn(this.classLoader); @@ -133,8 +134,8 @@ void executeWhenResourceDoesntExist() throws Exception this.handler.handle(reference, this.chain); verify(this.classLoader).getResourceAsStream("META-INF/resources/webjars/angular/2.1.11/angular.js"); - verify(this.response.getHttpServletResponse()) - .sendError(404, "Resource not found [angular/2.1.11/angular.js]."); + verify(this.response.getJakartaHttpServletResponse()).sendError(404, + "Resource not found [angular/2.1.11/angular.js]."); verify(this.chain).handleNext(reference); } @@ -145,8 +146,8 @@ void executeWhenResourceExists() throws Exception new WebJarsResourceReference("wiki:wiki", asList("angular", "2.1.11", "angular.js")); ByteArrayInputStream resourceStream = new ByteArrayInputStream("content".getBytes()); - when(this.classLoader.getResourceAsStream("META-INF/resources/webjars/angular/2.1.11/angular.js")).thenReturn( - resourceStream); + when(this.classLoader.getResourceAsStream("META-INF/resources/webjars/angular/2.1.11/angular.js")) + .thenReturn(resourceStream); long now = new Date().getTime(); this.handler.handle(reference, this.chain); @@ -160,15 +161,15 @@ void executeWhenResourceExists() throws Exception verify(this.response).setContentType("application/javascript"); // Verify that the static resource is cached permanently. - verify(this.response.getHttpServletResponse()).setHeader("Cache-Control", "public"); + verify(this.response.getJakartaHttpServletResponse()).setHeader("Cache-Control", "public"); ArgumentCaptor expireDate = ArgumentCaptor.forClass(Long.class); - verify(this.response.getHttpServletResponse()).setDateHeader(eq("Expires"), expireDate.capture()); + verify(this.response.getJakartaHttpServletResponse()).setDateHeader(eq("Expires"), expireDate.capture()); // The expiration date should be in one year from now. assertTrue(expireDate.getValue() >= (now + 365 * 24 * 3600 * 1000L)); // Also verify that the "Last-Modified" header has been set in the response so that the browser will send // an If-Modified-Since header for the next request and we can tell it to use its cache. - verify(this.response.getHttpServletResponse()).setDateHeader(eq("Last-Modified"), anyLong()); + verify(this.response.getJakartaHttpServletResponse()).setDateHeader(eq("Last-Modified"), anyLong()); verify(this.chain).handleNext(reference); } @@ -179,12 +180,12 @@ void return304WhenIfModifiedSinceHeader() throws Exception WebJarsResourceReference reference = new WebJarsResourceReference("wiki:wiki", asList("angular", "2.1.11", "angular.js")); - when(this.request.getHttpServletRequest().getHeader("If-Modified-Since")).thenReturn("some value"); + when(this.request.getJakartaHttpServletRequest().getHeader("If-Modified-Since")).thenReturn("some value"); this.handler.handle(reference, this.chain); // This the test: we verify that 304 is returned when the "If-Modified-Since" header is found in the request - verify(this.response.getHttpServletResponse()).setStatus(304); + verify(this.response.getJakartaHttpServletResponse()).setStatus(304); verify(this.chain).handleNext(reference); } @@ -198,8 +199,7 @@ void evaluateResource() throws Exception try (ByteArrayInputStream resourceStream = new ByteArrayInputStream("content".getBytes())) { when(this.classLoader.getResourceAsStream("META-INF/resources/webjars/angular/2.1.11/angular.js")) - .thenReturn( - resourceStream); + .thenReturn(resourceStream); } when(this.velocityFilter.filter(any(), any())) @@ -214,8 +214,8 @@ void evaluateResource() throws Exception verify(this.response).setContentType("application/javascript"); // Verify that the dynamic resource is not cached. - verify(this.response.getHttpServletResponse(), never()).setHeader(any(), any()); - verify(this.response.getHttpServletResponse(), never()).setDateHeader(any(), anyLong()); + verify(this.response.getJakartaHttpServletResponse(), never()).setHeader(any(), any()); + verify(this.response.getJakartaHttpServletResponse(), never()).setDateHeader(any(), anyLong()); } @Test @@ -243,7 +243,7 @@ void failingResourceEvaluation() throws Exception this.logCapture.getMessage(0)); // Verify that the client is properly notified about the failure. - verify(this.response.getHttpServletResponse()).sendError(500, + verify(this.response.getJakartaHttpServletResponse()).sendError(500, "Failed to evaluate the Velocity code from WebJar resource [angular/2.1.11/angular.js]"); // The next handlers are still called. @@ -284,9 +284,8 @@ void getContentType() throws Exception WebJarsResourceReference resourceReference = new WebJarsResourceReference("testNamespace", asList("testdirectory", "testfile.less")); - String mimeType = - this.handler.getContentType(new CharSequenceInputStream("a:\n color: #f00;", StandardCharsets.UTF_8), - resourceReference); + String mimeType = this.handler.getContentType( + new CharSequenceInputStream("a:\n color: #f00;", StandardCharsets.UTF_8), resourceReference); assertEquals("text/x-less", mimeType); } @@ -297,9 +296,8 @@ void getContentTypeLessAndEvaluate() throws Exception new WebJarsResourceReference("testNamespace", asList("testdirectory", "testfile.less")); resourceReference.addParameter("evaluate", "true"); - String mimeType = - this.handler.getContentType(new CharSequenceInputStream("a:\n color: #f00;", StandardCharsets.UTF_8), - resourceReference); + String mimeType = this.handler.getContentType( + new CharSequenceInputStream("a:\n color: #f00;", StandardCharsets.UTF_8), resourceReference); assertEquals("text/css", mimeType); } diff --git a/xwiki-platform-core/xwiki-platform-websocket/pom.xml b/xwiki-platform-core/xwiki-platform-websocket/pom.xml index 21bd64e9d265..91ffa8e5dfff 100644 --- a/xwiki-platform-core/xwiki-platform-websocket/pom.xml +++ b/xwiki-platform-core/xwiki-platform-websocket/pom.xml @@ -48,12 +48,16 @@ ${project.version} - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api - javax.websocket - javax.websocket-api + jakarta.websocket + jakarta.websocket-api + + + jakarta.websocket + jakarta.websocket-client-api diff --git a/xwiki-platform-core/xwiki-platform-websocket/src/main/java/org/xwiki/websocket/AbstractXWikiEndpoint.java b/xwiki-platform-core/xwiki-platform-websocket/src/main/java/org/xwiki/websocket/AbstractXWikiEndpoint.java index af8cee9fc621..30db06d8117f 100644 --- a/xwiki-platform-core/xwiki-platform-websocket/src/main/java/org/xwiki/websocket/AbstractXWikiEndpoint.java +++ b/xwiki-platform-core/xwiki-platform-websocket/src/main/java/org/xwiki/websocket/AbstractXWikiEndpoint.java @@ -26,10 +26,10 @@ import java.util.List; import javax.inject.Inject; -import javax.websocket.CloseReason; -import javax.websocket.EncodeException; -import javax.websocket.Endpoint; -import javax.websocket.Session; +import jakarta.websocket.CloseReason; +import jakarta.websocket.EncodeException; +import jakarta.websocket.Endpoint; +import jakarta.websocket.Session; import org.apache.commons.lang3.exception.ExceptionUtils; import org.slf4j.Logger; diff --git a/xwiki-platform-core/xwiki-platform-websocket/src/main/java/org/xwiki/websocket/internal/DefaultWebSocketContext.java b/xwiki-platform-core/xwiki-platform-websocket/src/main/java/org/xwiki/websocket/internal/DefaultWebSocketContext.java index 767e51efea53..c4f0ec29207c 100644 --- a/xwiki-platform-core/xwiki-platform-websocket/src/main/java/org/xwiki/websocket/internal/DefaultWebSocketContext.java +++ b/xwiki-platform-core/xwiki-platform-websocket/src/main/java/org/xwiki/websocket/internal/DefaultWebSocketContext.java @@ -25,10 +25,10 @@ import javax.inject.Inject; import javax.inject.Singleton; -import javax.websocket.HandshakeResponse; -import javax.websocket.Session; -import javax.websocket.server.HandshakeRequest; -import javax.websocket.server.ServerEndpointConfig; +import jakarta.websocket.HandshakeResponse; +import jakarta.websocket.Session; +import jakarta.websocket.server.HandshakeRequest; +import jakarta.websocket.server.ServerEndpointConfig; import org.slf4j.Logger; import org.xwiki.component.annotation.Component; diff --git a/xwiki-platform-core/xwiki-platform-websocket/src/main/java/org/xwiki/websocket/internal/DynamicEchoEndpoint.java b/xwiki-platform-core/xwiki-platform-websocket/src/main/java/org/xwiki/websocket/internal/DynamicEchoEndpoint.java index 9db5a523f5a8..5ce9bafb44d3 100644 --- a/xwiki-platform-core/xwiki-platform-websocket/src/main/java/org/xwiki/websocket/internal/DynamicEchoEndpoint.java +++ b/xwiki-platform-core/xwiki-platform-websocket/src/main/java/org/xwiki/websocket/internal/DynamicEchoEndpoint.java @@ -22,10 +22,10 @@ import javax.inject.Inject; import javax.inject.Named; import javax.inject.Singleton; -import javax.websocket.CloseReason; -import javax.websocket.EndpointConfig; -import javax.websocket.MessageHandler; -import javax.websocket.Session; +import jakarta.websocket.CloseReason; +import jakarta.websocket.EndpointConfig; +import jakarta.websocket.MessageHandler; +import jakarta.websocket.Session; import org.xwiki.bridge.DocumentAccessBridge; import org.xwiki.component.annotation.Component; diff --git a/xwiki-platform-core/xwiki-platform-websocket/src/main/java/org/xwiki/websocket/internal/StaticEchoEndpoint.java b/xwiki-platform-core/xwiki-platform-websocket/src/main/java/org/xwiki/websocket/internal/StaticEchoEndpoint.java index d25f5e935a3e..240ebf4d4875 100644 --- a/xwiki-platform-core/xwiki-platform-websocket/src/main/java/org/xwiki/websocket/internal/StaticEchoEndpoint.java +++ b/xwiki-platform-core/xwiki-platform-websocket/src/main/java/org/xwiki/websocket/internal/StaticEchoEndpoint.java @@ -24,11 +24,11 @@ import javax.inject.Inject; import javax.inject.Named; import javax.inject.Singleton; -import javax.websocket.CloseReason; -import javax.websocket.OnMessage; -import javax.websocket.OnOpen; -import javax.websocket.Session; -import javax.websocket.server.ServerEndpoint; +import jakarta.websocket.CloseReason; +import jakarta.websocket.OnMessage; +import jakarta.websocket.OnOpen; +import jakarta.websocket.Session; +import jakarta.websocket.server.ServerEndpoint; import org.slf4j.Logger; import org.xwiki.bridge.DocumentAccessBridge; diff --git a/xwiki-platform-core/xwiki-platform-websocket/src/main/java/org/xwiki/websocket/internal/XWikiWebSocketRequestStub.java b/xwiki-platform-core/xwiki-platform-websocket/src/main/java/org/xwiki/websocket/internal/XWikiWebSocketRequestStub.java index aa6148f633ba..be90b3ced676 100644 --- a/xwiki-platform-core/xwiki-platform-websocket/src/main/java/org/xwiki/websocket/internal/XWikiWebSocketRequestStub.java +++ b/xwiki-platform-core/xwiki-platform-websocket/src/main/java/org/xwiki/websocket/internal/XWikiWebSocketRequestStub.java @@ -34,7 +34,7 @@ import javax.servlet.http.Cookie; import javax.servlet.http.HttpSession; -import javax.websocket.server.HandshakeRequest; +import jakarta.websocket.server.HandshakeRequest; import com.xpn.xwiki.web.XWikiRequest; import com.xpn.xwiki.web.XWikiServletRequestStub; diff --git a/xwiki-platform-core/xwiki-platform-websocket/src/main/java/org/xwiki/websocket/internal/XWikiWebSocketResponseStub.java b/xwiki-platform-core/xwiki-platform-websocket/src/main/java/org/xwiki/websocket/internal/XWikiWebSocketResponseStub.java index 1581c6e8ede8..24888aaa1f71 100644 --- a/xwiki-platform-core/xwiki-platform-websocket/src/main/java/org/xwiki/websocket/internal/XWikiWebSocketResponseStub.java +++ b/xwiki-platform-core/xwiki-platform-websocket/src/main/java/org/xwiki/websocket/internal/XWikiWebSocketResponseStub.java @@ -33,7 +33,7 @@ import java.util.stream.Collectors; import javax.servlet.http.Cookie; -import javax.websocket.HandshakeResponse; +import jakarta.websocket.HandshakeResponse; import org.apache.commons.lang3.StringUtils; diff --git a/xwiki-platform-core/xwiki-platform-websocket/src/test/java/org/xwiki/websocket/internal/DefaultWebSocketContextTest.java b/xwiki-platform-core/xwiki-platform-websocket/src/test/java/org/xwiki/websocket/internal/DefaultWebSocketContextTest.java index ecb65ddffa8f..6cf514548358 100644 --- a/xwiki-platform-core/xwiki-platform-websocket/src/test/java/org/xwiki/websocket/internal/DefaultWebSocketContextTest.java +++ b/xwiki-platform-core/xwiki-platform-websocket/src/test/java/org/xwiki/websocket/internal/DefaultWebSocketContextTest.java @@ -25,10 +25,10 @@ import java.util.Map; import javax.servlet.http.HttpSession; -import javax.websocket.HandshakeResponse; -import javax.websocket.Session; -import javax.websocket.server.HandshakeRequest; -import javax.websocket.server.ServerEndpointConfig; +import jakarta.websocket.HandshakeResponse; +import jakarta.websocket.Session; +import jakarta.websocket.server.HandshakeRequest; +import jakarta.websocket.server.ServerEndpointConfig; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; diff --git a/xwiki-platform-core/xwiki-platform-websocket/src/test/java/org/xwiki/websocket/internal/DynamicEchoEndpointTest.java b/xwiki-platform-core/xwiki-platform-websocket/src/test/java/org/xwiki/websocket/internal/DynamicEchoEndpointTest.java index e3b6a08bde71..df9831a14d3d 100644 --- a/xwiki-platform-core/xwiki-platform-websocket/src/test/java/org/xwiki/websocket/internal/DynamicEchoEndpointTest.java +++ b/xwiki-platform-core/xwiki-platform-websocket/src/test/java/org/xwiki/websocket/internal/DynamicEchoEndpointTest.java @@ -19,10 +19,10 @@ */ package org.xwiki.websocket.internal; -import javax.websocket.CloseReason; -import javax.websocket.MessageHandler; -import javax.websocket.RemoteEndpoint.Basic; -import javax.websocket.Session; +import jakarta.websocket.CloseReason; +import jakarta.websocket.MessageHandler; +import jakarta.websocket.RemoteEndpoint.Basic; +import jakarta.websocket.Session; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; diff --git a/xwiki-platform-core/xwiki-platform-websocket/src/test/java/org/xwiki/websocket/internal/XWikiWebSocketRequestStubTest.java b/xwiki-platform-core/xwiki-platform-websocket/src/test/java/org/xwiki/websocket/internal/XWikiWebSocketRequestStubTest.java index 2e3182d1f469..51ec3e81c240 100644 --- a/xwiki-platform-core/xwiki-platform-websocket/src/test/java/org/xwiki/websocket/internal/XWikiWebSocketRequestStubTest.java +++ b/xwiki-platform-core/xwiki-platform-websocket/src/test/java/org/xwiki/websocket/internal/XWikiWebSocketRequestStubTest.java @@ -28,7 +28,7 @@ import java.util.Map; import javax.servlet.http.HttpSession; -import javax.websocket.server.HandshakeRequest; +import jakarta.websocket.server.HandshakeRequest; import org.junit.jupiter.api.Test; diff --git a/xwiki-platform-core/xwiki-platform-websocket/src/test/java/org/xwiki/websocket/internal/XWikiWebSocketResponseStubTest.java b/xwiki-platform-core/xwiki-platform-websocket/src/test/java/org/xwiki/websocket/internal/XWikiWebSocketResponseStubTest.java index afee2e62b06e..d65903d81d9e 100644 --- a/xwiki-platform-core/xwiki-platform-websocket/src/test/java/org/xwiki/websocket/internal/XWikiWebSocketResponseStubTest.java +++ b/xwiki-platform-core/xwiki-platform-websocket/src/test/java/org/xwiki/websocket/internal/XWikiWebSocketResponseStubTest.java @@ -27,7 +27,7 @@ import java.util.Map; import javax.servlet.http.Cookie; -import javax.websocket.HandshakeResponse; +import jakarta.websocket.HandshakeResponse; import org.junit.jupiter.api.Test; diff --git a/xwiki-platform-core/xwiki-platform-wiki/xwiki-platform-wiki-creationjob/pom.xml b/xwiki-platform-core/xwiki-platform-wiki/xwiki-platform-wiki-creationjob/pom.xml index d8a76ac13ef3..51a29a60e7d9 100644 --- a/xwiki-platform-core/xwiki-platform-wiki/xwiki-platform-wiki-creationjob/pom.xml +++ b/xwiki-platform-core/xwiki-platform-wiki/xwiki-platform-wiki-creationjob/pom.xml @@ -92,8 +92,8 @@ - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api test diff --git a/xwiki-platform-core/xwiki-platform-wiki/xwiki-platform-wiki-default/pom.xml b/xwiki-platform-core/xwiki-platform-wiki/xwiki-platform-wiki-default/pom.xml index 207989660add..27508d8b4515 100644 --- a/xwiki-platform-core/xwiki-platform-wiki/xwiki-platform-wiki-default/pom.xml +++ b/xwiki-platform-core/xwiki-platform-wiki/xwiki-platform-wiki-default/pom.xml @@ -76,8 +76,8 @@ ${project.version} - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api diff --git a/xwiki-platform-core/xwiki-platform-wiki/xwiki-platform-wiki-script/pom.xml b/xwiki-platform-core/xwiki-platform-wiki/xwiki-platform-wiki-script/pom.xml index df7ea4e9fe47..5f14c5339e14 100644 --- a/xwiki-platform-core/xwiki-platform-wiki/xwiki-platform-wiki-script/pom.xml +++ b/xwiki-platform-core/xwiki-platform-wiki/xwiki-platform-wiki-script/pom.xml @@ -65,8 +65,8 @@ - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api test diff --git a/xwiki-platform-core/xwiki-platform-wiki/xwiki-platform-wiki-template/xwiki-platform-wiki-template-default/pom.xml b/xwiki-platform-core/xwiki-platform-wiki/xwiki-platform-wiki-template/xwiki-platform-wiki-template-default/pom.xml index 1a2d06987f74..fccd1d6feab3 100644 --- a/xwiki-platform-core/xwiki-platform-wiki/xwiki-platform-wiki-template/xwiki-platform-wiki-template-default/pom.xml +++ b/xwiki-platform-core/xwiki-platform-wiki/xwiki-platform-wiki-template/xwiki-platform-wiki-template-default/pom.xml @@ -53,8 +53,8 @@ - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api test diff --git a/xwiki-platform-core/xwiki-platform-wiki/xwiki-platform-wiki-template/xwiki-platform-wiki-template-script/pom.xml b/xwiki-platform-core/xwiki-platform-wiki/xwiki-platform-wiki-template/xwiki-platform-wiki-template-script/pom.xml index 69209b3bad09..70bef2e5381d 100644 --- a/xwiki-platform-core/xwiki-platform-wiki/xwiki-platform-wiki-template/xwiki-platform-wiki-template-script/pom.xml +++ b/xwiki-platform-core/xwiki-platform-wiki/xwiki-platform-wiki-template/xwiki-platform-wiki-template-script/pom.xml @@ -50,8 +50,8 @@ - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api test diff --git a/xwiki-platform-core/xwiki-platform-wiki/xwiki-platform-wiki-user/xwiki-platform-wiki-user-script/pom.xml b/xwiki-platform-core/xwiki-platform-wiki/xwiki-platform-wiki-user/xwiki-platform-wiki-user-script/pom.xml index c8e2cc2e9c13..7ed1d60ffea9 100644 --- a/xwiki-platform-core/xwiki-platform-wiki/xwiki-platform-wiki-user/xwiki-platform-wiki-user-script/pom.xml +++ b/xwiki-platform-core/xwiki-platform-wiki/xwiki-platform-wiki-user/xwiki-platform-wiki-user-script/pom.xml @@ -53,8 +53,8 @@ - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api test diff --git a/xwiki-platform-core/xwiki-platform-wiki/xwiki-platform-wiki-workspaces-migrator/pom.xml b/xwiki-platform-core/xwiki-platform-wiki/xwiki-platform-wiki-workspaces-migrator/pom.xml index 7fa3dc91ff7c..abc4cdef2544 100644 --- a/xwiki-platform-core/xwiki-platform-wiki/xwiki-platform-wiki-workspaces-migrator/pom.xml +++ b/xwiki-platform-core/xwiki-platform-wiki/xwiki-platform-wiki-workspaces-migrator/pom.xml @@ -53,8 +53,8 @@ - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api test diff --git a/xwiki-platform-core/xwiki-platform-wysiwyg/xwiki-platform-wysiwyg-api/pom.xml b/xwiki-platform-core/xwiki-platform-wysiwyg/xwiki-platform-wysiwyg-api/pom.xml index 66811a6ca31e..fd6859a3559d 100644 --- a/xwiki-platform-core/xwiki-platform-wysiwyg/xwiki-platform-wysiwyg-api/pom.xml +++ b/xwiki-platform-core/xwiki-platform-wysiwyg/xwiki-platform-wysiwyg-api/pom.xml @@ -37,9 +37,9 @@ WYSIWYG Editor Module - - javax.servlet - javax.servlet-api + + jakarta.servlet + jakarta.servlet-api diff --git a/xwiki-platform-core/xwiki-platform-wysiwyg/xwiki-platform-wysiwyg-api/src/main/java/org/xwiki/wysiwyg/converter/JakartaRequestParameterConversionResult.java b/xwiki-platform-core/xwiki-platform-wysiwyg/xwiki-platform-wysiwyg-api/src/main/java/org/xwiki/wysiwyg/converter/JakartaRequestParameterConversionResult.java new file mode 100644 index 000000000000..319e8b02806c --- /dev/null +++ b/xwiki-platform-core/xwiki-platform-wysiwyg/xwiki-platform-wysiwyg-api/src/main/java/org/xwiki/wysiwyg/converter/JakartaRequestParameterConversionResult.java @@ -0,0 +1,78 @@ +/* + * See the NOTICE file distributed with this work for additional + * information regarding copyright ownership. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.xwiki.wysiwyg.converter; + +import java.util.LinkedHashMap; +import java.util.Map; + +import org.xwiki.wysiwyg.filter.MutableJakartaServletRequest; + +/** + * Simple POJO holding the result of a conversion performed with {@link RequestParameterConverter}. More specifically + * this class contains a mutable request, resulting of the conversion, a map of errors that might have occurred during + * the conversion for each parameter, and a map of the output of the conversion for each parameter. + * + * @version $Id$ + * @since 42.0.0 + */ +public class JakartaRequestParameterConversionResult +{ + private MutableJakartaServletRequest request; + + private Map errors; + + private Map output; + + /** + * Default constructor. + * + * @param request a mutable copy of the original request used for the conversion + */ + public JakartaRequestParameterConversionResult(MutableJakartaServletRequest request) + { + this.request = request; + this.errors = new LinkedHashMap<>(); + this.output = new LinkedHashMap<>(); + } + + /** + * @return the mutable request + */ + public MutableJakartaServletRequest getRequest() + { + return request; + } + + /** + * @return the map of errors indexed by parameters + */ + public Map getErrors() + { + return errors; + } + + /** + * @return the map of conversion output indexed by parameters + */ + public Map getOutput() + { + return output; + } +} diff --git a/xwiki-platform-core/xwiki-platform-wysiwyg/xwiki-platform-wysiwyg-api/src/main/java/org/xwiki/wysiwyg/converter/RequestParameterConversionResult.java b/xwiki-platform-core/xwiki-platform-wysiwyg/xwiki-platform-wysiwyg-api/src/main/java/org/xwiki/wysiwyg/converter/RequestParameterConversionResult.java index f81bb6c53ebd..8672b6a31659 100644 --- a/xwiki-platform-core/xwiki-platform-wysiwyg/xwiki-platform-wysiwyg-api/src/main/java/org/xwiki/wysiwyg/converter/RequestParameterConversionResult.java +++ b/xwiki-platform-core/xwiki-platform-wysiwyg/xwiki-platform-wysiwyg-api/src/main/java/org/xwiki/wysiwyg/converter/RequestParameterConversionResult.java @@ -23,19 +23,24 @@ import java.util.Map; import org.xwiki.wysiwyg.filter.MutableServletRequest; +import org.xwiki.wysiwyg.internal.filter.http.JavaxToJakartaMutableHttpServletRequest; /** - * Simple POJO holding the result of a conversion performed with {@link RequestParameterConverter}. - * More specifically this class contains a mutable request, resulting of the conversion, a map of errors that might have - * occurred during the conversion for each parameter, and a map of the output of the conversion for each parameter. + * Simple POJO holding the result of a conversion performed with {@link RequestParameterConverter}. More specifically + * this class contains a mutable request, resulting of the conversion, a map of errors that might have occurred during + * the conversion for each parameter, and a map of the output of the conversion for each parameter. * * @version $Id$ * @since 14.10 + * @deprecated use {@link JakartaRequestParameterConversionResult} instead */ +@Deprecated(since = "42.0.0") public class RequestParameterConversionResult { private MutableServletRequest request; + private Map errors; + private Map output; /** @@ -50,6 +55,19 @@ public RequestParameterConversionResult(MutableServletRequest request) this.output = new LinkedHashMap<>(); } + /** + * Default constructor. + * + * @param result the jakarta result to copy + * @since 42.0.0 + */ + public RequestParameterConversionResult(JakartaRequestParameterConversionResult result) + { + this.request = new JavaxToJakartaMutableHttpServletRequest(result.getRequest()); + this.errors = result.getErrors(); + this.output = result.getOutput(); + } + /** * @return the mutable request */ diff --git a/xwiki-platform-core/xwiki-platform-wysiwyg/xwiki-platform-wysiwyg-api/src/main/java/org/xwiki/wysiwyg/converter/RequestParameterConverter.java b/xwiki-platform-core/xwiki-platform-wysiwyg/xwiki-platform-wysiwyg-api/src/main/java/org/xwiki/wysiwyg/converter/RequestParameterConverter.java index a7e9910a1ceb..eaa6433a53ba 100644 --- a/xwiki-platform-core/xwiki-platform-wysiwyg/xwiki-platform-wysiwyg-api/src/main/java/org/xwiki/wysiwyg/converter/RequestParameterConverter.java +++ b/xwiki-platform-core/xwiki-platform-wysiwyg/xwiki-platform-wysiwyg-api/src/main/java/org/xwiki/wysiwyg/converter/RequestParameterConverter.java @@ -22,10 +22,13 @@ import java.io.IOException; import java.util.Optional; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; - import org.xwiki.component.annotation.Role; +import org.xwiki.jakartabridge.servlet.JakartaServletBridge; +import org.xwiki.stability.Unstable; +import org.xwiki.wysiwyg.internal.filter.http.JakartaToJavaxMutableHttpServletRequest; + +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; /** * Check if the given request contains parameters that needs conversion and perform the needing conversion. @@ -37,30 +40,83 @@ public interface RequestParameterConverter { /** - * Check if the given request needs conversion and perform those conversions. - * This method creates a mutable request, modifies and returns it. However in case of - * error it will return an empty optional, and it will handle directly the errors in the response. - * See {@link #convert(ServletRequest)} for using an exception for handling the errors. + * Check if the given request needs conversion and perform those conversions. This method creates a mutable request, + * modifies and returns it. However in case of error it will return an empty optional, and it will handle directly + * the errors in the response. See {@link #convert(javax.servlet.ServletRequest)} for using an exception for + * handling the errors. * * @param request the request that might contain parameter needing conversion or an {@link Optional#empty()} in case - * of error + * of error * @param response the response used to redirect or do changes in case of conversion error * @return a mutable request with the converted parameters, or an empty optional in case of error * @throws IOException in case of problem to write an answer in the response + * @deprecated use {@link #convert(ServletRequest, ServletResponse)} instead */ - Optional convert(ServletRequest request, ServletResponse response) throws IOException; + @Deprecated(since = "42.0.0") + default Optional convert(javax.servlet.ServletRequest request, + javax.servlet.ServletResponse response) throws IOException + { + Optional result = + convert(JakartaServletBridge.toJakarta(request), JakartaServletBridge.toJakarta(response)); + + return result.isEmpty() ? Optional.empty() : Optional.of(JakartaServletBridge.toJavax(result.get())); + } /** - * Check if the given request needs conversion and perform those conversions. - * This method creates a mutable request, modifies it and returns it along with the errors and output that have - * occurred as part of the conversion, all that holds in the returned {@link RequestParameterConversionResult}. - * Consumer of this API should always check if the obtained result contains errors or not to know if the conversion - * properly succeeded. + * Check if the given request needs conversion and perform those conversions. This method creates a mutable request, + * modifies and returns it. However in case of error it will return an empty optional, and it will handle directly + * the errors in the response. See {@link #convert(javax.servlet.ServletRequest)} for using an exception for + * handling the errors. + * + * @param request the request that might contain parameter needing conversion or an {@link Optional#empty()} in case + * of error + * @param response the response used to redirect or do changes in case of conversion error + * @return a mutable request with the converted parameters, or an empty optional in case of error + * @throws IOException in case of problem to write an answer in the response + * @since 42.0.0 + */ + @Unstable + default Optional convert(ServletRequest request, ServletResponse response) throws IOException + { + Optional result = + convert(JakartaServletBridge.toJavax(request), JakartaServletBridge.toJavax(response)); + + return result.isEmpty() ? Optional.empty() : Optional.of(JakartaServletBridge.toJakarta(result.get())); + } + + /** + * Check if the given request needs conversion and perform those conversions. This method creates a mutable request, + * modifies it and returns it along with the errors and output that have occurred as part of the conversion, all + * that holds in the returned {@link RequestParameterConversionResult}. Consumer of this API should always check if + * the obtained result contains errors or not to know if the conversion properly succeeded. * * @param request the request that might contain parameter needing conversion * @return an instance of {@link RequestParameterConversionResult} containing the modified request and the output * and errors that might have occurred * @since 14.10 + * @deprecated use {@link #convert(ServletRequest)} instead + */ + @Deprecated(since = "42.0.0") + default RequestParameterConversionResult convert(javax.servlet.ServletRequest request) + { + return new RequestParameterConversionResult(convert(JakartaServletBridge.toJakarta(request))); + } + + /** + * Check if the given request needs conversion and perform those conversions. This method creates a mutable request, + * modifies it and returns it along with the errors and output that have occurred as part of the conversion, all + * that holds in the returned {@link RequestParameterConversionResult}. Consumer of this API should always check if + * the obtained result contains errors or not to know if the conversion properly succeeded. + * + * @param request the request that might contain parameter needing conversion + * @return an instance of {@link RequestParameterConversionResult} containing the modified request and the output + * and errors that might have occurred + * @since 42.0.0 */ - RequestParameterConversionResult convert(ServletRequest request); + @Unstable + default JakartaRequestParameterConversionResult convert(ServletRequest request) + { + return new JakartaRequestParameterConversionResult( + new JakartaToJavaxMutableHttpServletRequest(convert(JakartaServletBridge.toJavax(request)).getRequest())); + } } diff --git a/xwiki-platform-core/xwiki-platform-wysiwyg/xwiki-platform-wysiwyg-api/src/main/java/org/xwiki/wysiwyg/filter/ConversionFilter.java b/xwiki-platform-core/xwiki-platform-wysiwyg/xwiki-platform-wysiwyg-api/src/main/java/org/xwiki/wysiwyg/filter/ConversionFilter.java index 995db15d284b..989fc954ac36 100644 --- a/xwiki-platform-core/xwiki-platform-wysiwyg/xwiki-platform-wysiwyg-api/src/main/java/org/xwiki/wysiwyg/filter/ConversionFilter.java +++ b/xwiki-platform-core/xwiki-platform-wysiwyg/xwiki-platform-wysiwyg-api/src/main/java/org/xwiki/wysiwyg/filter/ConversionFilter.java @@ -22,12 +22,12 @@ import java.io.IOException; import java.util.Optional; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -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.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; import org.xwiki.context.Execution; import org.xwiki.context.ExecutionContext; @@ -38,8 +38,12 @@ /** * This filter is used to convert the values of request parameters that require HTML conversion before being processed. * A HTML editor can use this filter to convert its output to a specific syntax before it is saved. + *

+ * While the class is much older, the since annotation was moved to 42.0.0 because it implement a completely different + * API from Java point of view. * * @version $Id$ + * @since 42.0.0 */ public class ConversionFilter implements Filter { diff --git a/xwiki-platform-core/xwiki-platform-wysiwyg/xwiki-platform-wysiwyg-api/src/main/java/org/xwiki/wysiwyg/filter/MutableJakartaServletRequest.java b/xwiki-platform-core/xwiki-platform-wysiwyg/xwiki-platform-wysiwyg-api/src/main/java/org/xwiki/wysiwyg/filter/MutableJakartaServletRequest.java new file mode 100644 index 000000000000..8136d84351a0 --- /dev/null +++ b/xwiki-platform-core/xwiki-platform-wysiwyg/xwiki-platform-wysiwyg-api/src/main/java/org/xwiki/wysiwyg/filter/MutableJakartaServletRequest.java @@ -0,0 +1,98 @@ +/* + * See the NOTICE file distributed with this work for additional + * information regarding copyright ownership. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.xwiki.wysiwyg.filter; + +import java.io.IOException; + +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; + +/** + * A servlet request that can be modified. It is very useful, for instance, when you need to change the values of some + * request parameters, inside a filter. + * + * @version $Id$ + * @since 42.0.0 + */ +public interface MutableJakartaServletRequest extends ServletRequest +{ + /** + * Sets the value of a request parameter. + * + * @param name the name of the request parameter + * @param value the new value of the request parameter + * @return the old value of the specified request parameter, or {@code null} if this is the first time we set its + * value + */ + String setParameter(String name, String value); + + /** + * Sets the values of a request parameter. + * + * @param name the name of the request parameter + * @param values the new array of values for the specified request parameter + * @return the old values of the specified request parameter, or {@code null} if this is the first time we set its + * values + */ + String[] setParameterValues(String name, String[] values); + + /** + * Removes the request parameter with the specified name. + * + * @param name a string representing the name of the request parameter to be removed + * @return the old value of the specified request parameter, or {@code null} if it wasn't set + */ + String removeParameter(String name); + + /** + * Redirects this request to the specified URL. We had to add this method since there's no generic way to redirect a + * {@link ServletRequest}. + * + * @param response the response object used to redirect + * @param url the location where to redirect + * @throws IOException if the redirect fails + */ + void sendRedirect(ServletResponse response, String url) throws IOException; + + /** + * @return the URL of the requester + */ + String getReferer(); + + /** + * @param attrName the name of the session attribute whose value should be retrieved + * @return the value of the specified session attribute + */ + Object getSessionAttribute(String attrName); + + /** + * Sets the value of a session attribute. + * + * @param attrName the name of the session attribute + * @param attrValue the value to be set + * @return the previous value of the specified session attribute + */ + Object setSessionAttribute(String attrName, Object attrValue); + + /** + * @return the request object wrapped by this object + */ + ServletRequest getRequest(); +} diff --git a/xwiki-platform-core/xwiki-platform-wysiwyg/xwiki-platform-wysiwyg-api/src/main/java/org/xwiki/wysiwyg/filter/MutableServletRequest.java b/xwiki-platform-core/xwiki-platform-wysiwyg/xwiki-platform-wysiwyg-api/src/main/java/org/xwiki/wysiwyg/filter/MutableServletRequest.java index c3efb91d4899..8adb847f2b05 100644 --- a/xwiki-platform-core/xwiki-platform-wysiwyg/xwiki-platform-wysiwyg-api/src/main/java/org/xwiki/wysiwyg/filter/MutableServletRequest.java +++ b/xwiki-platform-core/xwiki-platform-wysiwyg/xwiki-platform-wysiwyg-api/src/main/java/org/xwiki/wysiwyg/filter/MutableServletRequest.java @@ -29,7 +29,9 @@ * request parameters, inside a filter. * * @version $Id$ + * @deprecated use {@link MutableJakartaServletRequest} instead */ +@Deprecated(since = "42.0.0") public interface MutableServletRequest extends ServletRequest { /** diff --git a/xwiki-platform-core/xwiki-platform-wysiwyg/xwiki-platform-wysiwyg-api/src/main/java/org/xwiki/wysiwyg/filter/MutableServletRequestFactory.java b/xwiki-platform-core/xwiki-platform-wysiwyg/xwiki-platform-wysiwyg-api/src/main/java/org/xwiki/wysiwyg/filter/MutableServletRequestFactory.java index e1db8ec5280d..625e20053249 100644 --- a/xwiki-platform-core/xwiki-platform-wysiwyg/xwiki-platform-wysiwyg-api/src/main/java/org/xwiki/wysiwyg/filter/MutableServletRequestFactory.java +++ b/xwiki-platform-core/xwiki-platform-wysiwyg/xwiki-platform-wysiwyg-api/src/main/java/org/xwiki/wysiwyg/filter/MutableServletRequestFactory.java @@ -19,9 +19,13 @@ */ package org.xwiki.wysiwyg.filter; -import javax.servlet.ServletRequest; - import org.xwiki.component.annotation.Role; +import org.xwiki.jakartabridge.servlet.JakartaServletBridge; +import org.xwiki.stability.Unstable; +import org.xwiki.wysiwyg.internal.filter.http.JakartaToJavaxMutableHttpServletRequest; +import org.xwiki.wysiwyg.internal.filter.http.JavaxToJakartaMutableHttpServletRequest; + +import jakarta.servlet.ServletRequest; /** * A factory for mutable servlet requests. This factory is needed because concrete mutable servlet requests don't have a @@ -38,6 +42,24 @@ public interface MutableServletRequestFactory * * @param request The original servlet request to wrap. * @return a new mutable servlet request. + * @deprecated use {@link #newInstance(ServletRequest)} instead + */ + @Deprecated(since = "42.0.0") + default MutableServletRequest newInstance(javax.servlet.ServletRequest request) + { + return new JavaxToJakartaMutableHttpServletRequest(newInstance(JakartaServletBridge.toJakarta(request))); + } + + /** + * Creates a new mutable servlet request. + * + * @param request The original servlet request to wrap. + * @return a new mutable servlet request. + * @since 42.0.0 */ - MutableServletRequest newInstance(ServletRequest request); + @Unstable + default MutableJakartaServletRequest newInstance(ServletRequest request) + { + return new JakartaToJavaxMutableHttpServletRequest(newInstance(JakartaServletBridge.toJavax(request))); + } } diff --git a/xwiki-platform-core/xwiki-platform-wysiwyg/xwiki-platform-wysiwyg-api/src/main/java/org/xwiki/wysiwyg/internal/converter/DefaultRequestParameterConverter.java b/xwiki-platform-core/xwiki-platform-wysiwyg/xwiki-platform-wysiwyg-api/src/main/java/org/xwiki/wysiwyg/internal/converter/DefaultRequestParameterConverter.java index 35e868942b42..bd7c29e7cded 100644 --- a/xwiki-platform-core/xwiki-platform-wysiwyg/xwiki-platform-wysiwyg-api/src/main/java/org/xwiki/wysiwyg/internal/converter/DefaultRequestParameterConverter.java +++ b/xwiki-platform-core/xwiki-platform-wysiwyg/xwiki-platform-wysiwyg-api/src/main/java/org/xwiki/wysiwyg/internal/converter/DefaultRequestParameterConverter.java @@ -26,21 +26,22 @@ import javax.inject.Inject; import javax.inject.Singleton; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.xwiki.component.annotation.Component; import org.xwiki.wysiwyg.converter.HTMLConverter; -import org.xwiki.wysiwyg.converter.RequestParameterConversionResult; +import org.xwiki.wysiwyg.converter.JakartaRequestParameterConversionResult; import org.xwiki.wysiwyg.converter.RequestParameterConverter; -import org.xwiki.wysiwyg.filter.MutableServletRequest; +import org.xwiki.wysiwyg.filter.MutableJakartaServletRequest; import org.xwiki.wysiwyg.filter.MutableServletRequestFactory; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; + /** * Default implementation of {@link RequestParameterConverter} that handles HTML conversion of parameters needing such * conversion. @@ -87,22 +88,25 @@ public class DefaultRequestParameterConverter implements RequestParameterConvert @Override public Optional convert(ServletRequest request, ServletResponse response) throws IOException { - RequestParameterConversionResult conversionResult = this.convert(request); + JakartaRequestParameterConversionResult conversionResult = convert(request); Optional result; if (conversionResult.getErrors().isEmpty()) { result = Optional.of(conversionResult.getRequest()); } else { result = Optional.empty(); - this.handleConversionErrors(conversionResult, response); + handleConversionErrors(conversionResult, response); } + return result; } @Override - public RequestParameterConversionResult convert(ServletRequest request) + public JakartaRequestParameterConversionResult convert(ServletRequest request) { - MutableServletRequest mutableServletRequest = this.mutableServletRequestFactory.newInstance(request); - RequestParameterConversionResult result = new RequestParameterConversionResult(mutableServletRequest); + MutableJakartaServletRequest mutableServletRequest = this.mutableServletRequestFactory.newInstance(request); + JakartaRequestParameterConversionResult result = + new JakartaRequestParameterConversionResult(mutableServletRequest); + // Take the list of request parameters that require HTML conversion. String[] parametersRequiringHTMLConversion = request.getParameterValues(REQUIRES_HTML_CONVERSION); if (parametersRequiringHTMLConversion != null) { @@ -110,13 +114,14 @@ public RequestParameterConversionResult convert(ServletRequest request) result.getRequest().removeParameter(REQUIRES_HTML_CONVERSION); convertHTML(parametersRequiringHTMLConversion, result); } + return result; } private void convertHTML(String[] parametersRequiringHTMLConversion, - RequestParameterConversionResult conversionResult) + JakartaRequestParameterConversionResult conversionResult) { - MutableServletRequest request = conversionResult.getRequest(); + MutableJakartaServletRequest request = conversionResult.getRequest(); for (String parameterName : parametersRequiringHTMLConversion) { String html = request.getParameter(parameterName); // Remove the syntax parameter from the request to avoid interference with further request processing. @@ -135,13 +140,13 @@ private void convertHTML(String[] parametersRequiringHTMLConversion, } } - private void handleConversionErrors(RequestParameterConversionResult conversionResult, ServletResponse res) + private void handleConversionErrors(JakartaRequestParameterConversionResult conversionResult, ServletResponse res) throws IOException { - MutableServletRequest mutableRequest = conversionResult.getRequest(); + MutableJakartaServletRequest mutableRequest = conversionResult.getRequest(); ServletRequest originalRequest = mutableRequest.getRequest(); - if (originalRequest instanceof HttpServletRequest - && "XMLHttpRequest".equals(((HttpServletRequest) originalRequest).getHeader("X-Requested-With"))) { + if (originalRequest instanceof HttpServletRequest httpRequest + && "XMLHttpRequest".equals(httpRequest.getHeader("X-Requested-With"))) { // If this is an AJAX request then we should simply send back the error. StringBuilder errorMessage = new StringBuilder(); // Aggregate all error messages (for all fields that have conversion errors). @@ -184,11 +189,11 @@ private void handleConversionErrors(RequestParameterConversionResult conversionR * {@value #CONVERSION_ERRORS} session attributes */ @SuppressWarnings("unchecked") - private String save(RequestParameterConversionResult conversionResult) + private String save(JakartaRequestParameterConversionResult conversionResult) { // Generate a random key to identify the request. String key = RandomStringUtils.secure().nextAlphanumeric(4); - MutableServletRequest request = conversionResult.getRequest(); + MutableJakartaServletRequest request = conversionResult.getRequest(); // Save the output on the session. Map> conversionOutput = diff --git a/xwiki-platform-core/xwiki-platform-wysiwyg/xwiki-platform-wysiwyg-api/src/main/java/org/xwiki/wysiwyg/internal/filter/http/JakartaToJavaxMutableHttpServletRequest.java b/xwiki-platform-core/xwiki-platform-wysiwyg/xwiki-platform-wysiwyg-api/src/main/java/org/xwiki/wysiwyg/internal/filter/http/JakartaToJavaxMutableHttpServletRequest.java new file mode 100644 index 000000000000..8bfd894cdcc6 --- /dev/null +++ b/xwiki-platform-core/xwiki-platform-wysiwyg/xwiki-platform-wysiwyg-api/src/main/java/org/xwiki/wysiwyg/internal/filter/http/JakartaToJavaxMutableHttpServletRequest.java @@ -0,0 +1,93 @@ +/* + * See the NOTICE file distributed with this work for additional + * information regarding copyright ownership. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.xwiki.wysiwyg.internal.filter.http; + +import java.io.IOException; + +import org.xwiki.jakartabridge.servlet.JakartaServletBridge; +import org.xwiki.jakartabridge.servlet.internal.JakartaToJavaxServletRequest; +import org.xwiki.wysiwyg.filter.MutableJakartaServletRequest; +import org.xwiki.wysiwyg.filter.MutableServletRequest; + +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; + +/** + * @version $Id$ + */ +public class JakartaToJavaxMutableHttpServletRequest extends JakartaToJavaxServletRequest + implements MutableJakartaServletRequest +{ + /** + * @param wrapped + */ + public JakartaToJavaxMutableHttpServletRequest(MutableServletRequest wrapped) + { + super(wrapped); + } + + @Override + public String setParameter(String name, String value) + { + return this.wrapped.setParameter(name, value); + } + + @Override + public String[] setParameterValues(String name, String[] values) + { + return this.wrapped.setParameterValues(name, values); + } + + @Override + public String removeParameter(String name) + { + return this.wrapped.removeParameter(name); + } + + @Override + public void sendRedirect(ServletResponse response, String url) throws IOException + { + this.wrapped.sendRedirect(JakartaServletBridge.toJavax(response), url); + } + + @Override + public String getReferer() + { + return this.wrapped.getReferer(); + } + + @Override + public Object getSessionAttribute(String attrName) + { + return this.wrapped.getSessionAttribute(attrName); + } + + @Override + public Object setSessionAttribute(String attrName, Object attrValue) + { + return this.wrapped.setSessionAttribute(attrName, attrValue); + } + + @Override + public ServletRequest getRequest() + { + return JakartaServletBridge.toJakarta(this.wrapped.getRequest()); + } +} diff --git a/xwiki-platform-core/xwiki-platform-wysiwyg/xwiki-platform-wysiwyg-api/src/main/java/org/xwiki/wysiwyg/internal/filter/http/JavaxToJakartaMutableHttpServletRequest.java b/xwiki-platform-core/xwiki-platform-wysiwyg/xwiki-platform-wysiwyg-api/src/main/java/org/xwiki/wysiwyg/internal/filter/http/JavaxToJakartaMutableHttpServletRequest.java new file mode 100644 index 000000000000..5f31ca009817 --- /dev/null +++ b/xwiki-platform-core/xwiki-platform-wysiwyg/xwiki-platform-wysiwyg-api/src/main/java/org/xwiki/wysiwyg/internal/filter/http/JavaxToJakartaMutableHttpServletRequest.java @@ -0,0 +1,93 @@ +/* + * See the NOTICE file distributed with this work for additional + * information regarding copyright ownership. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.xwiki.wysiwyg.internal.filter.http; + +import java.io.IOException; + +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; + +import org.xwiki.jakartabridge.servlet.JakartaServletBridge; +import org.xwiki.jakartabridge.servlet.internal.JavaxToJakartaServletRequest; +import org.xwiki.wysiwyg.filter.MutableJakartaServletRequest; +import org.xwiki.wysiwyg.filter.MutableServletRequest; + +/** + * @version $Id$ + */ +public class JavaxToJakartaMutableHttpServletRequest extends JavaxToJakartaServletRequest + implements MutableServletRequest +{ + /** + * @param wrapped + */ + public JavaxToJakartaMutableHttpServletRequest(MutableJakartaServletRequest wrapped) + { + super(wrapped); + } + + @Override + public String setParameter(String name, String value) + { + return this.wrapped.setParameter(name, value); + } + + @Override + public String[] setParameterValues(String name, String[] values) + { + return this.wrapped.setParameterValues(name, values); + } + + @Override + public String removeParameter(String name) + { + return this.wrapped.removeParameter(name); + } + + @Override + public void sendRedirect(ServletResponse response, String url) throws IOException + { + this.wrapped.sendRedirect(JakartaServletBridge.toJakarta(response), url); + } + + @Override + public String getReferer() + { + return this.wrapped.getReferer(); + } + + @Override + public Object getSessionAttribute(String attrName) + { + return this.wrapped.getSessionAttribute(attrName); + } + + @Override + public Object setSessionAttribute(String attrName, Object attrValue) + { + return this.wrapped.setSessionAttribute(attrName, attrValue); + } + + @Override + public ServletRequest getRequest() + { + return JakartaServletBridge.toJavax(this.wrapped.getRequest()); + } +} diff --git a/xwiki-platform-core/xwiki-platform-wysiwyg/xwiki-platform-wysiwyg-api/src/main/java/org/xwiki/wysiwyg/internal/filter/http/MutableHttpServletRequestFactory.java b/xwiki-platform-core/xwiki-platform-wysiwyg/xwiki-platform-wysiwyg-api/src/main/java/org/xwiki/wysiwyg/internal/filter/http/MutableHttpServletRequestFactory.java index 8e5338691ccd..a15eedecf938 100644 --- a/xwiki-platform-core/xwiki-platform-wysiwyg/xwiki-platform-wysiwyg-api/src/main/java/org/xwiki/wysiwyg/internal/filter/http/MutableHttpServletRequestFactory.java +++ b/xwiki-platform-core/xwiki-platform-wysiwyg/xwiki-platform-wysiwyg-api/src/main/java/org/xwiki/wysiwyg/internal/filter/http/MutableHttpServletRequestFactory.java @@ -19,14 +19,13 @@ */ package org.xwiki.wysiwyg.internal.filter.http; -import javax.inject.Singleton; -import javax.servlet.ServletRequest; -import javax.servlet.http.HttpServletRequest; - import org.xwiki.component.annotation.Component; -import org.xwiki.wysiwyg.filter.MutableServletRequest; +import org.xwiki.wysiwyg.filter.MutableJakartaServletRequest; import org.xwiki.wysiwyg.filter.MutableServletRequestFactory; +import jakarta.inject.Singleton; +import jakarta.servlet.http.HttpServletRequest; + /** * {@link MutableServletRequestFactory} implementation for the HTTP protocol. * @@ -37,10 +36,10 @@ public class MutableHttpServletRequestFactory implements MutableServletRequestFactory { @Override - public synchronized MutableServletRequest newInstance(ServletRequest request) + public synchronized MutableJakartaServletRequest newInstance(jakarta.servlet.ServletRequest request) { - if (request instanceof HttpServletRequest) { - return new MutableHttpServletRequest((HttpServletRequest) request); + if (request instanceof HttpServletRequest httpRequest) { + return new MutableJakartaHttpServletRequest(httpRequest); } else { throw new IllegalArgumentException(String.format("Expecting HttpServletRequest, got [%s]!", request)); } diff --git a/xwiki-platform-core/xwiki-platform-wysiwyg/xwiki-platform-wysiwyg-api/src/main/java/org/xwiki/wysiwyg/internal/filter/http/MutableHttpServletRequest.java b/xwiki-platform-core/xwiki-platform-wysiwyg/xwiki-platform-wysiwyg-api/src/main/java/org/xwiki/wysiwyg/internal/filter/http/MutableJakartaHttpServletRequest.java similarity index 87% rename from xwiki-platform-core/xwiki-platform-wysiwyg/xwiki-platform-wysiwyg-api/src/main/java/org/xwiki/wysiwyg/internal/filter/http/MutableHttpServletRequest.java rename to xwiki-platform-core/xwiki-platform-wysiwyg/xwiki-platform-wysiwyg-api/src/main/java/org/xwiki/wysiwyg/internal/filter/http/MutableJakartaHttpServletRequest.java index a67bea9dae75..9ead0430ad0a 100644 --- a/xwiki-platform-core/xwiki-platform-wysiwyg/xwiki-platform-wysiwyg-api/src/main/java/org/xwiki/wysiwyg/internal/filter/http/MutableHttpServletRequest.java +++ b/xwiki-platform-core/xwiki-platform-wysiwyg/xwiki-platform-wysiwyg-api/src/main/java/org/xwiki/wysiwyg/internal/filter/http/MutableJakartaHttpServletRequest.java @@ -25,33 +25,33 @@ import java.util.HashMap; import java.util.Map; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletRequestWrapper; -import javax.servlet.http.HttpServletResponse; - +import org.xwiki.wysiwyg.filter.MutableJakartaServletRequest; import org.xwiki.wysiwyg.filter.MutableServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequestWrapper; +import jakarta.servlet.http.HttpServletResponse; + /** * {@link MutableServletRequest} implementation for the HTTP protocol. * * @version $Id$ */ -public class MutableHttpServletRequest extends HttpServletRequestWrapper implements MutableServletRequest +public class MutableJakartaHttpServletRequest extends HttpServletRequestWrapper implements MutableJakartaServletRequest { /** * Parameters used instead of those from the wrapped request. This way exiting request parameters can be overwritten * and also new parameters can be added. */ - private final Map params = new HashMap(); + private final Map params = new HashMap<>(); /** * Wraps the specified request and copies its parameters to {@link #params} where they can be overwritten later. * * @param request The request to be wrapped. */ - @SuppressWarnings("unchecked") - public MutableHttpServletRequest(HttpServletRequest request) + public MutableJakartaHttpServletRequest(HttpServletRequest request) { super(request); diff --git a/xwiki-platform-core/xwiki-platform-zipexplorer/pom.xml b/xwiki-platform-core/xwiki-platform-zipexplorer/pom.xml index b582e0851d6c..322330809246 100644 --- a/xwiki-platform-core/xwiki-platform-zipexplorer/pom.xml +++ b/xwiki-platform-core/xwiki-platform-zipexplorer/pom.xml @@ -40,9 +40,10 @@ ${project.version} - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api + org.xwiki.platform @@ -51,11 +52,6 @@ pom test - diff --git a/xwiki-platform-distribution/xwiki-platform-distribution-flavor/xwiki-platform-distribution-flavor-data/pom.xml b/xwiki-platform-distribution/xwiki-platform-distribution-flavor/xwiki-platform-distribution-flavor-data/pom.xml index 4aa0af65ce3a..723ea9071ec4 100644 --- a/xwiki-platform-distribution/xwiki-platform-distribution-flavor/xwiki-platform-distribution-flavor-data/pom.xml +++ b/xwiki-platform-distribution/xwiki-platform-distribution-flavor/xwiki-platform-distribution-flavor-data/pom.xml @@ -209,18 +209,6 @@ xwiki-platform-notifications-preferences-default ${project.version} - - - javax.servlet - javax.servlet-api - ${servlet.version} - - - org.mortbay.jasper - apache-el - ${apachache-el.version} - org.xwiki.platform diff --git a/xwiki-platform-distribution/xwiki-platform-distribution-flavor/xwiki-platform-distribution-flavor-test/xwiki-platform-distribution-flavor-test-security/pom.xml b/xwiki-platform-distribution/xwiki-platform-distribution-flavor/xwiki-platform-distribution-flavor-test/xwiki-platform-distribution-flavor-test-security/pom.xml index 72381caa10ac..4c0624c9bee0 100644 --- a/xwiki-platform-distribution/xwiki-platform-distribution-flavor/xwiki-platform-distribution-flavor-test/xwiki-platform-distribution-flavor-test-security/pom.xml +++ b/xwiki-platform-distribution/xwiki-platform-distribution-flavor/xwiki-platform-distribution-flavor-test/xwiki-platform-distribution-flavor-test-security/pom.xml @@ -62,8 +62,8 @@ test - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api test diff --git a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/README.md b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/README.md index 49c732b8b242..179497b65a8f 100644 --- a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/README.md +++ b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/README.md @@ -3,38 +3,14 @@ XWiki Jetty Configuration These instructions are useful when upgrading the Jetty version used. -We brought the following changes from the default Jetty files obtained from the Jetty zip file (in `jetty-home`): +We brought the following changes from the default Jetty files obtained from the `org.eclipse.jetty:jetty-home` package: -1. Addition of XWiki license headers to all files 1. Addition of `modules/xwiki.mod`, to group all modules we depend on. 1. Addition of `start.d/xwiki.ini` to configure the following properties: - 1. Disable WAR scanning/hot deployment (since we use static deployment, and it speeds up - Jetty) by changing the default values for: - ``` - jetty.deploy.scanInterval=0 - jetty.deploy.extractWars=false - ``` + 1. Disable WAR scanning/hot deployment (since we use static deployment, and it speeds up Jetty). 1. Configure Jetty to use RFC3986 for URLs + allow for ambiguous elements in the URLs as XWiki currently needs them (see the doc in start.d/xwiki.ini). - ``` - jetty.httpConfig.uriCompliance=RFC3986,AMBIGUOUS_PATH_ENCODING,AMBIGUOUS_EMPTY_SEGMENT,AMBIGUOUS_PATH_SEPARATOR - ``` 1. Addition of `etc/jetty-xwiki.xml` to print a message in the console when XWiki is started. -1. Remove support for JSP (since XWiki doesn't use JSPs) by: - 1. Removing the following from `etc/webdefault-ee8.xml`: - ``` - - ... - - ``` - Also remove the `` just below it. - Under `` alors remove the `index.jsp` line. - 1. Keep only the `apache-el-` lib in `modules/ee8-apache-jsp.mod` (i.e. remove the JSP lib references). - We need the EL lib for Hibernate Validator (see XWIKI-19314) -1. Remove alpn (we don't need TLS/SSL for a demo packaging) and http2 support by: - 1. Remove `lib/jetty-alpn-client-${jetty.version}.jar` from `modules/client.mod` - 1. Remove references to the `alpn` and `http2` modules from `modules/https.mod` -1. Addition of `modules/xwiki-logging.mod` to configure logging for XWiki (provides the Jetty `logging` module name) 1. Modification of `etc/console-capture.xml` to send logs to both the console and files. Namely, we wrap: ``` @@ -54,6 +30,6 @@ We brought the following changes from the default Jetty files obtained from the - ``` -1. Note that we don't include all `etc/*.xml` files nor all `modules/*.mod` files since we don't use these extra - features. + ``` + This also means adding commons-io to Jetty. +1. In the pom.xml, we exclude various files we know we don't need in this context, to reduce the size of the resulting zip file \ No newline at end of file diff --git a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/pom.xml b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/pom.xml index c069c2d43f53..76fa1de9ea27 100644 --- a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/pom.xml +++ b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/pom.xml @@ -32,114 +32,92 @@ pom Packages a Jetty installation - - true - ${jetty.server.version} - ${jetty.server.slf4j.version} + + + org.eclipse.jetty + jetty-home + ${jetty.server.version} + zip + + + + * + * + + + org.xwiki.platform xwiki-platform-tool-jetty-listener ${project.version} true - commons-io commons-io true - - org.eclipse.jetty - jetty-server - ${jetty.version} - true - - - org.eclipse.jetty - jetty-xml - ${jetty.version} - true - - - org.eclipse.jetty - jetty-deploy - ${jetty.version} - true - - - org.eclipse.jetty - jetty-start - ${jetty.version} - shaded - true - - - org.eclipse.jetty - jetty-jmx - ${jetty.version} - true - - - org.eclipse.jetty.ee8 - jetty-ee8-annotations - ${jetty.version} - true - - - org.eclipse.jetty - jetty-plus - ${jetty.version} - true - - - org.eclipse.jetty - jetty-jndi - ${jetty.version} - true - - - org.eclipse.jetty - jetty-slf4j-impl - ${jetty.version} - true - - - org.eclipse.jetty - jetty-client - ${jetty.version} - true - - - - org.eclipse.jetty.ee8.websocket - jetty-ee8-websocket-javax-server - ${jetty.version} - true - - - org.eclipse.jetty.ee8.websocket - jetty-ee8-websocket-javax-client - ${jetty.version} - true - - - - org.mortbay.jasper - apache-el - true - compile - + + + org.apache.maven.plugins + maven-dependency-plugin + + + unpack + prepare-package + + unpack + + + + + org.eclipse.jetty + jetty-home + ${jetty.server.version} + zip + + + **/*demo*, + **/*demo*/, + + **/*ee8*, + **/*ee8*/, + **/*ee9*, + **/*ee9*/, + + **/*http2*, + **/*http2*/, + + **/*http3*, + **/*http3*/, + + **/*cdi*, + **/*cdi*/, + + **/*jstl*, + **/*jstl*/ + + + + ${project.build.directory} + + + + + + org.apache.maven.plugins maven-assembly-plugin @@ -149,7 +127,7 @@ false - ${basedir}/src/main/assembly/distribution.xml + src/main/assembly/distribution.xml diff --git a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/assembly/distribution.xml b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/assembly/distribution.xml index e2536127335e..42a98277a980 100644 --- a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/assembly/distribution.xml +++ b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/assembly/distribution.xml @@ -26,89 +26,24 @@ zip false - - - - start.jar - /jetty - - org.eclipse.jetty:jetty-start:jar:shaded - - - false - - - /jetty/lib + + + + + ${basedir}/src/main/resources + / - org.eclipse.jetty:jetty-start:jar:shaded - - org.xwiki.platform:xwiki-platform-tool-jetty-listener - commons-io:commons-io - - org.ow2.asm:* - jakarta.annotation:jakarta.annotation-api - - org.slf4j:slf4j-api - org.eclipse.jetty:jetty-slf4j-impl - - org.eclipse.jetty.ee8.websocket:* - *:jetty-javax-websocket-api - - org.mortbay.jasper:apache-el + **/*.sh - - false - - - /jetty/lib/ext - - org.xwiki.platform:xwiki-platform-tool-jetty-listener - commons-io:commons-io - - - false - - - /jetty/lib/ee8-annotations - - org.ow2.asm:* - jakarta.annotation:jakarta.annotation-api - - - false - - - /jetty/lib/ee8-websocket - - org.eclipse.jetty.ee8.websocket:* - *:jetty-javax-websocket-api - - - false - - - - /jetty/lib/logging - - org.slf4j:slf4j-api - org.eclipse.jetty:jetty-slf4j-impl - - - false - - - - - /jetty/lib/ee8-apache-jsp - - org.mortbay.jasper:apache-el - - - false - - - + + + + + ${project.build.directory}/jetty-home-${jetty.server.version} + /jetty/ + 644 + + ${basedir}/src/main/resources @@ -118,18 +53,25 @@ 755 - - - ${basedir}/src/main/resources - / - - **/*.sh - - + ${basedir}/src/main/resources/logs /logs + + + + /jetty/lib/ext + + + org.xwiki.platform:xwiki-platform-tool-jetty-listener + + commons-io:commons-io + + + false + + diff --git a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/etc/jetty-bytebufferpool.xml b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/etc/jetty-bytebufferpool.xml deleted file mode 100644 index dbde985be754..000000000000 --- a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/etc/jetty-bytebufferpool.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/etc/jetty-deploy.xml b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/etc/jetty-deploy.xml deleted file mode 100644 index 4a9d32146b28..000000000000 --- a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/etc/jetty-deploy.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/etc/jetty-ee-webapp.xml b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/etc/jetty-ee-webapp.xml deleted file mode 100644 index 3b94f5cffb91..000000000000 --- a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/etc/jetty-ee-webapp.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/etc/jetty-ee8-deploy.xml b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/etc/jetty-ee8-deploy.xml deleted file mode 100644 index 1b3f910a1548..000000000000 --- a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/etc/jetty-ee8-deploy.xml +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - - - - - - - org.eclipse.jetty.deploy.DeploymentManager - - - - contextHandlerClass - - - - - - - - ee8 - - - - - - - - - - - - - jetty.deploy.defaultsDescriptorPath - jetty.deploy.defaultsDescriptor - - /etc/webdefault-ee8.xml - - - - - - - - - - - .*/jetty-servlet-api-[^/]*\.jar$|.*jakarta.servlet.jsp.jstl-[^/]*\.jar|.*jsp.jstl-[^/]*\.jar - - - - - - - - - - - - - - - - - diff --git a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/etc/jetty-ee8-webapp.xml b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/etc/jetty-ee8-webapp.xml deleted file mode 100644 index 0bd5e05b400d..000000000000 --- a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/etc/jetty-ee8-webapp.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/etc/jetty-http-forwarded.xml b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/etc/jetty-http-forwarded.xml deleted file mode 100644 index cbb0632d1294..000000000000 --- a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/etc/jetty-http-forwarded.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/etc/jetty-http.xml b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/etc/jetty-http.xml deleted file mode 100644 index 1cc65d7ef341..000000000000 --- a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/etc/jetty-http.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/etc/jetty-https.xml b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/etc/jetty-https.xml deleted file mode 100644 index 13f9cd9698d9..000000000000 --- a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/etc/jetty-https.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - http/1.1 - - - - - - - - - - - - - - diff --git a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/etc/jetty-jmx.xml b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/etc/jetty-jmx.xml deleted file mode 100644 index 290b15494332..000000000000 --- a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/etc/jetty-jmx.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/etc/jetty-requestlog.xml b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/etc/jetty-requestlog.xml deleted file mode 100644 index d3417016fb34..000000000000 --- a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/etc/jetty-requestlog.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - /yyyy_mm_dd.request.log - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/etc/jetty-ssl-context.xml b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/etc/jetty-ssl-context.xml deleted file mode 100644 index 23e527475faf..000000000000 --- a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/etc/jetty-ssl-context.xml +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/etc/jetty-ssl.xml b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/etc/jetty-ssl.xml deleted file mode 100644 index ffc314cc87b8..000000000000 --- a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/etc/jetty-ssl.xml +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/etc/jetty-threadpool.xml b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/etc/jetty-threadpool.xml deleted file mode 100644 index b79642525278..000000000000 --- a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/etc/jetty-threadpool.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/etc/jetty.xml b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/etc/jetty.xml deleted file mode 100644 index c8cfd3c9c498..000000000000 --- a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/etc/jetty.xml +++ /dev/null @@ -1,119 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/etc/sessions/id-manager.xml b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/etc/sessions/id-manager.xml deleted file mode 100644 index a4841e55da73..000000000000 --- a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/etc/sessions/id-manager.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - - - - - - - - - - - - node - - - 0 - - - - - - - - - - - - - - - - - - true - - diff --git a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/etc/webdefault-ee8.xml b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/etc/webdefault-ee8.xml deleted file mode 100644 index 214b9f6a3805..000000000000 --- a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/etc/webdefault-ee8.xml +++ /dev/null @@ -1,414 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - Default web.xml file. - This file is applied to a Web application before its own WEB_INF/web.xml file - - - - - - - - org.eclipse.jetty.ee8.servlet.listener.IntrospectorCleaner - - - - - - - - - - - - - - - - - default - org.eclipse.jetty.ee8.servlet.DefaultServlet - - acceptRanges - true - - - dirAllowed - true - - - welcomeServlets - false - - - redirectWelcome - false - - - maxCacheSize - 256000000 - - - maxCachedFileSize - 200000000 - - - maxCachedFiles - 2048 - - - etags - false - - - useFileMappedBuffer - true - - 0 - - - - default - / - - - - - - - - 30 - - - - - - - - - - - - - - - index.html - index.htm - - - - - - - - ar - ISO-8859-6 - - - be - ISO-8859-5 - - - bg - ISO-8859-5 - - - ca - ISO-8859-1 - - - cs - ISO-8859-2 - - - da - ISO-8859-1 - - - de - ISO-8859-1 - - - el - ISO-8859-7 - - - en - ISO-8859-1 - - - es - ISO-8859-1 - - - et - ISO-8859-1 - - - fi - ISO-8859-1 - - - fr - ISO-8859-1 - - - hr - ISO-8859-2 - - - hu - ISO-8859-2 - - - is - ISO-8859-1 - - - it - ISO-8859-1 - - - iw - ISO-8859-8 - - - ja - Shift_JIS - - - ko - EUC-KR - - - lt - ISO-8859-2 - - - lv - ISO-8859-2 - - - mk - ISO-8859-5 - - - nl - ISO-8859-1 - - - no - ISO-8859-1 - - - pl - ISO-8859-2 - - - pt - ISO-8859-1 - - - ro - ISO-8859-2 - - - ru - ISO-8859-5 - - - sh - ISO-8859-5 - - - sk - ISO-8859-2 - - - sl - ISO-8859-2 - - - sq - ISO-8859-2 - - - sr - ISO-8859-5 - - - sv - ISO-8859-1 - - - tr - ISO-8859-9 - - - uk - ISO-8859-5 - - - zh - GB2312 - - - zh_TW - Big5 - - - - - - - - - Disable TRACE - / - TRACE - - - - - - Enable everything but TRACE - / - TRACE - - - - - diff --git a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/etc/jetty-xwiki.xml b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/etc/xwiki.xml similarity index 100% rename from xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/etc/jetty-xwiki.xml rename to xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/etc/xwiki.xml diff --git a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/bytebufferpool.mod b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/bytebufferpool.mod deleted file mode 100644 index 10c542541d88..000000000000 --- a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/bytebufferpool.mod +++ /dev/null @@ -1,58 +0,0 @@ -# --------------------------------------------------------------------------- -# See the NOTICE file distributed with this work for additional -# information regarding copyright ownership. -# -# This is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as -# published by the Free Software Foundation; either version 2.1 of -# the License, or (at your option) any later version. -# -# This software is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this software; if not, write to the Free -# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -# 02110-1301 USA, or see the FSF site: http://www.fsf.org. -# --------------------------------------------------------------------------- - -# DO NOT EDIT - See: https://jetty.org/docs/index.html - -[description] -Configures the ByteBufferPool used by ServerConnectors. -The bucket sizes increase linearly. -Use module "bytebufferpool-quadratic" for a pool that holds more coarse sized buffers. - -[depends] -logging - -[xml] -etc/jetty-bytebufferpool.xml - -[ini-template] -## Minimum capacity of a single ByteBuffer. -#jetty.byteBufferPool.minCapacity=0 - -## Maximum capacity of a single ByteBuffer. -## Requests for ByteBuffers larger than this value results -## in the ByteBuffer being allocated but not pooled. -#jetty.byteBufferPool.maxCapacity=65536 - -## Bucket capacity factor. -## ByteBuffers are allocated out of buckets that have -## a capacity that is multiple of this factor. -#jetty.byteBufferPool.factor=4096 - -## Maximum size for each bucket (-1 for unbounded). -#jetty.byteBufferPool.maxBucketSize=-1 - -## Maximum heap memory held idle by the pool (0 for heuristic, -1 for unlimited). -#jetty.byteBufferPool.maxHeapMemory=0 - -## Maximum direct memory held idle by the pool (0 for heuristic, -1 for unlimited). -#jetty.byteBufferPool.maxDirectMemory=0 - -## Whether statistics are enabled. -#jetty.byteBufferPool.statisticsEnabled=false diff --git a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/client.mod b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/client.mod deleted file mode 100644 index 900043c9e9c9..000000000000 --- a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/client.mod +++ /dev/null @@ -1,27 +0,0 @@ -# --------------------------------------------------------------------------- -# See the NOTICE file distributed with this work for additional -# information regarding copyright ownership. -# -# This is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as -# published by the Free Software Foundation; either version 2.1 of -# the License, or (at your option) any later version. -# -# This software is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this software; if not, write to the Free -# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -# 02110-1301 USA, or see the FSF site: http://www.fsf.org. -# --------------------------------------------------------------------------- - -# DO NOT EDIT - See: https://jetty.org/docs/index.html - -[description] -Adds the Jetty HTTP client to the server classpath. - -[lib] -lib/jetty-client-${jetty.version}.jar diff --git a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/console-capture.mod b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/console-capture.mod deleted file mode 100644 index fb78cc48564f..000000000000 --- a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/console-capture.mod +++ /dev/null @@ -1,51 +0,0 @@ -# --------------------------------------------------------------------------- -# See the NOTICE file distributed with this work for additional -# information regarding copyright ownership. -# -# This is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as -# published by the Free Software Foundation; either version 2.1 of -# the License, or (at your option) any later version. -# -# This software is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this software; if not, write to the Free -# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -# 02110-1301 USA, or see the FSF site: http://www.fsf.org. -# --------------------------------------------------------------------------- - -# DO NOT EDIT - See: https://jetty.org/docs/index.html - -[description] -Redirects the JVM console stderr and stdout to a rolling log file. - -[tags] -logging - -[depends] -logging - -[xml] -etc/console-capture.xml - -[files] -logs/ - -[ini-template] -# tag::documentation[] -## Logging directory (relative to $JETTY_BASE). -# jetty.console-capture.dir=./logs - -## Whether to append to existing file. -# jetty.console-capture.append=true - -## How many days to retain old log files. -# jetty.console-capture.retainDays=90 - -## Timezone ID of the log timestamps, as specified by java.time.ZoneId. -# jetty.console-capture.timezone=GMT -# end::documentation[] diff --git a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/deploy.mod b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/deploy.mod deleted file mode 100644 index 716e9f0629da..000000000000 --- a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/deploy.mod +++ /dev/null @@ -1,37 +0,0 @@ -# --------------------------------------------------------------------------- -# See the NOTICE file distributed with this work for additional -# information regarding copyright ownership. -# -# This is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as -# published by the Free Software Foundation; either version 2.1 of -# the License, or (at your option) any later version. -# -# This software is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this software; if not, write to the Free -# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -# 02110-1301 USA, or see the FSF site: http://www.fsf.org. -# --------------------------------------------------------------------------- - -# DO NOT EDIT - See: https://jetty.org/docs/index.html - -[description] -This module enables web application deployment from the `$JETTY_BASE/webapps` directory. - -[depend] -server - -[lib] -lib/jetty-deploy-${jetty.version}.jar - -[files] -webapps/ - -[xml] -etc/jetty-deploy.xml - diff --git a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/ee-webapp.mod b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/ee-webapp.mod deleted file mode 100644 index 0a664334541f..000000000000 --- a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/ee-webapp.mod +++ /dev/null @@ -1,51 +0,0 @@ -# --------------------------------------------------------------------------- -# See the NOTICE file distributed with this work for additional -# information regarding copyright ownership. -# -# This is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as -# published by the Free Software Foundation; either version 2.1 of -# the License, or (at your option) any later version. -# -# This software is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this software; if not, write to the Free -# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -# 02110-1301 USA, or see the FSF site: http://www.fsf.org. -# --------------------------------------------------------------------------- - -# DO NOT EDIT - See: https://jetty.org/docs/index.html - -[description] -# tag::description[] -This module provide common configuration of Java Servlet web applications over all environments. -# end::description[] - -[xml] -etc/jetty-ee-webapp.xml - -[lib] -lib/jetty-ee-${jetty.version}.jar - -[ini-template] -# tag::ini-template[] -## Add to the server wide default jars and packages protected or hidden from webapps. -## Protected (aka System) classes cannot be overridden by a webapp. -## Hidden (aka Server) classes cannot be seen by a webapp -## Lists of patterns are comma separated and may be either: -## + a qualified classname e.g. 'com.acme.Foo' -## + a package name e.g. 'net.example.' -## + a jar file e.g. '${jetty.base.uri}/lib/dependency.jar' -## + a directory of jars,resource or classes e.g. '${jetty.base.uri}/resources' -## + A pattern preceded with a '-' is an exclusion, all other patterns are inclusions -## -## The +=, operator appends to a CSV list with a comma as needed. -## -#jetty.server.addProtectedClasses+=,org.example. -#jetty.server.addHiddenClasses+=,org.example. -# end::ini-template[] - diff --git a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/ee8-annotations.mod b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/ee8-annotations.mod deleted file mode 100644 index 0e0c0d75d7c8..000000000000 --- a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/ee8-annotations.mod +++ /dev/null @@ -1,47 +0,0 @@ -# --------------------------------------------------------------------------- -# See the NOTICE file distributed with this work for additional -# information regarding copyright ownership. -# -# This is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as -# published by the Free Software Foundation; either version 2.1 of -# the License, or (at your option) any later version. -# -# This software is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this software; if not, write to the Free -# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -# 02110-1301 USA, or see the FSF site: http://www.fsf.org. -# --------------------------------------------------------------------------- - -# DO NOT EDIT - See: https://jetty.org/docs/index.html - -[description] -Enables Annotation scanning for deployed web applications. - -[environment] -ee8 - -[depend] -plus -ee8-plus - -[ini] -ee8.asm.version?=9.7 -ee8.jakarta.annotation.api.version?=1.3.5 - -[lib] -lib/jetty-ee8-annotations-${jetty.version}.jar -lib/ee8-annotations/asm-${ee8.asm.version}.jar -lib/ee8-annotations/asm-analysis-${ee8.asm.version}.jar -lib/ee8-annotations/asm-commons-${ee8.asm.version}.jar -lib/ee8-annotations/asm-tree-${ee8.asm.version}.jar -lib/ee8-annotations/jakarta.annotation-api-${ee8.jakarta.annotation.api.version}.jar - -[jpms] -add-modules:org.objectweb.asm - diff --git a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/ee8-apache-jsp.mod b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/ee8-apache-jsp.mod deleted file mode 100644 index a9bca961861a..000000000000 --- a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/ee8-apache-jsp.mod +++ /dev/null @@ -1,37 +0,0 @@ -# --------------------------------------------------------------------------- -# See the NOTICE file distributed with this work for additional -# information regarding copyright ownership. -# -# This is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as -# published by the Free Software Foundation; either version 2.1 of -# the License, or (at your option) any later version. -# -# This software is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this software; if not, write to the Free -# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -# 02110-1301 USA, or see the FSF site: http://www.fsf.org. -# --------------------------------------------------------------------------- - -# DO NOT EDIT - See: https://jetty.org/docs/index.html - -[description] -Enables use of the apache implementation of JSP. - -[environment] -ee8 - -[depend] -ee8-servlet -ee8-annotations - -[ini] -ee8.jsp.impl.version?=9.0.90 - -[lib] -lib/ee8-apache-jsp/apache-el-${ee8.jsp.impl.version}.jar diff --git a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/ee8-deploy.mod b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/ee8-deploy.mod deleted file mode 100644 index 371d5789183a..000000000000 --- a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/ee8-deploy.mod +++ /dev/null @@ -1,69 +0,0 @@ -# --------------------------------------------------------------------------- -# See the NOTICE file distributed with this work for additional -# information regarding copyright ownership. -# -# This is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as -# published by the Free Software Foundation; either version 2.1 of -# the License, or (at your option) any later version. -# -# This software is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this software; if not, write to the Free -# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -# 02110-1301 USA, or see the FSF site: http://www.fsf.org. -# --------------------------------------------------------------------------- - -# DO NOT EDIT - See: https://jetty.org/docs/index.html - -[description] -# tag::description[] -This module enables webapp deployment from the `$JETTY_BASE/webapps` directory. -# end::description[] - -[environment] -ee8 - -[depend] -deploy -ee8-webapp - -[xml] -etc/jetty-ee8-deploy.xml - -[ini-template] -# tag::ini-template[] -## Monitored directory name (relative to $jetty.base) -# jetty.deploy.monitoredDir=webapps - -## Defaults Descriptor for all deployed webapps -# jetty.deploy.defaultsDescriptorPath=${jetty.base}/etc/webdefault-ee8.xml - -## Monitored directory scan period (seconds) -# jetty.deploy.scanInterval=0 - -## Whether to extract *.war files -# jetty.deploy.extractWars=true - -## Whether to give the parent classloader priority -# jetty.deploy.parentLoaderPriority=true - -## Comma separated list of configuration classes to set. -# jetty.deploy.configurationClasses= - -## Pattern to select jars from the container classloader to be scanned (or null to scan no jars) -# jetty.deploy.containerScanJarPattern=.*/jetty-servlet-api-[^/]*\.jar$|.*/javax.servlet.jsp.jstl-.*\.jar$ - -## Pattern to select jars from the container classloader to be scanned (or null to scan all jars). -# jetty.deploy.webInfScanJarPattern= - -## Pattern to exclude discovered ServletContainerInitializers -# jetty.deploy.servletContainerInitializerExclusionPattern= - -## Order of discovered ServletContainerInitializers -# jetty.deploy.servletContainerInitializerOrder= -# end::ini-template[] diff --git a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/ee8-jndi.mod b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/ee8-jndi.mod deleted file mode 100644 index 9135ddf9f42e..000000000000 --- a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/ee8-jndi.mod +++ /dev/null @@ -1,33 +0,0 @@ -# --------------------------------------------------------------------------- -# See the NOTICE file distributed with this work for additional -# information regarding copyright ownership. -# -# This is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as -# published by the Free Software Foundation; either version 2.1 of -# the License, or (at your option) any later version. -# -# This software is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this software; if not, write to the Free -# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -# 02110-1301 USA, or see the FSF site: http://www.fsf.org. -# --------------------------------------------------------------------------- - -# DO NOT EDIT - See: https://jetty.org/docs/index.html - -[description] -Adds the Jetty EE8 JNDI reference factories - -[environment] -ee8 - -[depend] -jndi - -[lib] -lib/jetty-ee8-jndi-${jetty.version}.jar diff --git a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/ee8-plus.mod b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/ee8-plus.mod deleted file mode 100644 index 9cc1f0d8fb9e..000000000000 --- a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/ee8-plus.mod +++ /dev/null @@ -1,38 +0,0 @@ -# --------------------------------------------------------------------------- -# See the NOTICE file distributed with this work for additional -# information regarding copyright ownership. -# -# This is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as -# published by the Free Software Foundation; either version 2.1 of -# the License, or (at your option) any later version. -# -# This software is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this software; if not, write to the Free -# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -# 02110-1301 USA, or see the FSF site: http://www.fsf.org. -# --------------------------------------------------------------------------- - -# DO NOT EDIT - See: https://jetty.org/docs/index.html - -[description] -Enables Servlet 3.1 resource injection. - -[environment] -ee8 - -[depend] -server -jndi -plus -ee8-security -ee8-webapp - -[lib] -lib/jetty-ee8-plus-${jetty.version}.jar -lib/jakarta.transaction-api-1.3.3.jar diff --git a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/ee8-security.mod b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/ee8-security.mod deleted file mode 100644 index b334fae5a064..000000000000 --- a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/ee8-security.mod +++ /dev/null @@ -1,35 +0,0 @@ -# --------------------------------------------------------------------------- -# See the NOTICE file distributed with this work for additional -# information regarding copyright ownership. -# -# This is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as -# published by the Free Software Foundation; either version 2.1 of -# the License, or (at your option) any later version. -# -# This software is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this software; if not, write to the Free -# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -# 02110-1301 USA, or see the FSF site: http://www.fsf.org. -# --------------------------------------------------------------------------- - -# DO NOT EDIT - See: https://jetty.org/docs/index.html - -[description] -Adds servlet standard security handling to the classpath. - -[environment] -ee8 - -[depend] -server -security -ee8-servlet - -[lib] -lib/jetty-ee8-security-${jetty.version}.jar diff --git a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/ee8-servlet.mod b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/ee8-servlet.mod deleted file mode 100644 index 28eaecb54d28..000000000000 --- a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/ee8-servlet.mod +++ /dev/null @@ -1,36 +0,0 @@ -# --------------------------------------------------------------------------- -# See the NOTICE file distributed with this work for additional -# information regarding copyright ownership. -# -# This is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as -# published by the Free Software Foundation; either version 2.1 of -# the License, or (at your option) any later version. -# -# This software is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this software; if not, write to the Free -# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -# 02110-1301 USA, or see the FSF site: http://www.fsf.org. -# --------------------------------------------------------------------------- - -# DO NOT EDIT - See: https://jetty.org/docs/index.html - -[description] -Enables standard Servlet handling. - -[environment] -ee8 - -[depend] -server -sessions - -[lib] -lib/jetty-servlet-api-4.0.6.jar -lib/jetty-ee8-nested-${jetty.version}.jar -lib/jetty-ee8-servlet-${jetty.version}.jar diff --git a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/ee8-webapp.mod b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/ee8-webapp.mod deleted file mode 100644 index 5645f4d3822f..000000000000 --- a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/ee8-webapp.mod +++ /dev/null @@ -1,61 +0,0 @@ -# --------------------------------------------------------------------------- -# See the NOTICE file distributed with this work for additional -# information regarding copyright ownership. -# -# This is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as -# published by the Free Software Foundation; either version 2.1 of -# the License, or (at your option) any later version. -# -# This software is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this software; if not, write to the Free -# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -# 02110-1301 USA, or see the FSF site: http://www.fsf.org. -# --------------------------------------------------------------------------- - -# DO NOT EDIT - See: https://jetty.org/docs/index.html - -[description] -Adds support for servlet specification web applications to the server classpath. -Without this, only Jetty-specific handlers may be deployed. - -[environment] -ee8 - -[depend] -ee-webapp -ee8-servlet -ee8-security - -[xml] -etc/jetty-ee8-webapp.xml - -[lib] -lib/jetty-ee8-webapp-${jetty.version}.jar - -[ini-template] -## Add to the environment wide default jars and packages protected or hidden from webapps. -## System (aka Protected) classes cannot be overridden by a webapp. -## Server (aka Hidden) classes cannot be seen by a webapp -## Lists of patterns are comma separated and may be either: -## + a qualified classname e.g. 'com.acme.Foo' -## + a package name e.g. 'net.example.' -## + a jar file e.g. '${jetty.base.uri}/lib/dependency.jar' -## + a directory of jars,resource or classes e.g. '${jetty.base.uri}/resources' -## + A pattern preceded with a '-' is an exclusion, all other patterns are inclusions -## -## The +=, operator appends to a CSV list with a comma as needed. -## -#jetty.webapp.addProtectedClasses+=,org.example. -#jetty.webapp.addHiddenClasses+=,org.example. - -[ini] -contextHandlerClass=org.eclipse.jetty.ee8.webapp.WebAppContext - -[jpms] -add-modules:java.instrument diff --git a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/ee8-websocket-javax.mod b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/ee8-websocket-javax.mod deleted file mode 100644 index 8150285456d2..000000000000 --- a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/ee8-websocket-javax.mod +++ /dev/null @@ -1,44 +0,0 @@ -# --------------------------------------------------------------------------- -# See the NOTICE file distributed with this work for additional -# information regarding copyright ownership. -# -# This is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as -# published by the Free Software Foundation; either version 2.1 of -# the License, or (at your option) any later version. -# -# This software is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this software; if not, write to the Free -# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -# 02110-1301 USA, or see the FSF site: http://www.fsf.org. -# --------------------------------------------------------------------------- - -# DO NOT EDIT - See: https://jetty.org/docs/index.html - -[description] -Enable javax.websocket APIs for deployed web applications. - -[environment] -ee8 - -[tags] -websocket - -[depend] -client -ee8-annotations - -[lib] -lib/jetty-websocket-core-common-${jetty.version}.jar -lib/jetty-websocket-core-client-${jetty.version}.jar -lib/jetty-websocket-core-server-${jetty.version}.jar -lib/ee8-websocket/jetty-ee8-websocket-servlet-${jetty.version}.jar -lib/ee8-websocket/jetty-javax-websocket-api-1.1.2.jar -lib/ee8-websocket/jetty-ee8-websocket-javax-client-${jetty.version}.jar -lib/ee8-websocket/jetty-ee8-websocket-javax-common-${jetty.version}.jar -lib/ee8-websocket/jetty-ee8-websocket-javax-server-${jetty.version}.jar \ No newline at end of file diff --git a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/ee8-websocket-jetty.mod b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/ee8-websocket-jetty.mod deleted file mode 100644 index 73ac3941e0c7..000000000000 --- a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/ee8-websocket-jetty.mod +++ /dev/null @@ -1,42 +0,0 @@ -# --------------------------------------------------------------------------- -# See the NOTICE file distributed with this work for additional -# information regarding copyright ownership. -# -# This is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as -# published by the Free Software Foundation; either version 2.1 of -# the License, or (at your option) any later version. -# -# This software is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this software; if not, write to the Free -# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -# 02110-1301 USA, or see the FSF site: http://www.fsf.org. -# --------------------------------------------------------------------------- - -# DO NOT EDIT - See: https://jetty.org/docs/index.html - -[description] -Enable the Jetty WebSocket API support for deployed web applications. - -[environment] -ee8 - -[tags] -websocket - -[depend] -ee8-annotations - -[lib] -lib/jetty-websocket-core-common-${jetty.version}.jar -lib/jetty-websocket-core-server-${jetty.version}.jar -lib/ee8-websocket/jetty-ee8-websocket-servlet-${jetty.version}.jar -lib/ee8-websocket/jetty-ee8-websocket-jetty-api-${jetty.version}.jar -lib/ee8-websocket/jetty-ee8-websocket-jetty-common-${jetty.version}.jar -lib/ee8-websocket/jetty-ee8-websocket-jetty-server-${jetty.version}.jar - diff --git a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/ext.mod b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/ext.mod deleted file mode 100644 index 17a98d590e5f..000000000000 --- a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/ext.mod +++ /dev/null @@ -1,35 +0,0 @@ -# --------------------------------------------------------------------------- -# See the NOTICE file distributed with this work for additional -# information regarding copyright ownership. -# -# This is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as -# published by the Free Software Foundation; either version 2.1 of -# the License, or (at your option) any later version. -# -# This software is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this software; if not, write to the Free -# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -# 02110-1301 USA, or see the FSF site: http://www.fsf.org. -# --------------------------------------------------------------------------- - -# DO NOT EDIT - See: https://jetty.org/docs/index.html - -[description] -Adds the jar file from $JETTY_HOME/lib/ext and $JETTY_BASE/lib/ext to the server classpath. - -[tags] -classpath - -[lib] -lib/ext/**.jar - -[files] -lib/ -lib/ext/ - diff --git a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/http-forwarded.mod b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/http-forwarded.mod deleted file mode 100644 index 63eb39e7d8f2..000000000000 --- a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/http-forwarded.mod +++ /dev/null @@ -1,78 +0,0 @@ -# --------------------------------------------------------------------------- -# See the NOTICE file distributed with this work for additional -# information regarding copyright ownership. -# -# This is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as -# published by the Free Software Foundation; either version 2.1 of -# the License, or (at your option) any later version. -# -# This software is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this software; if not, write to the Free -# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -# 02110-1301 USA, or see the FSF site: http://www.fsf.org. -# --------------------------------------------------------------------------- - -# DO NOT EDIT - See: https://jetty.org/docs/index.html - -[description] -Enables processing of the "Forwarded" HTTP header (and its predecessors "X-Forwarded-*" HTTP headers). -The "Forwarded" HTTP header is added by intermediaries to provide information about the clients. - -[tags] -connector - -[depend] -http - -[xml] -etc/jetty-http-forwarded.xml - -[ini-template] -# tag::documentation[] -### ForwardedRequestCustomizer Configuration - -## Whether to process only the RFC7239 "Forwarded" header. -## "X-Forwarded-*" headers are not processed. -# jetty.httpConfig.forwardedOnly=false - -## Whether the address obtained from "Forwarded: by=" or -## "X-Forwarded-Server" is used in the request authority. -# jetty.httpConfig.forwardedProxyAsAuthority=false - -## Whether the "X-Forwarded-Port" header is used in the request authority, -## or else it is the remote client port. -# jetty.httpConfig.forwardedPortAsAuthority=true - -## The name of the RFC 7239 HTTP header. -# jetty.httpConfig.forwardedHeader=Forwarded - -## The name of the obsolete forwarded host HTTP header. -# jetty.httpConfig.forwardedHostHeader=X-Forwarded-Host - -## The name of the obsolete forwarded server HTTP header. -# jetty.httpConfig.forwardedServerHeader=X-Forwarded-Server - -## The name of the obsolete forwarded scheme HTTP header. -# jetty.httpConfig.forwardedProtoHeader=X-Forwarded-Proto - -## The name of the obsolete forwarded for HTTP header. -# jetty.httpConfig.forwardedForHeader=X-Forwarded-For - -## The name of the obsolete forwarded port HTTP header. -# jetty.httpConfig.forwardedPortHeader=X-Forwarded-Port - -## The name of the obsolete forwarded https HTTP header. -# jetty.httpConfig.forwardedHttpsHeader=X-Proxied-Https - -## The name of the obsolete forwarded SSL session ID HTTP header. -# jetty.httpConfig.forwardedSslSessionIdHeader=Proxy-ssl-id - -## The name of the obsolete forwarded SSL cipher HTTP header. -# jetty.httpConfig.forwardedCipherSuiteHeader=Proxy-auth-cert -# end::documentation[] diff --git a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/http.mod b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/http.mod deleted file mode 100644 index b135a62ab5aa..000000000000 --- a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/http.mod +++ /dev/null @@ -1,78 +0,0 @@ -# --------------------------------------------------------------------------- -# See the NOTICE file distributed with this work for additional -# information regarding copyright ownership. -# -# This is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as -# published by the Free Software Foundation; either version 2.1 of -# the License, or (at your option) any later version. -# -# This software is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this software; if not, write to the Free -# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -# 02110-1301 USA, or see the FSF site: http://www.fsf.org. -# --------------------------------------------------------------------------- - -# DO NOT EDIT - See: https://jetty.org/docs/index.html - -[description] -Enables a clear-text HTTP connector. -By default clear-text HTTP/1.1 is enabled, and clear-text HTTP/2 may be added by enabling the "http2c" module. - -[tags] -connector -http - -[depend] -server - -[xml] -etc/jetty-http.xml - -[ini-template] -# tag::documentation[] -### Clear-Text HTTP Connector Configuration - -## The host/address to bind the connector to. -# jetty.http.host=0.0.0.0 - -## The port the connector listens on. -# jetty.http.port=8080 - -## The connector idle timeout, in milliseconds. -# jetty.http.idleTimeout=30000 - -## The number of acceptors (-1 picks a default value based on number of cores). -# jetty.http.acceptors=1 - -## The number of selectors (-1 picks a default value based on number of cores). -# jetty.http.selectors=-1 - -## The ServerSocketChannel accept queue backlog (0 picks the platform default). -# jetty.http.acceptQueueSize=0 - -## The thread priority delta to give to acceptor threads. -# jetty.http.acceptorPriorityDelta=0 - -## Whether to enable the SO_REUSEADDR socket option. -# jetty.http.reuseAddress=true - -## Whether to enable the SO_REUSEPORT socket option. -# jetty.http.reusePort=false - -## Whether to enable the TCP_NODELAY socket option on accepted sockets. -# jetty.http.acceptedTcpNoDelay=true - -## The SO_RCVBUF socket option to set on accepted sockets. -## A value of -1 indicates that the platform default is used. -# jetty.http.acceptedReceiveBufferSize=-1 - -## The SO_SNDBUF socket option to set on accepted sockets. -## A value of -1 indicates that the platform default is used. -# jetty.http.acceptedSendBufferSize=-1 -# end::documentation[] diff --git a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/https.mod b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/https.mod deleted file mode 100644 index 6a09c385c745..000000000000 --- a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/https.mod +++ /dev/null @@ -1,40 +0,0 @@ -# --------------------------------------------------------------------------- -# See the NOTICE file distributed with this work for additional -# information regarding copyright ownership. -# -# This is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as -# published by the Free Software Foundation; either version 2.1 of -# the License, or (at your option) any later version. -# -# This software is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this software; if not, write to the Free -# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -# 02110-1301 USA, or see the FSF site: http://www.fsf.org. -# --------------------------------------------------------------------------- - -# DO NOT EDIT - See: https://jetty.org/docs/index.html - -[description] -Adds HTTPS protocol support to the TLS(SSL) Connector. - -[tags] -connector -https -http -ssl - -[depend] -ssl - -[after] -http-forwarded - -[xml] -etc/jetty-https.xml - diff --git a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/jmx.mod b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/jmx.mod deleted file mode 100644 index aee601f9d41e..000000000000 --- a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/jmx.mod +++ /dev/null @@ -1,35 +0,0 @@ -# --------------------------------------------------------------------------- -# See the NOTICE file distributed with this work for additional -# information regarding copyright ownership. -# -# This is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as -# published by the Free Software Foundation; either version 2.1 of -# the License, or (at your option) any later version. -# -# This software is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this software; if not, write to the Free -# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -# 02110-1301 USA, or see the FSF site: http://www.fsf.org. -# --------------------------------------------------------------------------- - -# DO NOT EDIT - See: https://jetty.org/docs/index.html - -[description] -# tag::description[] -This module enables local Java Management Extension (JMX) support for Jetty components. -# end::description[] - -[depend] -server - -[lib] -lib/jetty-jmx-${jetty.version}.jar - -[xml] -etc/jetty-jmx.xml diff --git a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/jndi.mod b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/jndi.mod deleted file mode 100644 index 8870763db9c0..000000000000 --- a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/jndi.mod +++ /dev/null @@ -1,31 +0,0 @@ -# --------------------------------------------------------------------------- -# See the NOTICE file distributed with this work for additional -# information regarding copyright ownership. -# -# This is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as -# published by the Free Software Foundation; either version 2.1 of -# the License, or (at your option) any later version. -# -# This software is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this software; if not, write to the Free -# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -# 02110-1301 USA, or see the FSF site: http://www.fsf.org. -# --------------------------------------------------------------------------- - -# DO NOT EDIT - See: https://jetty.org/docs/index.html - -[description] -Adds the Jetty JNDI implementation to the classpath. - -[depend] -plus -server - -[lib] -lib/jetty-jndi-${jetty.version}.jar diff --git a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/jvm.mod b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/jvm.mod deleted file mode 100644 index 03096bf12007..000000000000 --- a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/jvm.mod +++ /dev/null @@ -1,47 +0,0 @@ -# --------------------------------------------------------------------------- -# See the NOTICE file distributed with this work for additional -# information regarding copyright ownership. -# -# This is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as -# published by the Free Software Foundation; either version 2.1 of -# the License, or (at your option) any later version. -# -# This software is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this software; if not, write to the Free -# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -# 02110-1301 USA, or see the FSF site: http://www.fsf.org. -# --------------------------------------------------------------------------- - -# DO NOT EDIT - See: https://jetty.org/docs/index.html - -[description] -Creates an ini template for setting JVM arguments (eg -Xmx ). - -[ini-template] -## JVM Configuration -## If JVM args are include in an ini file then --exec is needed -## to start a new JVM from start.jar with the extra args. -## -## If you wish to avoid an extra JVM running, place JVM args -## on the normal command line and do not use --exec -# --exec -# -Xmx2000m -# -Xmn512m -# -XX:+UseConcMarkSweepGC -# -XX:ParallelCMSThreads=2 -# -XX:+CMSClassUnloadingEnabled -# -XX:+UseCMSCompactAtFullCollection -# -XX:CMSInitiatingOccupancyFraction=80 -# -internal:gc -# -XX:+PrintGCDateStamps -# -XX:+PrintGCTimeStamps -# -XX:+PrintGCDetails -# -XX:+PrintTenuringDistribution -# -XX:+PrintCommandLineFlags -# -XX:+DisableExplicitGC diff --git a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/logging/jetty/resources/jetty-logging.properties b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/logging/jetty/resources/jetty-logging.properties deleted file mode 100644 index 17e9bdcf9e21..000000000000 --- a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/logging/jetty/resources/jetty-logging.properties +++ /dev/null @@ -1,30 +0,0 @@ -# --------------------------------------------------------------------------- -# See the NOTICE file distributed with this work for additional -# information regarding copyright ownership. -# -# This is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as -# published by the Free Software Foundation; either version 2.1 of -# the License, or (at your option) any later version. -# -# This software is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this software; if not, write to the Free -# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -# 02110-1301 USA, or see the FSF site: http://www.fsf.org. -# --------------------------------------------------------------------------- - -## Set logging levels from: ALL, TRACE, DEBUG, INFO, WARN, ERROR, OFF -org.eclipse.jetty.LEVEL=INFO -## Configure a level for an arbitrary logger tree -#com.example.LEVEL=INFO -## Configure a level for specific logger -#com.example.MyComponent.LEVEL=INFO -## Configure JMX Context Name -# org.eclipse.jetty.logging.jmx.context=JettyServer -## Hide stacks traces in an arbitrary logger tree -#com.example.STACKS=false diff --git a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/logging/slf4j.mod b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/logging/slf4j.mod deleted file mode 100644 index f44b6da64ba4..000000000000 --- a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/logging/slf4j.mod +++ /dev/null @@ -1,39 +0,0 @@ -# --------------------------------------------------------------------------- -# See the NOTICE file distributed with this work for additional -# information regarding copyright ownership. -# -# This is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as -# published by the Free Software Foundation; either version 2.1 of -# the License, or (at your option) any later version. -# -# This software is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this software; if not, write to the Free -# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -# 02110-1301 USA, or see the FSF site: http://www.fsf.org. -# --------------------------------------------------------------------------- - -# DO NOT EDIT - See: https://jetty.org/docs/index.html - -[description] -Configures logging to use SLF4J. -A specific implementation of SLF4J is not enabled. -If one is not selected then NOP implementation will be used. - -[tags] -logging - -[provides] -slf4j - -[lib] -lib/logging/slf4j-api-${slf4j.version}.jar - -[ini] -slf4j.version?=2.0.13 -jetty.webapp.addHiddenClasses+=,org.slf4j. diff --git a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/plus.mod b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/plus.mod deleted file mode 100644 index 45c285e5618b..000000000000 --- a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/plus.mod +++ /dev/null @@ -1,30 +0,0 @@ -# --------------------------------------------------------------------------- -# See the NOTICE file distributed with this work for additional -# information regarding copyright ownership. -# -# This is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as -# published by the Free Software Foundation; either version 2.1 of -# the License, or (at your option) any later version. -# -# This software is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this software; if not, write to the Free -# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -# 02110-1301 USA, or see the FSF site: http://www.fsf.org. -# --------------------------------------------------------------------------- - -# DO NOT EDIT - See: https://jetty.org/docs/index.html - -[description] -Adds the Jetty Plus JNDI support to the classpath. - -[depend] -server - -[lib] -lib/jetty-plus-${jetty.version}.jar diff --git a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/requestlog.mod b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/requestlog.mod deleted file mode 100644 index ace6429c03bb..000000000000 --- a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/requestlog.mod +++ /dev/null @@ -1,64 +0,0 @@ -# --------------------------------------------------------------------------- -# See the NOTICE file distributed with this work for additional -# information regarding copyright ownership. -# -# This is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as -# published by the Free Software Foundation; either version 2.1 of -# the License, or (at your option) any later version. -# -# This software is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this software; if not, write to the Free -# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -# 02110-1301 USA, or see the FSF site: http://www.fsf.org. -# --------------------------------------------------------------------------- - -# DO NOT EDIT - See: https://jetty.org/docs/index.html - -[description] -Logs requests using CustomRequestLog and AsyncRequestLogWriter. - -[tags] -requestlog -logging - -[depend] -server - -[xml] -etc/jetty-requestlog.xml - -[files] -logs/ - -[ini] -jetty.requestlog.dir?=logs - -[ini-template] -# tag::documentation[] -## Format string -# jetty.requestlog.formatString=%{client}a - %u %{dd/MMM/yyyy:HH:mm:ss ZZZ|GMT}t "%r" %s %O "%{Referer}i" "%{User-Agent}i" - -## Logging directory (relative to $jetty.base) -# jetty.requestlog.dir=logs - -## File path -# jetty.requestlog.filePath=${jetty.requestlog.dir}/yyyy_mm_dd.request.log - -## Date format for rollovered files (uses SimpleDateFormat syntax) -# jetty.requestlog.filenameDateFormat=yyyy_MM_dd - -## How many days to retain old log files -# jetty.requestlog.retainDays=90 - -## Whether to append to existing file -# jetty.requestlog.append=false - -## Timezone of the log file rollover -# jetty.requestlog.timezone=GMT -# end::documentation[] diff --git a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/resources.mod b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/resources.mod deleted file mode 100644 index cf2e9a24ea44..000000000000 --- a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/resources.mod +++ /dev/null @@ -1,36 +0,0 @@ -# --------------------------------------------------------------------------- -# See the NOTICE file distributed with this work for additional -# information regarding copyright ownership. -# -# This is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as -# published by the Free Software Foundation; either version 2.1 of -# the License, or (at your option) any later version. -# -# This software is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this software; if not, write to the Free -# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -# 02110-1301 USA, or see the FSF site: http://www.fsf.org. -# --------------------------------------------------------------------------- - -# DO NOT EDIT - See: https://jetty.org/docs/index.html - -[description] -# tag::description[] -This module adds the `$JETTY_BASE/resources` directory to the server's classpath. -# end::description[] - -[tags] -classpath - -[lib] -resources/ - -[files] -resources/ - diff --git a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/security.mod b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/security.mod deleted file mode 100644 index 7a0646e13b8c..000000000000 --- a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/security.mod +++ /dev/null @@ -1,30 +0,0 @@ -# --------------------------------------------------------------------------- -# See the NOTICE file distributed with this work for additional -# information regarding copyright ownership. -# -# This is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as -# published by the Free Software Foundation; either version 2.1 of -# the License, or (at your option) any later version. -# -# This software is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this software; if not, write to the Free -# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -# 02110-1301 USA, or see the FSF site: http://www.fsf.org. -# --------------------------------------------------------------------------- - -# DO NOT EDIT - See: https://jetty.org/docs/index.html - -[description] -Adds core security handling to the classpath. - -[depend] -server - -[lib] -lib/jetty-security-${jetty.version}.jar diff --git a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/server.mod b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/server.mod deleted file mode 100644 index 4be55e5f8e95..000000000000 --- a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/server.mod +++ /dev/null @@ -1,147 +0,0 @@ -# --------------------------------------------------------------------------- -# See the NOTICE file distributed with this work for additional -# information regarding copyright ownership. -# -# This is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as -# published by the Free Software Foundation; either version 2.1 of -# the License, or (at your option) any later version. -# -# This software is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this software; if not, write to the Free -# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -# 02110-1301 USA, or see the FSF site: http://www.fsf.org. -# --------------------------------------------------------------------------- - -# DO NOT EDIT - See: https://jetty.org/docs/index.html - -[description] -Enables and configures the Jetty server. -This module does not enable any network protocol support. -To enable a specific network protocol such as HTTP/1.1, you must enable the correspondent Jetty module. - -[after] -jvm -ext -resources - -[depend] -threadpool -bytebufferpool -logging - -[lib] -lib/jetty-http-${jetty.version}.jar -lib/jetty-server-${jetty.version}.jar -lib/jetty-xml-${jetty.version}.jar -lib/jetty-util-${jetty.version}.jar -lib/jetty-io-${jetty.version}.jar - -[xml] -etc/jetty.xml - -[ini-template] -# tag::documentation-http-config[] -### Common HTTP configuration -## Scheme to use to build URIs for secure redirects -# jetty.httpConfig.secureScheme=https - -## Port to use to build URIs for secure redirects -# jetty.httpConfig.securePort=8443 - -## Response content buffer size (in bytes) -# jetty.httpConfig.outputBufferSize=32768 - -## Max response content write length that is buffered (in bytes) -# jetty.httpConfig.outputAggregationSize=8192 - -## If HTTP/1.x persistent connections should be enabled -# jetty.httpConfig.persistentConnectionsEnabled=true - -## Max request headers size (in bytes) -# jetty.httpConfig.requestHeaderSize=8192 - -## Max response headers size (in bytes) -# jetty.httpConfig.responseHeaderSize=8192 - -## Whether to send the Server: header -# jetty.httpConfig.sendServerVersion=true - -## Whether to send the Date: header -# jetty.httpConfig.sendDateHeader=false - -## Max per-connection header cache size (in nodes) -# jetty.httpConfig.headerCacheSize=1024 - -## Whether, for requests with content, delay dispatch until some content has arrived -# jetty.httpConfig.delayDispatchUntilContent=true - -## Maximum number of error dispatches to prevent looping -# jetty.httpConfig.maxErrorDispatches=10 - -## Relative Redirect Locations allowed -# jetty.httpConfig.relativeRedirectAllowed=true - -## Whether to use direct ByteBuffers for reading or writing -# jetty.httpConfig.useInputDirectByteBuffers=true -# jetty.httpConfig.useOutputDirectByteBuffers=true -# end::documentation-http-config[] - -# tag::documentation-server-compliance[] -## HTTP Compliance: RFC7230, RFC7230_LEGACY, RFC2616, RFC2616_LEGACY, LEGACY -# jetty.httpConfig.compliance=RFC7230 - -## URI Compliance: DEFAULT, LEGACY, RFC3986, RFC3986_UNAMBIGUOUS, UNSAFE -# jetty.httpConfig.uriCompliance=DEFAULT - -## Cookie compliance mode for parsing request Cookie headers: RFC6265_STRICT, RFC6265, RFC6265_LEGACY, RFC2965, RFC2965_LEGACY -# jetty.httpConfig.requestCookieCompliance=RFC6265 - -## Cookie compliance mode for generating response Set-Cookie: RFC2965, RFC6265 -# jetty.httpConfig.responseCookieCompliance=RFC6265 -# end::documentation-server-compliance[] - -# tag::documentation-server-config[] -### Server configuration -## Whether ctrl+c on the console gracefully stops the Jetty server -# jetty.server.stopAtShutdown=true - -## Timeout in ms to apply when stopping the server gracefully -# jetty.server.stopTimeout=5000 - -## Dump the state of the Jetty server, components, and webapps after startup -# jetty.server.dumpAfterStart=false - -## The temporary directory used by the Jetty server and as a root for its contexts -# jetty.server.tempDirectory= - -## Dump the state of the Jetty server, components, and webapps before shutdown -# jetty.server.dumpBeforeStop=false -# end::documentation-server-config[] - -# tag::documentation-scheduler-config[] -### Server Scheduler Configuration -## The scheduler thread name, defaults to "Scheduler-{hashCode()}" if blank. -# jetty.scheduler.name= - -## Whether the server scheduler threads are daemon. -# jetty.scheduler.daemon=false - -## The number of server scheduler threads. -# jetty.scheduler.threads=1 -# end::documentation-scheduler-config[] - -## Whether the handlers of the ContextHandlerCollection can be updated once the server is started -## If set to false, then -deploy module jetty.deploy.scanInterval should also be set to 0. -# jetty.server.contexts.dynamic=true - -## Should the DefaultHandler serve the jetty favicon.ico from the root. -# jetty.server.default.serveFavIcon=true - -## Should the DefaultHandler show a list of known contexts in a root 404 response. -# jetty.server.default.showContexts=true diff --git a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/sessions.mod b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/sessions.mod deleted file mode 100644 index a4cebd14eb42..000000000000 --- a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/sessions.mod +++ /dev/null @@ -1,47 +0,0 @@ -# --------------------------------------------------------------------------- -# See the NOTICE file distributed with this work for additional -# information regarding copyright ownership. -# -# This is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as -# published by the Free Software Foundation; either version 2.1 of -# the License, or (at your option) any later version. -# -# This software is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this software; if not, write to the Free -# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -# 02110-1301 USA, or see the FSF site: http://www.fsf.org. -# --------------------------------------------------------------------------- - -# DO NOT EDIT - See: https://jetty.org/docs/index.html - -[description] -Enables session management. -By enabling this module, it allows session management to be configured via the ini templates -created or by enabling other session-cache or session-store modules. -Without this module enabled, -the server may still use sessions, but their management cannot be configured. - -[tags] -session - -[depends] -server - -[lib] -lib/jetty-session-${jetty.version}.jar - -[xml] -etc/sessions/id-manager.xml - -[ini-template] -## The name to uniquely identify this server instance -#jetty.sessionIdManager.workerName=node1 - -## Period between runs of the session scavenger (in seconds) -#jetty.sessionScavengeInterval.seconds=600 diff --git a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/ssl.mod b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/ssl.mod deleted file mode 100644 index 9b9595fea47b..000000000000 --- a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/ssl.mod +++ /dev/null @@ -1,158 +0,0 @@ -# --------------------------------------------------------------------------- -# See the NOTICE file distributed with this work for additional -# information regarding copyright ownership. -# -# This is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as -# published by the Free Software Foundation; either version 2.1 of -# the License, or (at your option) any later version. -# -# This software is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this software; if not, write to the Free -# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -# 02110-1301 USA, or see the FSF site: http://www.fsf.org. -# --------------------------------------------------------------------------- - -# DO NOT EDIT - See: https://jetty.org/docs/index.html - -[description] -Enables a TLS (SSL) connector to support secure protocols. -Secure HTTP/1.1 is provided by enabling the "https" module and secure HTTP/2 is provided by enabling the "http2" module. - -[tags] -connector -ssl -internal - -[depend] -server - -[xml] -etc/jetty-ssl.xml -etc/jetty-ssl-context.xml - -[ini-template] -# tag::documentation-connector[] -### TLS (SSL) Connector Configuration - -## The host/address to bind the connector to. -# jetty.ssl.host=0.0.0.0 - -## The port the connector listens on. -# jetty.ssl.port=8443 - -## The connector idle timeout, in milliseconds. -# jetty.ssl.idleTimeout=30000 - -## The number of acceptors (-1 picks a default value based on number of cores). -# jetty.ssl.acceptors=1 - -## The number of selectors (-1 picks a default value based on number of cores). -# jetty.ssl.selectors=-1 - -## The ServerSocketChannel accept queue backlog (0 picks the platform default). -# jetty.ssl.acceptQueueSize=0 - -## The thread priority delta to give to acceptor threads. -# jetty.ssl.acceptorPriorityDelta=0 - -## Whether to enable the SO_REUSEADDR socket option. -# jetty.ssl.reuseAddress=true - -## Whether to enable the SO_REUSEPORT socket option. -# jetty.ssl.reusePort=false - -## Whether to enable the TCP_NODELAY socket option on accepted sockets. -# jetty.ssl.acceptedTcpNoDelay=true - -## The SO_RCVBUF socket option to set on accepted sockets. -## A value of -1 indicates that the platform default is used. -# jetty.ssl.acceptedReceiveBufferSize=-1 - -## The SO_SNDBUF socket option to set on accepted sockets. -## A value of -1 indicates that the platform default is used. -# jetty.ssl.acceptedSendBufferSize=-1 - -## Whether client SNI data is required for all secure connections. -## When SNI is required, clients that do not send SNI data are rejected with an HTTP 400 response. -# jetty.ssl.sniRequired=false - -## Whether client SNI data is checked to match CN and SAN in server certificates. -## When SNI is checked, if the match fails the connection is rejected with an HTTP 400 response. -# jetty.ssl.sniHostCheck=true - -## The max age, in seconds, for the Strict-Transport-Security response header. -# jetty.ssl.stsMaxAgeSeconds=31536000 - -## Whether to include the subdomain property in any Strict-Transport-Security header. -# jetty.ssl.stsIncludeSubdomains=true -# end::documentation-connector[] - -# tag::documentation-ssl-context[] -### SslContextFactory Configuration -## Note that OBF passwords are not secure, just protected from casual observation. - -## Whether client SNI data is required for all secure connections. -## When SNI is required, clients that do not send SNI data are rejected with a TLS handshake error. -# jetty.sslContext.sniRequired=false - -## The Endpoint Identification Algorithm. -## Same as javax.net.ssl.SSLParameters#setEndpointIdentificationAlgorithm(String). -# jetty.sslContext.endpointIdentificationAlgorithm= - -## The JSSE Provider. -# jetty.sslContext.provider= - -## The KeyStore file path, either an absolute path or a relative path to $JETTY_BASE. -# jetty.sslContext.keyStorePath=etc/keystore.p12 - -## The TrustStore file path, either an absolute path or a relative path to $JETTY_BASE. -# jetty.sslContext.trustStorePath=etc/keystore.p12 - -## The KeyStore password. -# jetty.sslContext.keyStorePassword= - -## The Keystore type. -# jetty.sslContext.keyStoreType=PKCS12 - -## The KeyStore provider. -# jetty.sslContext.keyStoreProvider= - -## The KeyManager password. -# jetty.sslContext.keyManagerPassword= - -## The TrustStore password. -# jetty.sslContext.trustStorePassword= - -## The TrustStore type. -# jetty.sslContext.trustStoreType=PKCS12 - -## The TrustStore provider. -# jetty.sslContext.trustStoreProvider= - -## Whether client certificate authentication is required. -# jetty.sslContext.needClientAuth=false - -## Whether client certificate authentication is desired, but not required. -# jetty.sslContext.wantClientAuth=false - -## Whether cipher order is significant. -# jetty.sslContext.useCipherSuitesOrder=true - -## The SSLSession cache size. -# jetty.sslContext.sslSessionCacheSize=-1 - -## The SSLSession cache timeout (in seconds). -# jetty.sslContext.sslSessionTimeout=-1 - -## Whether TLS renegotiation is allowed. -# jetty.sslContext.renegotiationAllowed=true - -## The max number of TLS renegotiations per connection. -# jetty.sslContext.renegotiationLimit=5 -# end::documentation-ssl-context[] diff --git a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/threadpool.mod b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/threadpool.mod deleted file mode 100644 index 681e970f7e6b..000000000000 --- a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/threadpool.mod +++ /dev/null @@ -1,61 +0,0 @@ -# --------------------------------------------------------------------------- -# See the NOTICE file distributed with this work for additional -# information regarding copyright ownership. -# -# This is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as -# published by the Free Software Foundation; either version 2.1 of -# the License, or (at your option) any later version. -# -# This software is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this software; if not, write to the Free -# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -# 02110-1301 USA, or see the FSF site: http://www.fsf.org. -# --------------------------------------------------------------------------- - -# DO NOT EDIT - See: https://jetty.org/docs/index.html - -[description] -Enables and configures the Server ThreadPool. - -[depends] -logging - -[provides] -threadpool|default - -[xml] -etc/jetty-threadpool.xml - -[ini-template] -# tag::documentation[] -## Thread name prefix. -#jetty.threadPool.namePrefix=qtp - -## Minimum number of pooled threads. -#jetty.threadPool.minThreads=10 - -## Maximum number of pooled threads. -#jetty.threadPool.maxThreads=200 - -## Number of reserved threads (-1 for heuristic). -#jetty.threadPool.reservedThreads=-1 - -## Whether to use virtual threads, if the runtime supports them. -## Deprecated, use Jetty module 'threadpool-virtual' instead. -#jetty.threadPool.useVirtualThreads=false - -## Thread idle timeout (in milliseconds). -#jetty.threadPool.idleTimeout=60000 - -## The max number of idle threads that are evicted in one idleTimeout period. -#jetty.threadPool.maxEvictCount=1 - -## Whether to output a detailed dump. -#jetty.threadPool.detailedDump=false -# end::documentation[] diff --git a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/xwiki-logging.mod b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/xwiki-logging.mod deleted file mode 100644 index 23b00e438f35..000000000000 --- a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/xwiki-logging.mod +++ /dev/null @@ -1,43 +0,0 @@ -# --------------------------------------------------------------------------- -# See the NOTICE file distributed with this work for additional -# information regarding copyright ownership. -# -# This is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as -# published by the Free Software Foundation; either version 2.1 of -# the License, or (at your option) any later version. -# -# This software is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this software; if not, write to the Free -# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -# 02110-1301 USA, or see the FSF site: http://www.fsf.org. -# --------------------------------------------------------------------------- - -[description] -Base configuration for the jetty logging mechanism. -Provides a ${jetty.base}/resources/jetty-logging.properties. - -[tags] -logging - -[depend] -logging/slf4j -resources - -[provides] -logging|default - -[files] -basehome:modules/logging/jetty - -[lib] -lib/logging/jetty-slf4j-impl-${jetty.version}.jar - -[ini] -jetty.webapp.addHiddenClasses+=,org.eclipse.jetty.logging. -jetty.webapp.addHiddenClasses+=,${jetty.home.uri}/lib/logging/ diff --git a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/xwiki.mod b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/xwiki.mod index df6f98b11487..feef54c548df 100644 --- a/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/xwiki.mod +++ b/xwiki-platform-tools/xwiki-platform-tool-jetty/xwiki-platform-tool-jetty-resources/src/main/resources/jetty/modules/xwiki.mod @@ -23,18 +23,13 @@ [depend] ext -resources -server -logging +console-capture +ee10-apache-jsp +ee10-deploy +ee10-websocket-jakarta http http-forwarded -ee8-annotations -ee8-deploy -requestlog -ee8-websocket-javax -ee8-websocket-jetty -ee8-apache-jsp -console-capture +work [xml] -etc/jetty-xwiki.xml +etc/xwiki.xml diff --git a/xwiki-platform-tools/xwiki-platform-tool-packager-plugin/pom.xml b/xwiki-platform-tools/xwiki-platform-tool-packager-plugin/pom.xml index f0c5b5fdfed4..6928664f7544 100644 --- a/xwiki-platform-tools/xwiki-platform-tool-packager-plugin/pom.xml +++ b/xwiki-platform-tools/xwiki-platform-tool-packager-plugin/pom.xml @@ -148,8 +148,8 @@ - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api runtime diff --git a/xwiki-platform-tools/xwiki-platform-tool-provision-plugin/pom.xml b/xwiki-platform-tools/xwiki-platform-tool-provision-plugin/pom.xml index 9fb91a455286..b2d6b473a3b9 100644 --- a/xwiki-platform-tools/xwiki-platform-tool-provision-plugin/pom.xml +++ b/xwiki-platform-tools/xwiki-platform-tool-provision-plugin/pom.xml @@ -85,8 +85,8 @@ commons-httpclient - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api compile diff --git a/xwiki-platform-tools/xwiki-platform-tool-rootwebapp/pom.xml b/xwiki-platform-tools/xwiki-platform-tool-rootwebapp/pom.xml index 560aaf4b11d0..4981f2099c68 100644 --- a/xwiki-platform-tools/xwiki-platform-tool-rootwebapp/pom.xml +++ b/xwiki-platform-tools/xwiki-platform-tool-rootwebapp/pom.xml @@ -36,8 +36,8 @@ - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api diff --git a/xwiki-platform-tools/xwiki-platform-tool-rootwebapp/src/main/java/com/xpn/xwiki/XWikiRootServlet.java b/xwiki-platform-tools/xwiki-platform-tool-rootwebapp/src/main/java/com/xpn/xwiki/XWikiRootServlet.java index 520be6492701..a8f5dc303995 100644 --- a/xwiki-platform-tools/xwiki-platform-tool-rootwebapp/src/main/java/com/xpn/xwiki/XWikiRootServlet.java +++ b/xwiki-platform-tools/xwiki-platform-tool-rootwebapp/src/main/java/com/xpn/xwiki/XWikiRootServlet.java @@ -21,10 +21,10 @@ import java.io.IOException; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; /** * The root servlet for XWiki. The purpose of this servlet is to respond to WebDAV requests correctly and to redirect diff --git a/xwiki-platform-tools/xwiki-platform-tool-standards-validator/pom.xml b/xwiki-platform-tools/xwiki-platform-tool-standards-validator/pom.xml index ae12e20c606e..2646e48e859a 100644 --- a/xwiki-platform-tools/xwiki-platform-tool-standards-validator/pom.xml +++ b/xwiki-platform-tools/xwiki-platform-tool-standards-validator/pom.xml @@ -76,8 +76,8 @@ jetty-server - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api diff --git a/xwiki-platform-tools/xwiki-platform-tool-xmldoc-update-plugin/pom.xml b/xwiki-platform-tools/xwiki-platform-tool-xmldoc-update-plugin/pom.xml index 16bb061e3d3c..a00c7ee987e7 100644 --- a/xwiki-platform-tools/xwiki-platform-tool-xmldoc-update-plugin/pom.xml +++ b/xwiki-platform-tools/xwiki-platform-tool-xmldoc-update-plugin/pom.xml @@ -53,8 +53,8 @@ ${commons.version} - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api compile @@ -106,6 +106,7 @@ log4j-over-slf4j runtime + org.xwiki.platform