Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
b3639a4
start
SentryMan Nov 6, 2025
b0c6729
Update pom.xml
SentryMan Nov 6, 2025
5808405
trust client
SentryMan Nov 6, 2025
8eb84d3
remove qlog
SentryMan Nov 7, 2025
b6ae47e
http1 https
SentryMan Nov 7, 2025
9331a2f
redirect to http3
SentryMan Nov 7, 2025
5165f5c
transport
SentryMan Nov 7, 2025
8b84adb
full transport
SentryMan Nov 7, 2025
4aafe10
fix test
SentryMan Nov 7, 2025
1a686a1
doc
SentryMan Nov 8, 2025
100b0bb
implement attributes
SentryMan Nov 8, 2025
5423cc7
Update FlupkeHttpServer.java
SentryMan Nov 8, 2025
0356eb4
tests
SentryMan Nov 8, 2025
01be3d2
rename
SentryMan Nov 8, 2025
ce41faf
Update FlupkeHttpServer.java
SentryMan Nov 8, 2025
e448780
rename ssl impl
SentryMan Nov 8, 2025
a6642ec
different ports
SentryMan Nov 8, 2025
f04ff28
Update WebTransportTest.java
SentryMan Nov 8, 2025
69186e0
flush on close
SentryMan Nov 8, 2025
673c19b
Update WebTransportTest.java
SentryMan Nov 8, 2025
6e50bfd
Update WebTransportTest.java
SentryMan Nov 8, 2025
bb31611
separate tests
SentryMan Nov 8, 2025
1ea3c8c
fix test
SentryMan Nov 8, 2025
f1a1f49
timeout?
SentryMan Nov 8, 2025
66b303c
Update WebTransportBaseTest.java
SentryMan Nov 8, 2025
e17fe3a
fix test (allegedly)
SentryMan Nov 9, 2025
2850674
don't disable certificate check
SentryMan Nov 9, 2025
60c0c05
fix jdk client http3 option
SentryMan Nov 9, 2025
006efd6
Update WebTransportTest.java
SentryMan Nov 9, 2025
0f581cf
is it timeout
SentryMan Nov 9, 2025
41a21a9
cert
SentryMan Nov 9, 2025
2786584
Update FlupkeHttpServer.java
SentryMan Nov 9, 2025
9974ef2
cert alias
SentryMan Nov 9, 2025
665062b
alias
SentryMan Nov 9, 2025
96241e9
logger
SentryMan Nov 10, 2025
00881c4
final
SentryMan Nov 10, 2025
da5057b
log protocol
SentryMan Nov 10, 2025
ed9e75a
Revert "log protocol"
SentryMan Nov 10, 2025
61455d6
more test
SentryMan Nov 10, 2025
a28e4ca
Reapply "log protocol"
SentryMan Nov 10, 2025
0d4dd92
Update FlupkeHttpServer.java
SentryMan Nov 10, 2025
699cdbd
Merge branch 'master' into http3
SentryMan Nov 10, 2025
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
48 changes: 48 additions & 0 deletions avaje-jex-http3-flupke/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.avaje</groupId>
<artifactId>avaje-jex-parent</artifactId>
<version>3.3</version>
</parent>
<artifactId>avaje-jex-http3-flupke</artifactId>
<version>0.1</version>
<properties>
<maven.compiler.release>21</maven.compiler.release>
</properties>
<dependencies>
<dependency>
<groupId>tech.kwik</groupId>
<artifactId>flupke</artifactId>
<version>0.9</version>
</dependency>
<dependency>
<groupId>tech.kwik</groupId>
<artifactId>kwik</artifactId>
<version>0.10.7</version>
</dependency>
<dependency>
<groupId>io.avaje</groupId>
<artifactId>avaje-jex-ssl</artifactId>
</dependency>
<dependency>
<groupId>io.avaje</groupId>
<artifactId>avaje-jex-test</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>io.avaje</groupId>
<artifactId>avaje-jsonb</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>io.avaje</groupId>
<artifactId>avaje-jsonb-generator</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
package io.avaje.jex.http3.flupke;

import java.net.DatagramSocket;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;

import io.avaje.jex.Jex;
import io.avaje.jex.http3.flupke.core.H3ServerProvider;
import io.avaje.jex.http3.flupke.webtransport.WebTransportEntry;
import io.avaje.jex.http3.flupke.webtransport.WebTransportHandler;
import io.avaje.jex.spi.JexPlugin;
import tech.kwik.core.server.ServerConnectionConfig;
import tech.kwik.core.server.ServerConnector;
import tech.kwik.flupke.server.Http3ServerExtensionFactory;

