Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lang/java/ipc-jetty/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@
<artifactId>jetty-server</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<groupId>org.eclipse.jetty.${jetty.ee.version}</groupId>
<artifactId>jetty-${jetty.ee.version}-servlet</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@
import org.eclipse.jetty.server.HttpConfiguration;
import org.eclipse.jetty.server.HttpConnectionFactory;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jetty.ee9.servlet.ServletContextHandler;
import org.eclipse.jetty.ee9.servlet.ServletHolder;

/** An HTTP-based RPC {@link Server}. */
public class HttpServer implements Server {
Expand Down Expand Up @@ -71,10 +70,8 @@ public HttpServer(ResponderServlet servlet, String bindAddress, int port) throws
connector.setPort(port);
server.addConnector(connector);

ServletHandler handler = new ServletHandler();
handler.addServletWithMapping(new ServletHolder(servlet), "/*");
ServletContextHandler sch = new ServletContextHandler();
sch.setServletHandler(handler);
sch.getServletHandler().addServletWithMapping(new ServletHolder(servlet), "/*");
server.setHandler(sch);
}

Expand Down Expand Up @@ -103,9 +100,9 @@ public HttpServer(ResponderServlet servlet, ConnectionFactory connectionFactory,
connector.setPort(port);

server.addConnector(connector);
ServletHandler handler = new ServletHandler();
server.setHandler(handler);
handler.addServletWithMapping(new ServletHolder(servlet), "/*");
ServletContextHandler sch = new ServletContextHandler();
server.setHandler(sch);
sch.getServletHandler().addServletWithMapping(new ServletHolder(servlet), "/*");
}

/**
Expand All @@ -119,9 +116,9 @@ public HttpServer(ResponderServlet servlet, Connector connector) throws IOExcept
if (server.getConnectors().length == 0 || Arrays.asList(server.getConnectors()).contains(connector)) {
server.addConnector(connector);
}
ServletHandler handler = new ServletHandler();
server.setHandler(handler);
handler.addServletWithMapping(new ServletHolder(servlet), "/*");
ServletContextHandler sch = new ServletContextHandler();
server.setHandler(sch);
sch.getServletHandler().addServletWithMapping(new ServletHolder(servlet), "/*");
}

/**
Expand Down Expand Up @@ -154,7 +151,7 @@ public void close() {

/**
* Start the server.
*
*
* @throws AvroRuntimeException if the underlying Jetty server throws any
* exception while starting.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@

import java.net.URL;

import org.eclipse.jetty.servlet.DefaultServlet;
import org.eclipse.jetty.ee9.servlet.DefaultServlet;
import org.eclipse.jetty.util.resource.Resource;
import org.eclipse.jetty.util.resource.URLResourceFactory;

/**
* Very simple servlet class capable of serving static files.
Expand All @@ -30,16 +31,16 @@ public class StaticServlet extends DefaultServlet {
private static final long serialVersionUID = 1L;

@Override
Copy link
Member

@martin-g martin-g Nov 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this is wrong.
The purpose of the old Default.getResource(String) is to serve the static files.
Now it seems this method is removed in Jetty 12.x and something else should be used to serve the static files. Instead of removing the @Override we need to replace this method with whatever is the new one.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your comments. I will look into an alternative option/method for this in Jetty 12.x.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modified to override resolve method instead of the getResource method which was removed. Let me know if you have any further comments.

public Resource getResource(String pathInContext) {
protected Resource resolve(String subUriPath) {
// Take only last slice of the URL as a filename, so we can adjust path.
// This also prevents mischief like '../../foo.css'
String[] parts = pathInContext.split("/");
String[] parts = subUriPath.split("/");
String filename = parts[parts.length - 1];

URL resource = getClass().getClassLoader().getResource("org/apache/avro/ipc/stats/static/" + filename);
if (resource == null) {
return null;
}
return Resource.newResource(resource);
return new URLResourceFactory().newResource(resource);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
* limitations under the License.
*/
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.ServletHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jetty.ee9.servlet.ServletContextHandler;
import org.eclipse.jetty.ee9.servlet.ServletHolder;

