This is an automated email from the ASF dual-hosted git repository. rcordier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/james-project.git
The following commit(s) were added to refs/heads/master by this push: new 86335a8dfc JAMES-4072 -Webadmin Spark - Upgrade org.zoomba-lang:spark-core -> 3.0.2 (#2714) 86335a8dfc is described below commit 86335a8dfc618bbca8c7cfa11a234657c461a5c1 Author: vttran <vtt...@linagora.com> AuthorDate: Mon May 12 08:51:19 2025 +0700 JAMES-4072 -Webadmin Spark - Upgrade org.zoomba-lang:spark-core -> 3.0.2 (#2714) --- pom.xml | 2 +- .../webadmin/jettyserver/EmbeddedJettyServer.java | 3 +- .../james/webadmin/jettyserver/JettyHandler.java | 63 ---------------------- .../webadmin/routes/EventDeadLettersRoutes.java | 2 + 4 files changed, 5 insertions(+), 65 deletions(-) diff --git a/pom.xml b/pom.xml index d23dc62482..78d45e0a31 100644 --- a/pom.xml +++ b/pom.xml @@ -3040,7 +3040,7 @@ <dependency> <groupId>org.zoomba-lang</groupId> <artifactId>spark-core</artifactId> - <version>3.0.1</version> + <version>3.0.2</version> </dependency> <dependency> <groupId>pl.pragmatists</groupId> diff --git a/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/jettyserver/EmbeddedJettyServer.java b/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/jettyserver/EmbeddedJettyServer.java index f576b2aa8b..50b9ec9b32 100644 --- a/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/jettyserver/EmbeddedJettyServer.java +++ b/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/jettyserver/EmbeddedJettyServer.java @@ -28,6 +28,7 @@ import java.util.Optional; import jakarta.servlet.DispatcherType; import org.eclipse.jetty.ee10.servlet.ServletContextHandler; +import org.eclipse.jetty.ee10.servlet.SessionHandler; import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.ServerConnector; @@ -137,7 +138,7 @@ public class EmbeddedJettyServer extends VirtualThreadAware.Proxy implements Emb final ServletContextHandler servletContextHandler = webSocketServletContextHandler == null ? new ServletContextHandler() : webSocketServletContextHandler; - final JettyHandler sessionHandler = new JettyHandler(matcherFilter); + final SessionHandler sessionHandler = new SessionHandler(); sessionHandler.getSessionCookieConfig().setHttpOnly(httpOnly); servletContextHandler.setSessionHandler(sessionHandler); diff --git a/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/jettyserver/JettyHandler.java b/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/jettyserver/JettyHandler.java deleted file mode 100644 index fa3a7545a2..0000000000 --- a/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/jettyserver/JettyHandler.java +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************** - * Licensed to the Apache Software Foundation (ASF) under one * - * or more contributor license agreements. See the NOTICE file * - * distributed with this work for additional information * - * regarding copyright ownership. The ASF licenses this file * - * to you under the Apache License, Version 2.0 (the * - * "License"); you may not use this file except in compliance * - * with the License. You may obtain a copy of the License at * - * * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, * - * software distributed under the License is distributed on an * - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * - * KIND, either express or implied. See the License for the * - * specific language governing permissions and limitations * - * under the License. * - ****************************************************************/ - -package org.apache.james.webadmin.jettyserver; - -import jakarta.servlet.Filter; -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; - -import org.eclipse.jetty.ee10.servlet.ServletContextRequest; -import org.eclipse.jetty.ee10.servlet.SessionHandler; -import org.eclipse.jetty.server.Request; -import org.eclipse.jetty.server.Response; -import org.eclipse.jetty.util.Callback; - -import spark.embeddedserver.jetty.HttpRequestWrapper; - -/** - * Simple Jetty Handler - * - * @author Per Wendel - * - * @see <a href="https://github.com/nmondal/spark-11/pull/20">Upstream issue</a> - */ -public class JettyHandler extends SessionHandler { - private final Filter filter; - - public JettyHandler(Filter filter) { - this.filter = filter; - } - - @Override - public boolean handle(Request request, Response response, Callback callback) throws Exception { - if (request instanceof ServletContextRequest servletContextRequest) { - final HttpServletResponse httpServletResponse = servletContextRequest.getHttpServletResponse(); - final HttpServletRequest httpServletRequest = servletContextRequest.getServletApiRequest(); - final HttpRequestWrapper wrapper = new HttpRequestWrapper(httpServletRequest); - httpServletResponse.setHeader("Connection", "close"); - - filter.doFilter(wrapper, httpServletResponse, null); - callback.succeeded(); - return true; - } - - return false; - } -} diff --git a/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/routes/EventDeadLettersRoutes.java b/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/routes/EventDeadLettersRoutes.java index 78f41a50ce..86e79a2f27 100644 --- a/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/routes/EventDeadLettersRoutes.java +++ b/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/routes/EventDeadLettersRoutes.java @@ -38,6 +38,7 @@ import org.apache.james.webadmin.utils.ParametersExtractor; import org.apache.james.webadmin.utils.Responses; import org.eclipse.jetty.http.HttpStatus; +import reactor.core.publisher.Mono; import spark.Request; import spark.Response; import spark.Route; @@ -106,6 +107,7 @@ public class EventDeadLettersRoutes implements Routes { return eventDeadLettersService.getEvent(group, insertionId) .map(eventSerializer::toJson) + .switchIfEmpty(Mono.fromRunnable(() -> response.status(HttpStatus.NOT_FOUND_404))) .block(); } --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org