https://www.javadoc.io/doc/io.roastedroot/proxy-wasm-java-host/${project.version}/
diff --git a/proxy-wasm-jaxrs/src/main/java/io/roastedroot/proxywasm/jaxrs/WasmPluginFeature.java b/proxy-wasm-jaxrs/src/main/java/io/roastedroot/proxywasm/jaxrs/WasmPluginFeature.java
index ed005d8..014ccfa 100644
--- a/proxy-wasm-jaxrs/src/main/java/io/roastedroot/proxywasm/jaxrs/WasmPluginFeature.java
+++ b/proxy-wasm-jaxrs/src/main/java/io/roastedroot/proxywasm/jaxrs/WasmPluginFeature.java
@@ -18,18 +18,18 @@
* If you are using a CDI container like quarkus, you will be using the
* {@link io.roastedroot.proxywasm.jaxrs.cdi.WasmPluginFeature} instead.
*
- *
{@code
+ *
* public class MyApplication extends jakarta.ws.rs.core.Application {
- * @Override
- * public Set> getClasses() {
- * Set> resources = new HashSet<>();
+ * @Override
+ * public Set<Class<?>> getClasses() {
+ * Set<Class<?>> resources = new HashSet<>();
* resources.add(MyResource.class);
* return resources;
* }
*
- * @Override
- * public Set
+ *
*
* @see WasmPlugin
* @see WasmPluginFilter
diff --git a/quarkus-proxy-wasm-example/src/main/java/io/roastedroot/proxywasm/jaxrs/example/App.java b/quarkus-proxy-wasm-example/src/main/java/io/roastedroot/proxywasm/jaxrs/example/App.java
index d612ad3..391a7ca 100644
--- a/quarkus-proxy-wasm-example/src/main/java/io/roastedroot/proxywasm/jaxrs/example/App.java
+++ b/quarkus-proxy-wasm-example/src/main/java/io/roastedroot/proxywasm/jaxrs/example/App.java
@@ -5,21 +5,37 @@
import com.dylibso.chicory.wasm.WasmModule;
import io.roastedroot.proxywasm.Plugin;
import io.roastedroot.proxywasm.PluginFactory;
-import io.roastedroot.proxywasm.StartException;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.enterprise.inject.Produces;
import java.nio.file.Path;
+/**
+ * Application configuration class for the proxy-wasm JAX-RS example.
+ * Sets up the Wasm PluginFactory for the example plugin.
+ */
@ApplicationScoped
public class App {
+ /**
+ * Default constructor.
+ */
+ public App() {
+ // Default constructor
+ }
+
private static WasmModule module =
Parser.parse(
Path.of("../proxy-wasm-java-host/src/test/go-examples/unit_tester/main.wasm"));
- // configure the the example wasm plugin
+ /**
+ * Produces the PluginFactory for the example Wasm plugin.
+ * Configures the plugin with necessary settings like name, shared status,
+ * plugin configuration, and machine factory.
+ *
+ * @return A configured PluginFactory for the example plugin.
+ */
@Produces
- public PluginFactory example() throws StartException {
+ public PluginFactory example() {
return () ->
Plugin.builder(module)
.withName("example")
diff --git a/quarkus-proxy-wasm-example/src/main/java/io/roastedroot/proxywasm/jaxrs/example/Resources.java b/quarkus-proxy-wasm-example/src/main/java/io/roastedroot/proxywasm/jaxrs/example/Resources.java
index 0c6a2b6..e1552ae 100644
--- a/quarkus-proxy-wasm-example/src/main/java/io/roastedroot/proxywasm/jaxrs/example/Resources.java
+++ b/quarkus-proxy-wasm-example/src/main/java/io/roastedroot/proxywasm/jaxrs/example/Resources.java
@@ -4,9 +4,26 @@
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
+/**
+ * JAX-RS resource class for the proxy-wasm example.
+ * Defines endpoints for testing the Wasm plugin.
+ */
@Path("/")
public class Resources {
+ /**
+ * Default constructor.
+ */
+ public Resources() {
+ // Default constructor
+ }
+
+ /**
+ * Handles GET requests to the /test path.
+ * Applies the "example" Wasm plugin.
+ *
+ * @return A simple "Hello World" string.
+ */
@Path("/test")
@GET
@WasmPlugin("example") // filter with example wasm plugin
diff --git a/quarkus-proxy-wasm/deployment/pom.xml b/quarkus-proxy-wasm/deployment/pom.xml
index d87fc12..a49b12a 100644
--- a/quarkus-proxy-wasm/deployment/pom.xml
+++ b/quarkus-proxy-wasm/deployment/pom.xml
@@ -68,7 +68,7 @@
org.apache.maven.plugins
maven-javadoc-plugin
- ${javadoc-plugin.version}
+ ${maven-javadoc-plugin.version}
true
diff --git a/quarkus-proxy-wasm/integration-tests/src/main/java/io/quarkiverse/proxywasm/it/App.java b/quarkus-proxy-wasm/integration-tests/src/main/java/io/quarkiverse/proxywasm/it/App.java
index e93f724..17d4b70 100644
--- a/quarkus-proxy-wasm/integration-tests/src/main/java/io/quarkiverse/proxywasm/it/App.java
+++ b/quarkus-proxy-wasm/integration-tests/src/main/java/io/quarkiverse/proxywasm/it/App.java
@@ -13,16 +13,43 @@
import java.nio.file.Path;
import java.util.Map;
+/**
+ * Application configuration for integration tests.
+ * Provides CDI producers for various {@link PluginFactory} configurations used in tests.
+ */
@ApplicationScoped
public class App {
+ /**
+ * Default constructor.
+ */
+ public App() {
+ // Default constructor
+ }
+
+ /**
+ * Directory containing the example Wasm modules used for testing.
+ */
public static final String EXAMPLES_DIR = "../../proxy-wasm-java-host/src/test";
+
private static final Gson gson = new Gson();
+ /**
+ * Parses a Wasm module from the specified file path relative to the examples directory.
+ *
+ * @param file The relative path to the Wasm module file.
+ * @return The parsed {@link WasmModule}.
+ */
public static WasmModule parseTestModule(String file) {
return Parser.parse(Path.of(EXAMPLES_DIR + file));
}
+ /**
+ * Produces a {@link PluginFactory} for header manipulation tests (shared instance).
+ *
+ * @return A configured {@link PluginFactory}.
+ * @throws StartException If plugin initialization fails.
+ */
@Produces
public PluginFactory headerTests() throws StartException {
return () ->
@@ -34,6 +61,12 @@ public PluginFactory headerTests() throws StartException {
.build();
}
+ /**
+ * Produces a {@link PluginFactory} for header manipulation tests (non-shared instances).
+ *
+ * @return A configured {@link PluginFactory}.
+ * @throws StartException If plugin initialization fails.
+ */
@Produces
public PluginFactory headerTestsNotShared() throws StartException {
return () ->
@@ -45,6 +78,12 @@ public PluginFactory headerTestsNotShared() throws StartException {
.build();
}
+ /**
+ * Produces a {@link PluginFactory} for tick-based tests.
+ *
+ * @return A configured {@link PluginFactory}.
+ * @throws StartException If plugin initialization fails.
+ */
@Produces
public PluginFactory tickTests() throws StartException {
return () ->
@@ -57,6 +96,12 @@ public PluginFactory tickTests() throws StartException {
.build();
}
+ /**
+ * Produces a {@link PluginFactory} for Foreign Function Interface (FFI) tests.
+ *
+ * @return A configured {@link PluginFactory}.
+ * @throws StartException If plugin initialization fails.
+ */
@Produces
public PluginFactory ffiTests() throws StartException {
return () ->
@@ -70,6 +115,12 @@ public PluginFactory ffiTests() throws StartException {
.build();
}
+ /**
+ * Reverses the byte order of the input data. Used as an FFI function in tests.
+ *
+ * @param data The byte array to reverse.
+ * @return A new byte array with the reversed content.
+ */
public static byte[] reverse(byte[] data) {
byte[] reversed = new byte[data.length];
for (int i = 0; i < data.length; i++) {
@@ -78,6 +129,12 @@ public static byte[] reverse(byte[] data) {
return reversed;
}
+ /**
+ * Produces a {@link PluginFactory} for HTTP call tests.
+ *
+ * @return A configured {@link PluginFactory}.
+ * @throws StartException If plugin initialization fails.
+ */
@Produces
public PluginFactory httpCallTests() throws StartException {
return () ->
diff --git a/quarkus-proxy-wasm/integration-tests/src/main/java/io/quarkiverse/proxywasm/it/MockLogger.java b/quarkus-proxy-wasm/integration-tests/src/main/java/io/quarkiverse/proxywasm/it/MockLogger.java
index 351a1f5..508507b 100644
--- a/quarkus-proxy-wasm/integration-tests/src/main/java/io/quarkiverse/proxywasm/it/MockLogger.java
+++ b/quarkus-proxy-wasm/integration-tests/src/main/java/io/quarkiverse/proxywasm/it/MockLogger.java
@@ -4,6 +4,10 @@
import io.roastedroot.proxywasm.LogLevel;
import java.util.ArrayList;
+/**
+ * A mock implementation of {@link LogHandler} for testing purposes.
+ * Stores logged messages in memory and optionally prints them to the console if DEBUG is enabled.
+ */
public class MockLogger implements LogHandler {
static final boolean DEBUG = "true".equals(System.getenv("DEBUG"));
@@ -11,6 +15,11 @@ public class MockLogger implements LogHandler {
final ArrayList loggedMessages = new ArrayList<>();
private final String name;
+ /**
+ * Constructs a new MockLogger with the given name.
+ *
+ * @param name The name to associate with logged messages.
+ */
public MockLogger(String name) {
this.name = name;
}
@@ -28,6 +37,11 @@ public synchronized LogLevel getLogLevel() {
return LogLevel.TRACE;
}
+ /**
+ * Retrieves a copy of all messages logged by this instance.
+ *
+ * @return A new {@link ArrayList} containing the logged messages.
+ */
public synchronized ArrayList loggedMessages() {
return new ArrayList<>(loggedMessages);
}
diff --git a/quarkus-proxy-wasm/integration-tests/src/main/java/io/quarkiverse/proxywasm/it/Resources.java b/quarkus-proxy-wasm/integration-tests/src/main/java/io/quarkiverse/proxywasm/it/Resources.java
index 7c3d3d8..5e06004 100644
--- a/quarkus-proxy-wasm/integration-tests/src/main/java/io/quarkiverse/proxywasm/it/Resources.java
+++ b/quarkus-proxy-wasm/integration-tests/src/main/java/io/quarkiverse/proxywasm/it/Resources.java
@@ -10,11 +10,26 @@
import jakarta.ws.rs.core.Context;
import jakarta.ws.rs.core.Response;
+/**
+ * JAX-RS resource class providing endpoints for integration tests.
+ */
@Path("/")
public class Resources {
+ /**
+ * Default constructor.
+ */
+ public Resources() {
+ // Default constructor
+ }
+
@Context ContainerRequestContext requestContext;
+ /**
+ * Endpoint that simulates a failure response.
+ *
+ * @return A {@link Response} with status 400 (Bad Request) echoing request headers.
+ */
@Path("/fail")
@GET
public Response fail() {
@@ -25,6 +40,11 @@ public Response fail() {
return builder.build();
}
+ /**
+ * Endpoint that simulates a successful response.
+ *
+ * @return A {@link Response} with status 200 (OK) echoing request headers and body "ok".
+ */
@Path("/ok")
@GET
public Response ok() {
@@ -35,6 +55,12 @@ public Response ok() {
return builder.entity("ok").build();
}
+ /**
+ * Endpoint for testing header manipulation with a shared Wasm plugin instance.
+ *
+ * @param counter The value of the "x-request-counter" header.
+ * @return A string indicating the counter value.
+ */
@Path("/headerTests")
@GET
@WasmPlugin("headerTests")
@@ -42,6 +68,12 @@ public String uhttpHeaders(@HeaderParam("x-request-counter") String counter) {
return String.format("counter: %s", counter);
}
+ /**
+ * Endpoint for testing header manipulation with non-shared Wasm plugin instances.
+ *
+ * @param counter The value of the "x-request-counter" header.
+ * @return A string indicating the counter value.
+ */
@Path("/headerTestsNotShared")
@GET
@WasmPlugin("headerTestsNotShared")
@@ -49,6 +81,12 @@ public String unotSharedHttpHeaders(@HeaderParam("x-request-counter") String cou
return String.format("counter: %s", counter);
}
+ /**
+ * Endpoint for testing tick-based Wasm plugin functionality.
+ *
+ * @param sub The path parameter.
+ * @return A simple "hello world" string.
+ */
@Path("/tickTests/{sub: .+ }")
@GET
@WasmPlugin("tickTests")
@@ -56,6 +94,12 @@ public String tickTests(@PathParam("sub") String sub) {
return "hello world";
}
+ /**
+ * Endpoint for testing Foreign Function Interface (FFI) calls (reverse function).
+ *
+ * @param body The request body.
+ * @return The request body (potentially modified by the Wasm plugin).
+ */
@Path("/ffiTests/reverse")
@POST
@WasmPlugin("ffiTests")
@@ -63,6 +107,11 @@ public String ffiTests(String body) {
return body;
}
+ /**
+ * Endpoint for testing HTTP calls made from the Wasm plugin.
+ *
+ * @return A simple "hello world" string.
+ */
@Path("/httpCallTests")
@GET
@WasmPlugin("httpCallTests")
@@ -70,6 +119,11 @@ public String httpCallTests() {
return "hello world";
}
+ /**
+ * Endpoint for testing combined FFI and HTTP call functionality.
+ *
+ * @return A simple "hello world" string.
+ */
@Path("/httpCallTestsAndFFI")
@GET
@WasmPlugin({"ffiTests", "httpCallTests"})
diff --git a/quarkus-proxy-wasm/runtime/src/main/java/io/quarkiverse/proxywasm/runtime/VertxHttpRequestAdaptor.java b/quarkus-proxy-wasm/runtime/src/main/java/io/quarkiverse/proxywasm/runtime/VertxHttpRequestAdaptor.java
index 0d19ab4..6c72786 100644
--- a/quarkus-proxy-wasm/runtime/src/main/java/io/quarkiverse/proxywasm/runtime/VertxHttpRequestAdaptor.java
+++ b/quarkus-proxy-wasm/runtime/src/main/java/io/quarkiverse/proxywasm/runtime/VertxHttpRequestAdaptor.java
@@ -6,11 +6,22 @@
import jakarta.enterprise.inject.Alternative;
import jakarta.inject.Inject;
+/**
+ * Vert.x specific implementation of {@link JaxrsHttpRequestAdaptor}.
+ * Adapts a Vert.x {@link io.vertx.core.http.HttpServerRequest} to the generic request interface.
+ */
@Alternative
@Priority(200)
@RequestScoped
public class VertxHttpRequestAdaptor extends JaxrsHttpRequestAdaptor {
+ /**
+ * Default constructor.
+ */
+ public VertxHttpRequestAdaptor() {
+ // Default constructor for VertxHttpRequestAdaptor
+ }
+
@Inject io.vertx.core.http.HttpServerRequest request;
@Override
diff --git a/quarkus-proxy-wasm/runtime/src/main/java/io/quarkiverse/proxywasm/runtime/VertxServerAdaptor.java b/quarkus-proxy-wasm/runtime/src/main/java/io/quarkiverse/proxywasm/runtime/VertxServerAdaptor.java
index 45c94a0..20574db 100644
--- a/quarkus-proxy-wasm/runtime/src/main/java/io/quarkiverse/proxywasm/runtime/VertxServerAdaptor.java
+++ b/quarkus-proxy-wasm/runtime/src/main/java/io/quarkiverse/proxywasm/runtime/VertxServerAdaptor.java
@@ -32,20 +32,40 @@
import java.util.Map;
import java.util.concurrent.TimeUnit;
+/**
+ * Vert.x specific implementation of {@link ServerAdaptor}.
+ * Provides Vert.x based implementations for scheduling tasks, adapting HTTP requests,
+ * and making outbound HTTP and gRPC calls.
+ */
@Alternative
@Priority(200)
@ApplicationScoped
public class VertxServerAdaptor implements ServerAdaptor {
+ /**
+ * Default constructor.
+ */
+ public VertxServerAdaptor() {
+ // Default constructor for VertxServerAdaptor
+ }
+
@Inject Vertx vertx;
HttpClient client;
+ /**
+ * Initializes the Vert.x HTTP client.
+ * This method is called by the CDI container after dependency injection.
+ */
@PostConstruct
public void setup() {
this.client = vertx.createHttpClient();
}
+ /**
+ * Closes the Vert.x HTTP client.
+ * This method is called by the CDI container before the bean is destroyed.
+ */
@PreDestroy
public void close() {
client.close();
diff --git a/quarkus-x-corazawaf-example/src/main/java/io/roastedroot/proxywasm/corazawaf/example/Admin.java b/quarkus-x-corazawaf-example/src/main/java/io/roastedroot/proxywasm/corazawaf/example/Admin.java
index 2a8cb9f..a72d525 100644
--- a/quarkus-x-corazawaf-example/src/main/java/io/roastedroot/proxywasm/corazawaf/example/Admin.java
+++ b/quarkus-x-corazawaf-example/src/main/java/io/roastedroot/proxywasm/corazawaf/example/Admin.java
@@ -3,6 +3,17 @@
import io.roastedroot.proxywasm.jaxrs.WasmPlugin;
import jakarta.ws.rs.Path;
+/**
+ * JAX-RS resource class for handling requests to the /admin path.
+ * Inherits functionality from the Anything class and applies the "waf" Wasm plugin.
+ */
@Path("/admin")
@WasmPlugin("waf") // use the corsaWAF filter
-public class Admin extends Anything {}
+public class Admin extends Anything {
+ /**
+ * Default constructor.
+ */
+ public Admin() {
+ // Default constructor
+ }
+}
diff --git a/quarkus-x-corazawaf-example/src/main/java/io/roastedroot/proxywasm/corazawaf/example/Anything.java b/quarkus-x-corazawaf-example/src/main/java/io/roastedroot/proxywasm/corazawaf/example/Anything.java
index 23ffdd0..3902eb4 100644
--- a/quarkus-x-corazawaf-example/src/main/java/io/roastedroot/proxywasm/corazawaf/example/Anything.java
+++ b/quarkus-x-corazawaf-example/src/main/java/io/roastedroot/proxywasm/corazawaf/example/Anything.java
@@ -24,36 +24,81 @@
@WasmPlugin("waf") // use the corsaWAF filter
public class Anything {
+ /**
+ * Default constructor.
+ */
+ public Anything() {
+ // Default constructor
+ }
+
+ /**
+ * Handles GET requests.
+ * @param headers The HTTP headers.
+ * @return A Response mirroring the request headers.
+ */
@GET
public Response gext(@Context HttpHeaders headers) {
return process(headers, null);
}
+ /**
+ * Handles DELETE requests.
+ * @param headers The HTTP headers.
+ * @return A Response mirroring the request headers.
+ */
@DELETE
public Response delete(HttpHeaders headers) {
return process(headers, null);
}
+ /**
+ * Handles OPTIONS requests.
+ * @param headers The HTTP headers.
+ * @return A Response mirroring the request headers.
+ */
@OPTIONS
public Response options(HttpHeaders headers) {
return process(headers, null);
}
+ /**
+ * Handles HEAD requests.
+ * @param headers The HTTP headers.
+ * @return A Response mirroring the request headers.
+ */
@HEAD
public Response head(HttpHeaders headers) {
return process(headers, null);
}
+ /**
+ * Handles POST requests.
+ * @param headers The HTTP headers.
+ * @param body The request body.
+ * @return A Response mirroring the request headers and body.
+ */
@POST
public Response postx(HttpHeaders headers, String body) {
return process(headers, body);
}
+ /**
+ * Handles PUT requests.
+ * @param headers The HTTP headers.
+ * @param body The request body.
+ * @return A Response mirroring the request headers and body.
+ */
@PUT
public Response put(HttpHeaders headers, String body) {
return process(headers, body);
}
+ /**
+ * Handles PATCH requests.
+ * @param headers The HTTP headers.
+ * @param body The request body.
+ * @return A Response mirroring the request headers and body.
+ */
@PATCH
public Response patch(HttpHeaders headers, String body) {
return process(headers, body);
diff --git a/quarkus-x-corazawaf-example/src/main/java/io/roastedroot/proxywasm/corazawaf/example/App.java b/quarkus-x-corazawaf-example/src/main/java/io/roastedroot/proxywasm/corazawaf/example/App.java
index a6d5dec..bb9ae77 100644
--- a/quarkus-x-corazawaf-example/src/main/java/io/roastedroot/proxywasm/corazawaf/example/App.java
+++ b/quarkus-x-corazawaf-example/src/main/java/io/roastedroot/proxywasm/corazawaf/example/App.java
@@ -6,7 +6,6 @@
import io.roastedroot.proxywasm.Plugin;
import io.roastedroot.proxywasm.PluginFactory;
import io.roastedroot.proxywasm.SimpleMetricsHandler;
-import io.roastedroot.proxywasm.StartException;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.enterprise.inject.Produces;
import java.io.IOException;
@@ -14,9 +13,20 @@
import java.io.UncheckedIOException;
import java.nio.charset.StandardCharsets;
+/**
+ * Application configuration class for the Coraza WAF example.
+ * Sets up the Wasm PluginFactory for the WAF plugin.
+ */
@ApplicationScoped
public class App {
+ /**
+ * Default constructor.
+ */
+ public App() {
+ // Default constructor
+ }
+
private static WasmModule module =
Parser.parse(App.class.getResourceAsStream("coraza-proxy-wasm.wasm"));
@@ -32,8 +42,15 @@ public class App {
static final boolean DEBUG = "true".equals(System.getenv("DEBUG"));
+ /**
+ * Produces the PluginFactory for the Coraza WAF Wasm plugin.
+ * Configures the plugin with necessary settings like name, shared status,
+ * logger, plugin configuration, and metrics handler.
+ *
+ * @return A configured PluginFactory for the WAF plugin.
+ */
@Produces
- public PluginFactory waf() throws StartException {
+ public PluginFactory waf() {
return () ->
Plugin.builder(module)
.withName("waf")
diff --git a/quarkus-x-corazawaf-example/src/main/java/io/roastedroot/proxywasm/corazawaf/example/Status.java b/quarkus-x-corazawaf-example/src/main/java/io/roastedroot/proxywasm/corazawaf/example/Status.java
index ebbef1c..fcd9f97 100644
--- a/quarkus-x-corazawaf-example/src/main/java/io/roastedroot/proxywasm/corazawaf/example/Status.java
+++ b/quarkus-x-corazawaf-example/src/main/java/io/roastedroot/proxywasm/corazawaf/example/Status.java
@@ -12,40 +12,90 @@
import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.core.Response;
+/**
+ * JAX-RS resource class for handling requests to /status/{status}.
+ * Returns a response with the specified HTTP status code.
+ * Applies the "waf" Wasm plugin.
+ */
@Path("/status/{status}")
@WasmPlugin("waf") // use the corsaWAF filter
public class Status {
+ /**
+ * Default constructor.
+ */
+ public Status() {
+ // Default constructor
+ }
+
+ /**
+ * Handles GET requests.
+ * @param status The desired HTTP status code.
+ * @return A Response with the specified status.
+ */
@GET
public Response gext(@PathParam("status") int status) {
return Response.status(status).build();
}
+ /**
+ * Handles DELETE requests.
+ * @param status The desired HTTP status code.
+ * @return A Response with the specified status.
+ */
@DELETE
public Response delete(@PathParam("status") int status) {
return Response.status(status).build();
}
+ /**
+ * Handles OPTIONS requests.
+ * @param status The desired HTTP status code.
+ * @return A Response with the specified status.
+ */
@OPTIONS
public Response options(@PathParam("status") int status) {
return Response.status(status).build();
}
+ /**
+ * Handles HEAD requests.
+ * @param status The desired HTTP status code.
+ * @return A Response with the specified status.
+ */
@HEAD
public Response head(@PathParam("status") int status) {
return Response.status(status).build();
}
+ /**
+ * Handles POST requests.
+ * @param status The desired HTTP status code.
+ * @param body The request body (ignored).
+ * @return A Response with the specified status.
+ */
@POST
public Response postx(@PathParam("status") int status, String body) {
return Response.status(status).build();
}
+ /**
+ * Handles PUT requests.
+ * @param status The desired HTTP status code.
+ * @param body The request body (ignored).
+ * @return A Response with the specified status.
+ */
@PUT
public Response put(@PathParam("status") int status, String body) {
return Response.status(status).build();
}
+ /**
+ * Handles PATCH requests.
+ * @param status The desired HTTP status code.
+ * @param body The request body (ignored).
+ * @return A Response with the specified status.
+ */
@PATCH
public Response patch(@PathParam("status") int status, String body) {
return Response.status(status).build();
diff --git a/quarkus-x-kuadrant-example/pom.xml b/quarkus-x-kuadrant-example/pom.xml
index 043fcf5..0e11511 100644
--- a/quarkus-x-kuadrant-example/pom.xml
+++ b/quarkus-x-kuadrant-example/pom.xml
@@ -98,7 +98,7 @@
wasm-aot-gen
- io.roastedroot.proxywasm.kuadrant.example.WasmShim
+ io.roastedroot.proxywasm.kuadrant.example.internal.WasmShim
src/main/wasm/wasm_shim.wasm
diff --git a/quarkus-x-kuadrant-example/src/main/java/io/roastedroot/proxywasm/kuadrant/example/App.java b/quarkus-x-kuadrant-example/src/main/java/io/roastedroot/proxywasm/kuadrant/example/App.java
index 8925c90..3bd3737 100644
--- a/quarkus-x-kuadrant-example/src/main/java/io/roastedroot/proxywasm/kuadrant/example/App.java
+++ b/quarkus-x-kuadrant-example/src/main/java/io/roastedroot/proxywasm/kuadrant/example/App.java
@@ -5,6 +5,7 @@
import io.roastedroot.proxywasm.PluginFactory;
import io.roastedroot.proxywasm.SimpleMetricsHandler;
import io.roastedroot.proxywasm.StartException;
+import io.roastedroot.proxywasm.kuadrant.example.internal.WasmShimModule;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.enterprise.inject.Produces;
import java.io.IOException;
@@ -15,9 +16,20 @@
import java.util.Map;
import org.eclipse.microprofile.config.inject.ConfigProperty;
+/**
+ * Application configuration class for the Kuadrant example.
+ * Sets up the Wasm PluginFactory for the Kuadrant plugin.
+ */
@ApplicationScoped
public class App {
+ /**
+ * Default constructor.
+ */
+ public App() {
+ // Default constructor
+ }
+
static final String CONFIG;
static {
@@ -33,6 +45,14 @@ public class App {
@ConfigProperty(name = "limitador.rls.url")
String limitadorUrl;
+ /**
+ * Produces the PluginFactory for the Kuadrant Wasm plugin.
+ * Configures the plugin with necessary settings like name, machine factory,
+ * logger, plugin configuration, upstream URIs, and metrics handler.
+ *
+ * @return A configured PluginFactory for the Kuadrant plugin.
+ * @throws StartException if there is an error during plugin initialization.
+ */
@Produces
public PluginFactory kuadrant() throws StartException {
return () ->
diff --git a/quarkus-x-kuadrant-example/src/main/java/io/roastedroot/proxywasm/kuadrant/example/Resources.java b/quarkus-x-kuadrant-example/src/main/java/io/roastedroot/proxywasm/kuadrant/example/Resources.java
index 6e03cd2..714a6e9 100644
--- a/quarkus-x-kuadrant-example/src/main/java/io/roastedroot/proxywasm/kuadrant/example/Resources.java
+++ b/quarkus-x-kuadrant-example/src/main/java/io/roastedroot/proxywasm/kuadrant/example/Resources.java
@@ -4,10 +4,26 @@
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
+/**
+ * JAX-RS resource class for the Kuadrant example.
+ * This class defines the root endpoint and applies the Kuadrant WasmPlugin.
+ */
@WasmPlugin("kuadrant") // use the corsaWAF filter
@Path("/")
public class Resources {
+ /**
+ * Default constructor.
+ */
+ public Resources() {
+ // Default constructor
+ }
+
+ /**
+ * Handles GET requests to the root path ("/").
+ *
+ * @return A simple "Hello World" string.
+ */
@GET
public String root() {
return "Hello World";