/* This is a server that displays live information from a StatsPlugin.
*
Expand All @@ -42,11 +42,11 @@ public StatsServer(StatsPlugin plugin, int port) throws Exception {
this.httpServer = new Server(port);
this.plugin = plugin;

ServletHandler handler = new ServletHandler();
httpServer.setHandler(handler);
handler.addServletWithMapping(new ServletHolder(new StaticServlet()), "/");
ServletContextHandler sch = new ServletContextHandler();
httpServer.setHandler(sch);
sch.getServletHandler().addServletWithMapping(new ServletHolder(new StaticServlet()), "/");

handler.addServletWithMapping(new ServletHolder(new StatsServlet(plugin)), "/");
sch.getServletHandler().addServletWithMapping(new ServletHolder(new StatsServlet(plugin)), "/");

httpServer.start();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public Server createServer(Responder testResponder) throws Exception {
System.setProperty("javax.net.ssl.trustStore", "src/test/truststore");
System.setProperty("javax.net.ssl.trustStorePassword", "avrotest");
SslConnectionFactory connectionFactory = new SslConnectionFactory("HTTP/1.1");
SslContextFactory sslContextFactory = connectionFactory.getSslContextFactory();
SslContextFactory.Server sslContextFactory = connectionFactory.getSslContextFactory();

sslContextFactory.setKeyStorePath(System.getProperty("javax.net.ssl.keyStore"));
sslContextFactory.setKeyManagerPassword(System.getProperty("javax.net.ssl.password"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import java.nio.ByteBuffer;
import java.util.Random;

import javax.servlet.UnavailableException;
import jakarta.servlet.UnavailableException;

import org.apache.avro.AvroRemoteException;
import org.apache.avro.Protocol;
Expand Down Expand Up @@ -164,11 +164,11 @@ public Object respond(Message message, Object request) throws AvroRemoteExceptio
/**
* Demo program for using RPC stats. This automatically generates client RPC
* requests. Alternatively a can be used (as below) to trigger RPCs.
*
*
* <pre>
* java -jar build/avro-tools-*.jar rpcsend '{"protocol":"sleepy","namespace":null,"types":[],"messages":{"sleep":{"request":[{"name":"millis","type":"long"}],"response":"null"}}}' sleep localhost 7002 '{"millis": 20000}'
* </pre>
*
*
* @param args
* @throws Exception
*/
Expand Down
4 changes: 2 additions & 2 deletions lang/java/ipc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@
<artifactId>velocity-engine-core</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<!-- javax.annotation-api dependency must be explicit for forward compatibility (Java > 9) -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
import java.nio.ByteBuffer;
import java.util.List;

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;

import org.apache.avro.AvroRuntimeException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
import java.util.Set;
import java.util.Map.Entry;

import javax.servlet.ServletException;
import javax.servlet.UnavailableException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.ServletException;
import jakarta.servlet.UnavailableException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.VelocityEngine;
Expand Down
13 changes: 7 additions & 6 deletions lang/java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,16 @@
<hadoop.version>3.4.2</hadoop.version>
<hamcrest.version>3.0</hamcrest.version>
<jackson-bom.version>2.20.1</jackson-bom.version>
<jetty.version>9.4.58.v20250814</jetty.version>
<jetty.version>12.1.4</jetty.version>
<jetty.ee.version>ee9</jetty.ee.version>
<jopt-simple.version>5.0.4</jopt-simple.version>
<junit5.version>5.14.1</junit5.version>
<maven-core.version>3.9.6</maven-core.version>
<mockito.version>5.20.0</mockito.version>
<netty.version>4.2.7.Final</netty.version>
<protobuf.version>4.33.1</protobuf.version>
<reload4j.version>1.2.26</reload4j.version>
<servlet-api.version>4.0.1</servlet-api.version>
<servlet-api.version>6.0.0</servlet-api.version>
<slf4j.version>2.0.17</slf4j.version>
<snappy.version>1.1.10.8</snappy.version>
<thrift.version>0.20.0</thrift.version>
Expand Down Expand Up @@ -549,8 +550,8 @@
<version>${jetty.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<groupId>org.eclipse.jetty.${jetty.ee.version}</groupId>
<artifactId>jetty-${jetty.ee.version}-servlet</artifactId>
<version>${jetty.version}</version>
</dependency>
<dependency>
Expand All @@ -559,8 +560,8 @@
<version>${jetty.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>${servlet-api.version}</version>
</dependency>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@
<configuration>
<rules>
<enforceBytecodeVersion>
<maxJdkVersion>11</maxJdkVersion>
<maxJdkVersion>17</maxJdkVersion>
<ignoredScopes>
<ignoredScope>test</ignoredScope>
<ignoredScope>provided</ignoredScope>
Expand Down