Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Update to Jetty 12 #6037

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from
Draft
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def testRuntimeVersion = Integer.parseInt((String)project.findProperty('testRunt
def testRuntimeVendor = project.hasProperty('testRuntimeVendor') ? JvmVendorSpec.matching((String)project.property('testRuntimeVendor')): null

if (languageLevel > compilerVersion) {
throw new IllegalArgumentException("languageLevel must be less than or equal to compileVersion")
throw new IllegalArgumentException("languageLevel must be less than or equal to compilerVersion")
}
if (languageLevel < 8) {
throw new IllegalArgumentException("languageLevel must be greater than or equal to 8")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ repositories {
includeGroup 'org.apache.kafka'
}
}
mavenLocal()
}
29 changes: 21 additions & 8 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,17 @@ hdrhistogram = "2.2.2"
iceberg = "1.6.1"
immutables = "2.10.1"
jackson = "2.18.1"
jakarta-servlet = "5.0.0"
jakarta-websocket = "2.0.0"
jakarta-servlet = "6.0.0"
jakarta-websocket = "2.1.1"
jama = "1.1.1"
javaparser = "3.26.2"
javax-annotation = "1.3.2"
javax-inject = "1"
javax-validation = "2.0.1.Final"
jdom2 = "2.0.6.1"
jetbrains = "26.0.1"
jetty = "11.0.20"
jetty = "12.0.15"
jetty11 = "11.0.20"
jpy = "0.19.0"
jsinterop = "2.0.2"
# google is annoying, and have different versions released for the same groupId
Expand Down Expand Up @@ -213,6 +214,7 @@ jackson-datatype-jdk8 = { module = "com.fasterxml.jackson.datatype:jackson-datat
jakarata-servlet-api = { module = "jakarta.servlet:jakarta.servlet-api", version.ref = "jakarta-servlet" }

jakarta-websocket-api = { module = "jakarta.websocket:jakarta.websocket-api", version.ref = "jakarta-websocket" }
jakarta-websocket-client-api = { module = "jakarta.websocket:jakarta.websocket-client-api", version.ref = "jakarta-websocket" }

jama = { module = "gov.nist.math.jama:gov.nist.math.jama", version.ref = "jama" }

Expand All @@ -228,14 +230,25 @@ jdom2 = { module = "org.jdom:jdom2", version.ref = "jdom2" }

jetbrains-annotations = { module = "org.jetbrains:annotations", version.ref = "jetbrains" }


jetty-alpn-java-server = { module = "org.eclipse.jetty:jetty-alpn-java-server" }
jetty-alpn-server = { module = "org.eclipse.jetty:jetty-alpn-server" }
jetty-bom = { module = "org.eclipse.jetty:jetty-bom", version.ref = "jetty" }
jetty-http2-server = { module = "org.eclipse.jetty.http2:http2-server" }
jetty-servlet = { module = "org.eclipse.jetty:jetty-servlet" }
jetty-servlets = { module = "org.eclipse.jetty:jetty-servlets" }
jetty-webapp = { module = "org.eclipse.jetty:jetty-webapp" }
jetty-websocket-jakarta-server = { module = "org.eclipse.jetty.websocket:websocket-jakarta-server" }
jetty-http2-server = { module = "org.eclipse.jetty.http2:jetty-http2-server" }
jetty-ee10-bom = { module = "org.eclipse.jetty.ee10:jetty-ee10-bom", version.ref = "jetty" }
jetty-webapp = { module = "org.eclipse.jetty.ee10:jetty-ee10-webapp" }
jetty-servlet = { module = "org.eclipse.jetty.ee10:jetty-ee10-servlet" }
jetty-servlets = { module = "org.eclipse.jetty.ee10:jetty-ee10-servlets" }
jetty-websocket-jakarta-server = { module = "org.eclipse.jetty.ee10.websocket:jetty-ee10-websocket-jakarta-server" }

jetty11-alpn-java-server = { module = "org.eclipse.jetty:jetty-alpn-java-server" }
jetty11-alpn-server = { module = "org.eclipse.jetty:jetty-alpn-server" }
jetty11-bom = { module = "org.eclipse.jetty:jetty-bom", version.ref = "jetty11" }
jetty11-http2-server = { module = "org.eclipse.jetty.http2:http2-server" }
jetty11-servlet = { module = "org.eclipse.jetty:jetty-servlet" }
jetty11-servlets = { module = "org.eclipse.jetty:jetty-servlets" }
jetty11-webapp = { module = "org.eclipse.jetty:jetty-webapp" }
jetty11-websocket-jakarta-server = { module = "org.eclipse.jetty.websocket:websocket-jakarta-server" }

jpy = { module = "org.jpyconsortium:jpy", version.ref = "jpy" }

Expand Down
3 changes: 1 addition & 2 deletions grpc-java/grpc-servlet-websocket-jakarta/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ plugins {
dependencies {
implementation platform(libs.grpc.bom)
implementation libs.grpc.core
// compileOnly 'javax.servlet:javax.servlet-api:4.0.1'
implementation libs.jakarata.servlet.api

// compileOnly 'javax.websocket:javax.websocket-api:1.1'
implementation libs.jakarta.websocket.api
implementation libs.jakarta.websocket.client.api

implementation libs.guava
}
Expand Down
5 changes: 5 additions & 0 deletions py/embedded-server/java-runtime/gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
io.deephaven.project.ProjectType=JAVA_LOCAL
compilerVersion=17
runtimeVersion=17
languageLevel=17
testRuntimeVersion=17
testLanguageLevel=17
61 changes: 61 additions & 0 deletions server/jetty-11/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
plugins {
id 'java-library'
id 'io.deephaven.project.register'
}

dependencies {
api project(':authentication')
api project(':authorization')
api project(':server')
api(project(':Integrations')) {
because 'downstream dagger compile'
}

implementation project(":util-thread")

runtimeOnly(project(':web'))

implementation libs.dagger
annotationProcessor libs.dagger.compiler

testImplementation libs.dagger
testAnnotationProcessor libs.dagger.compiler

implementation platform(libs.grpc.bom)
implementation platform(libs.jetty11.bom)

api libs.jakarata.servlet.api
implementation libs.jetty11.servlet
implementation libs.jetty11.servlets
implementation libs.jetty11.webapp
implementation libs.jetty11.http2.server
implementation libs.jetty11.alpn.server
// TODO(deephaven-core#2506): Support for alternative ALPN implementations
runtimeOnly libs.jetty11.alpn.java.server

// implementation 'io.grpc:grpc-servlet-jakarta'
api(project(':grpc-java:grpc-servlet-jakarta')) {
because 'downstream dagger compile'
}
implementation project(':grpc-java:grpc-servlet-websocket-jakarta')
implementation libs.jetty11.websocket.jakarta.server

compileOnly project(':util-immutables')
annotationProcessor libs.immutables.value

implementation project(':ssl-kickstart')
implementation libs.sslcontext.kickstart.jetty

implementation project(':grpc-java:grpc-mtls')

testImplementation project(':server-test-utils')
testImplementation libs.junit4
testImplementation libs.assertj

testRuntimeOnly project(':log-to-slf4j')
testRuntimeOnly libs.slf4j.simple
}

test.systemProperty "PeriodicUpdateGraph.allowUnitTestMode", false

apply plugin: 'io.deephaven.java-open-nio'
1 change: 1 addition & 0 deletions server/jetty-11/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
io.deephaven.project.ProjectType=JAVA_PUBLIC
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//
// Copyright (c) 2016-2024 Deephaven Data Labs and Patent Pending
//
package io.deephaven.server.jetty11;

import jakarta.servlet.Filter;
import jakarta.servlet.FilterChain;
import jakarta.servlet.ServletException;
import jakarta.servlet.ServletRequest;
import jakarta.servlet.ServletResponse;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;
import java.util.Calendar;
import java.util.Date;

public class CacheFilter implements Filter {
public static final int YEAR_IN_SECONDS = 365 * 24 * 60 * 60;

@Override
public void doFilter(final ServletRequest request,
final ServletResponse response,
final FilterChain filterChain)
throws IOException, ServletException {
final HttpServletResponse httpResponse = (HttpServletResponse) response;

// set expiry to one year in the future
final Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
calendar.add(Calendar.YEAR, 1);
httpResponse.setDateHeader("Expires", calendar.getTime().getTime());
// Note: immutable tells firefox to never revalidate as data will never change
httpResponse.setHeader("Cache-control", "max-age=" + YEAR_IN_SECONDS + ", public, immutable");
httpResponse.setHeader("Pragma", "");

filterChain.doFilter(request, response);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
//
// Copyright (c) 2016-2024 Deephaven Data Labs and Patent Pending
//
package io.deephaven.server.jetty11;

import dagger.Component;
import dagger.Module;
import io.deephaven.configuration.Configuration;
import io.deephaven.server.auth.CommunityAuthorizationModule;
import io.deephaven.server.runner.CommunityDefaultsModule;
import io.deephaven.server.runner.ComponentFactoryBase;

import javax.inject.Singleton;
import java.io.PrintStream;

/**
* The out-of-the-box {@link CommunityComponent} factory for the Deephaven community server.
*
* <p>
* To use this directly, a main class can be configured as follows:
*
* <pre>
* public final class MyMainClass {
* public static void main(String[] args)
* throws IOException, InterruptedException, ClassNotFoundException, TimeoutException {
* final Configuration configuration = MainHelper.init(args, MyMainClass.class);
* new CommunityComponentFactory()
* .build(configuration)
* .getServer()
* .run()
* .join();
* }
* }
* </pre>
*
* Advanced integrators should prefer to create their own component factory that extends {@link ComponentFactoryBase}.
*/
public final class CommunityComponentFactory
extends ComponentFactoryBase<CommunityComponentFactory.CommunityComponent> {

@Override
public CommunityComponent build(Configuration configuration, PrintStream out, PrintStream err) {
final JettyConfig jettyConfig = JettyConfig.buildFromConfig(configuration).build();
return DaggerCommunityComponentFactory_CommunityComponent.builder()
.withOut(out)
.withErr(err)
.withJettyConfig(jettyConfig)
.build();
}

/**
* The out-of-the-box community {@link Component}. Includes the {@link CommunityModule}.
*/
@Singleton
@Component(modules = CommunityModule.class)
public interface CommunityComponent extends JettyServerComponent {

@Component.Builder
interface Builder extends JettyServerComponent.Builder<Builder, CommunityComponent> {
}
}

/**
* The out-of-the-box community {@link Module}.
*
* @see JettyServerModule
* @see CommunityAuthorizationModule
* @see CommunityDefaultsModule
*/
@Module(includes = {
JettyServerModule.class,
JettyClientChannelFactoryModule.class,
CommunityAuthorizationModule.class,
CommunityDefaultsModule.class,
// Implementation note: when / if modules are migrated out of CommunityDefaultsModule, they will need to be
// re-added here.
})
public interface CommunityModule {
}
}
Loading
Loading