This is an automated email from the ASF dual-hosted git repository.

sarutak pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new 2d940919c0a1 [SPARK-55193][CORE][BUILD] Use `CompressionHandler` as a 
replacement for the deprecated `GzipHandler` in `JettyUtils`
2d940919c0a1 is described below

commit 2d940919c0a151cb0d0c553336430a216fbc373c
Author: yangjie01 <[email protected]>
AuthorDate: Sun Feb 1 05:11:03 2026 +0900

    [SPARK-55193][CORE][BUILD] Use `CompressionHandler` as a replacement for 
the deprecated `GzipHandler` in `JettyUtils`
    
    ### What changes were proposed in this pull request?
    This PR replaces `GzipHandler` with `CompressionHandler` in `JettyUtils` 
because `GzipHandler` has been deprecated and marked with `forRemoval = true`. 
The modification follows the deprecation guideline refer to
    
    
https://github.com/jetty/jetty.project/blob/e9d4cba5a9d8ed62100bb09480af6fbb39c636cb/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/gzip/GzipHandler.java#L42-L49
    
    ```
    /**
     * deprecated use the new {code CompressionHandler} available in {code 
org.eclipse.jetty.compression:jetty-compression-server}
     *             with your choice of compression implementation (gzip is 
{code org.eclipse.jetty.compression:jetty-compression-gzip},
     *             brotli is {code 
org.eclipse.jetty.compression:jetty-compression-brotli}, and zstandard is
     *             {code 
org.eclipse.jetty.compression:jetty-compression-zstandard})
     */
    Deprecated(since = "12.1.1", forRemoval = true)
    public class GzipHandler extends Handler.Wrapper implements GzipFactory
    ```
    
    ### Why are the changes needed?
    Cleanup deprecated API usage.
    
    ### Does this PR introduce _any_ user-facing change?
    No
    
    ### How was this patch tested?
    - Pass Github Actions
    - Manually built a Spark distribution and verified that the UI displays 
correctly.
    
    ### Was this patch authored or co-authored using generative AI tooling?
    No
    
    Closes #53928 from LuciferYang/JettyUtils-GzipHandler.
    
    Lead-authored-by: yangjie01 <[email protected]>
    Co-authored-by: YangJie <[email protected]>
    Signed-off-by: Kousuke Saruta <[email protected]>
---
 core/pom.xml                                       | 23 +++++++++++++++++++++-
 .../scala/org/apache/spark/ui/JettyUtils.scala     | 13 ++++++------
 pom.xml                                            | 18 +++++++++++++++++
 3 files changed, 47 insertions(+), 7 deletions(-)

diff --git a/core/pom.xml b/core/pom.xml
index b8e567100daa..2bc1842502ad 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -182,6 +182,21 @@
       <artifactId>jetty-ee10-servlets</artifactId>
       <scope>compile</scope>
     </dependency>
+    <dependency>
+      <groupId>org.eclipse.jetty.compression</groupId>
+      <artifactId>jetty-compression-server</artifactId>
+      <scope>compile</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.eclipse.jetty.compression</groupId>
+      <artifactId>jetty-compression-common</artifactId>
+      <scope>compile</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.eclipse.jetty.compression</groupId>
+      <artifactId>jetty-compression-gzip</artifactId>
+      <scope>compile</scope>
+    </dependency>
     <dependency>
       <groupId>javax.servlet</groupId>
       <artifactId>javax.servlet-api</artifactId>
@@ -541,7 +556,7 @@
               <overWriteIfNewer>true</overWriteIfNewer>
               <useSubDirectoryPerType>true</useSubDirectoryPerType>
               <includeArtifactIds>
-                
guava,protobuf-java,jetty-io,jetty-ee10-servlet,jetty-ee10-servlets,jetty-http,jetty-ee10-plus,jetty-util,jetty-server,jetty-security,jetty-proxy,jetty-client,jetty-session
+                
guava,protobuf-java,jetty-io,jetty-ee10-servlet,jetty-ee10-servlets,jetty-http,jetty-ee10-plus,jetty-util,jetty-server,jetty-security,jetty-proxy,jetty-client,jetty-session,jetty-compression-server,jetty-compression-common,jetty-compression-gzip
               </includeArtifactIds>
               <silent>true</silent>
             </configuration>
@@ -568,6 +583,9 @@
               <include>org.eclipse.jetty:jetty-util</include>
               <include>org.eclipse.jetty:jetty-server</include>
               <include>org.eclipse.jetty:jetty-session</include>