/**
* A plugin that configures Jex to use the Flupke library for HTTP/3 and WebTransport functionality.
*
* <p>This plugin allows customization of the underlying Flupke server components and registers
* WebTransport handlers.
*/
public final class FlupkeJexPlugin implements JexPlugin {

private DatagramSocket socket;
private Map<String, Http3ServerExtensionFactory> extensions = Map.of();
private List<WebTransportEntry> wts = new ArrayList<>();
private Consumer<ServerConnector.Builder> consumer = b -> {};
private Consumer<ServerConnectionConfig.Builder> connection = b -> {};
private String certAlias;

private FlupkeJexPlugin() {}

/**
* Creates a new instance of the {@code FlupkeJexPlugin}.
*
* @return The new plugin instance.
*/
public static FlupkeJexPlugin create() {
return new FlupkeJexPlugin();
}

/**
* The alias for the certificate, needed when multiple certificate chains are present
*
* @param certAlias
*/
public void certAlias(String certAlias) {
this.certAlias = certAlias;
}

/**
* Provides a custom {@code DatagramSocket} for the HTTP/3 server to use.
*
* <p>This is typically used for specific network configurations or testing.
*
* @param socket The custom DatagramSocket to use.
* @return This plugin instance for chaining.
*/
public FlupkeJexPlugin customSocket(DatagramSocket socket) {
this.socket = socket;
return this;
}

/**
* Sets a map of named {@code Http3ServerExtensionFactory} instances for advanced server
* customization.
*
* @param extensions A map where the key is the extension name and the value is the factory.
* @return This plugin instance for chaining.
*/
public FlupkeJexPlugin extensions(Map<String, Http3ServerExtensionFactory> extensions) {
this.extensions = extensions;
return this;
}

/**
* Provides a {@code Consumer} to configure the underlying Flupke {@code ServerConnector.Builder}.
*
* <p>This allows for low-level configuration of connection settings.
*
* @param consumer The consumer to apply configurations to the connector builder.
* @return This plugin instance for chaining.
* @see ServerConnector.Builder
*/
public FlupkeJexPlugin connectorConfig(Consumer<ServerConnector.Builder> consumer) {
this.consumer = consumer;
return this;
}

/**
* Provides a {@code Consumer} to configure the underlying Flupke {@code
* ServerConnectionConfig.Builder}.
*
* @param consumer The consumer to apply configurations to the connection config builder.
* @return This plugin instance for chaining.
* @see ServerConnectionConfig.Builder
*/
public FlupkeJexPlugin connectionConfig(Consumer<ServerConnectionConfig.Builder> consumer) {
this.connection = consumer;
return this;
}

/**
* Registers a new WebTransport handler for the specified path.
*
* <p>This is the simpler method if you have a pre-built {@code WebTransportHandler} instance.
*
* @param path The URL path (e.g., "/my-webtransport-endpoint").
* @param handler The fully configured WebTransportHandler.
* @return This plugin instance for chaining.
*/
public FlupkeJexPlugin webTransport(String path, WebTransportHandler handler) {
this.wts.add(new WebTransportEntry(path, handler));
return this;
}

/**
* Registers a new WebTransport handler for the specified path using a builder pattern.
*
* <p>This method accepts a {@code Consumer} that receives a {@code WebTransportHandler.Builder}
* for fluent configuration of the event listeners.
*
* @param path The URL path (e.g., "/my-webtransport-endpoint").
* @param consumer A consumer to configure the {@code WebTransportHandler.Builder}.
* @return This plugin instance for chaining.
* @see WebTransportHandler.Builder
*/
public FlupkeJexPlugin webTransport(String path, Consumer<WebTransportHandler.Builder> consumer) {
var b = WebTransportHandler.builder();
consumer.accept(b);
this.wts.add(new WebTransportEntry(path, b.build()));
return this;
}

@Override
public void apply(Jex jex) {
jex.config()
.serverProvider(
new H3ServerProvider(consumer, connection, certAlias, wts, extensions, socket));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package io.avaje.jex.http3.flupke;

import java.lang.System.Logger;
import java.lang.System.Logger.Level;
import java.nio.ByteBuffer;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

import io.avaje.applog.AppLog;
import tech.kwik.core.log.BaseLogger;

/** BaseLogger Implementation that uses the JDK System.Logger */
public class FlupkeSystemLogger extends BaseLogger {
private static final Logger LOG = AppLog.getLogger(FlupkeSystemLogger.class);
private final Lock lock = new ReentrantLock();

@Override
protected void log(String text) {
this.lock.lock();
try {
LOG.log(Level.INFO, text);
} finally {
this.lock.unlock();
}
}

@Override
protected void log(String text, Throwable throwable) {
if (throwable == null) {
LOG.log(Level.ERROR, text);
return;
}

this.lock.lock();
try {
LOG.log(Level.ERROR, text, throwable);
} finally {
this.lock.unlock();
}
}

@Override
protected void logWithHexDump(String text, byte[] data, int length) {
this.lock.lock();
try {
LOG.log(Level.INFO, text + "\n" + super.byteToHexBlock(data, length));
} finally {
this.lock.unlock();
}
}

@Override
protected void logWithHexDump(String text, ByteBuffer data, int offset, int length) {
this.lock.lock();
try {
LOG.log(Level.INFO, text + "\n" + super.byteToHexBlock(data, offset, length));
} finally {
this.lock.unlock();
}
}
}
Loading
Loading