+              
<include>org.eclipse.jetty.compression:jetty-compression-server</include>
+              
<include>org.eclipse.jetty.compression:jetty-compression-common</include>
+              
<include>org.eclipse.jetty.compression:jetty-compression-gzip</include>
               <include>com.google.guava:guava</include>
               <include>com.google.guava:failureaccess</include>
               <include>com.google.protobuf:*</include>
@@ -595,6 +613,9 @@
               </includes>
             </relocation>
           </relocations>
+          <transformers>
+            <transformer 
implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
+          </transformers>
         </configuration>
       </plugin>
     </plugins>
diff --git a/core/src/main/scala/org/apache/spark/ui/JettyUtils.scala 
b/core/src/main/scala/org/apache/spark/ui/JettyUtils.scala
index 78fe74b454f7..5a690e6559c5 100644
--- a/core/src/main/scala/org/apache/spark/ui/JettyUtils.scala
+++ b/core/src/main/scala/org/apache/spark/ui/JettyUtils.scala
@@ -30,12 +30,12 @@ import jakarta.servlet.http._
 import org.eclipse.jetty.client.{Response => CResponse}
 import org.eclipse.jetty.client.HttpClient
 import org.eclipse.jetty.client.transport.HttpClientTransportOverHTTP
+import org.eclipse.jetty.compression.server.CompressionHandler
 import org.eclipse.jetty.ee10.proxy.ProxyServlet
 import org.eclipse.jetty.ee10.servlet._
 import org.eclipse.jetty.http.{HttpField, HttpFields, HttpHeader}
 import org.eclipse.jetty.server._
 import org.eclipse.jetty.server.handler.{ContextHandler, 
ContextHandlerCollection, ErrorHandler}
-import org.eclipse.jetty.server.handler.gzip.GzipHandler
 import org.eclipse.jetty.util.{Callback, URIUtil}
 import org.eclipse.jetty.util.component.LifeCycle
 import org.eclipse.jetty.util.thread.{QueuedThreadPool, 
ScheduledExecutorScheduler}
@@ -475,14 +475,14 @@ private[spark] case class ServerInfo(
     
handler.setVirtualHosts(JettyUtils.toVirtualHosts(JettyUtils.SPARK_CONNECTOR_NAME))
     addFilters(handler, securityMgr)
 
-    val gzipHandler = new GzipHandler()
-    gzipHandler.setHandler(handler)
-    rootHandler.addHandler(gzipHandler)
+    val compressionHandler = new CompressionHandler()
+    compressionHandler.setHandler(handler)
+    rootHandler.addHandler(compressionHandler)
 
     if (!handler.isStarted()) {
       handler.start()
     }
-    gzipHandler.start()
+    compressionHandler.start()
   }
 
   def removeHandler(handler: ServletContextHandler): Unit = synchronized {
@@ -490,7 +490,8 @@ private[spark] case class ServerInfo(
     // and remove it.
     rootHandler.getHandlers.asScala
       .find { h =>
-        h.isInstanceOf[GzipHandler] && 
h.asInstanceOf[GzipHandler].getHandler() == handler
+        h.isInstanceOf[CompressionHandler] &&
+          h.asInstanceOf[CompressionHandler].getHandler() == handler
       }
       .foreach { h =>
         rootHandler.removeHandler(h)
diff --git a/pom.xml b/pom.xml
index e0d56a755aca..69474c1ee1c9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -613,6 +613,24 @@
         <version>${jetty.version}</version>
         <scope>provided</scope>
       </dependency>
+      <dependency>
+        <groupId>org.eclipse.jetty.compression</groupId>
+        <artifactId>jetty-compression-server</artifactId>
+        <version>${jetty.version}</version>
+        <scope>provided</scope>
+      </dependency>
+      <dependency>
+        <groupId>org.eclipse.jetty.compression</groupId>
+        <artifactId>jetty-compression-common</artifactId>
+        <version>${jetty.version}</version>
+        <scope>provided</scope>
+      </dependency>
+      <dependency>
+        <groupId>org.eclipse.jetty.compression</groupId>
+        <artifactId>jetty-compression-gzip</artifactId>
+        <version>${jetty.version}</version>
+        <scope>provided</scope>
+      </dependency>
       <dependency>
         <groupId>com.google.guava</groupId>
         <artifactId>guava</artifactId>


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to