Skip to content
Merged
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
9 changes: 9 additions & 0 deletions a2a-java-sdk-server-jakarta.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
<component name="AdditionalModuleElements">
<content url="file://$MODULE_DIR$/impl" dumb="true">
<sourceFolder url="file://$MODULE_DIR$/impl/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/impl/src/test/java" isTestSource="true" />
</content>
</component>
</module>
42 changes: 42 additions & 0 deletions impl/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.wildfly.extras.a2a</groupId>
<artifactId>a2a-java-sdk-server-jakarta-parent</artifactId>
<version>0.2.3.Beta2-SNAPSHOT</version>
</parent>

<artifactId>a2a-java-sdk-server-jakarta</artifactId>

<packaging>jar</packaging>

<name>WildFly Extras - Java A2A SDK for Jakarta</name>
<description>Java SDK for the Agent2Agent Protocol (A2A) - SDK - Jakarta</description>

<dependencies>
<dependency>
<groupId>io.github.a2asdk</groupId>
<artifactId>a2a-java-sdk-server-common</artifactId>
</dependency>
<dependency>
<groupId>io.github.a2asdk</groupId>
<artifactId>a2a-java-sdk-tests-server-common</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.github.a2asdk</groupId>
<artifactId>a2a-java-sdk-tests-server-common</artifactId>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>jakarta.ws.rs</groupId>
<artifactId>jakarta.ws.rs-api</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class A2ARequestFilter implements ContainerRequestFilter {

@Override
public void filter(ContainerRequestContext requestContext) {
if (requestContext.getMethod().equals("POST") && requestContext.hasEntity()) {
if (isA2ARequest(requestContext)) {
try (InputStream entityInputStream = requestContext.getEntityStream()) {
byte[] requestBodyBytes = entityInputStream.readAllBytes();
String requestBody = new String(requestBodyBytes);
Expand All @@ -49,6 +49,14 @@ public void filter(ContainerRequestContext requestContext) {
}
}

private boolean isA2ARequest(ContainerRequestContext requestContext) {
String path = requestContext.getUriInfo().getPath().trim();
if (path.equals("/") || path.startsWith("/agent/") || path.startsWith("/.well-known/")) {
return requestContext.getMethod().equals("POST") && requestContext.hasEntity();
}
return false;
}

private static boolean isStreamingRequest(String requestBody) {
return requestBody.contains(SendStreamingMessageRequest.METHOD) ||
requestBody.contains(TaskResubscriptionRequest.METHOD);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ private JSONRPCResponse<?> generateErrorResponse(JSONRPCRequest<?> request, JSON
return new JSONRPCErrorResponse(request.getId(), error);
}

static void setStreamingIsSubscribedRunnable(Runnable streamingIsSubscribedRunnable) {
public static void setStreamingIsSubscribedRunnable(Runnable streamingIsSubscribedRunnable) {
A2AServerResource.streamingIsSubscribedRunnable = streamingIsSubscribedRunnable;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,4 @@
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee
https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd"
version="6.0">
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
</web-app>
217 changes: 83 additions & 134 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
</parent>

<groupId>org.wildfly.extras.a2a</groupId>
<artifactId>a2a-java-sdk-server-jakarta</artifactId>
<artifactId>a2a-java-sdk-server-jakarta-parent</artifactId>
<version>0.2.3.Beta2-SNAPSHOT</version>

<packaging>jar</packaging>
<packaging>pom</packaging>

<name>WildFly Extras - Java A2A SDK for Jakarta</name>
<description>Java SDK for the Agent2Agent Protocol (A2A) - SDK - Jakarta</description>
<name>WildFly Extras - Java A2A SDK for Jakarta Parent</name>
<description>Java SDK for the Agent2Agent Protocol (A2A) - SDK - Jakarta - Parent</description>

<url>https://github.com/wildfly-extras/a2a-java-sdk-server-jakarta</url>
<licenses>
Expand All @@ -43,24 +43,29 @@
</scm>

<properties>
<!--<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>-->
<jboss.home>${project.build.directory}${file.separator}wildfly</jboss.home>
<version.wildfly>36.0.1.Final</version.wildfly>
<version.sdk>0.2.3.Beta1</version.sdk>
<version.sdk>${project.version}</version.sdk>
<!-- This needs to be same version as used by the sdk -->
<version.mutiny-zero>1.1.1</version.mutiny-zero>

<version.jboss-commons-logging>1.0.0.Final</version.jboss-commons-logging>
<version.hamcrest>2.2</version.hamcrest>
<version.junit>5.12.2</version.junit>
<version.org.wildfly.arquillian>5.1.0.Beta11</version.org.wildfly.arquillian>
<version.org.jboss.arquillian>1.10.0.Final</version.org.jboss.arquillian>
<version.org.jboss.shrinkwrap.shrinkwrap>1.2.6</version.org.jboss.shrinkwrap.shrinkwrap>
<version.org.jboss.arquillian.jakarta>10.0.0.Final</version.org.jboss.arquillian.jakarta>
<version.shrinkwrap.resolvers>3.3.4</version.shrinkwrap.resolvers>
<version.rest-assured>5.5.1</version.rest-assured>
<version.rest-assured>5.5.5</version.rest-assured>

<jboss.home>${project.build.directory}${file.separator}wildfly</jboss.home>
<arquillian.java.vm.args></arquillian.java.vm.args>
<server.debug.port>8787</server.debug.port>

<!-- Redirect test output to file -->
<maven.test.redirectTestOutputToFile>true</maven.test.redirectTestOutputToFile>

</properties>
<dependencyManagement>
<dependencies>
Expand Down Expand Up @@ -92,96 +97,68 @@
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>io.github.a2asdk</groupId>
<artifactId>a2a-java-sdk-client</artifactId>
<version>${version.sdk}</version>
</dependency>
<dependency>
<groupId>io.github.a2asdk</groupId>
<artifactId>a2a-java-sdk-common</artifactId>
<version>${version.sdk}</version>
</dependency>
<dependency>
<groupId>io.github.a2asdk</groupId>
<artifactId>a2a-java-sdk-server-common</artifactId>
<version>${version.sdk}</version>
</dependency>
<dependency>
<groupId>io.github.a2asdk</groupId>
<artifactId>a2a-java-sdk-spec</artifactId>
<version>${version.sdk}</version>
</dependency>
<dependency>
<groupId>io.github.a2asdk</groupId>
<artifactId>a2a-java-sdk-tests-server-common</artifactId>
<version>${version.sdk}</version>
</dependency>
<dependency>
<groupId>io.smallrye.reactive</groupId>
<artifactId>mutiny-zero</artifactId>
<version>${version.mutiny-zero}</version>
</dependency>
<dependency>
<groupId>io.github.a2asdk</groupId>
<artifactId>a2a-java-sdk-tests-server-common</artifactId>
<type>test-jar</type>
<scope>test</scope>
<version>${version.sdk}</version>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<version>${version.rest-assured}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>commons-logging-jboss-logging</artifactId>
<version>${version.jboss-commons-logging}</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${version.junit}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
<version>${version.hamcrest}</version>
<scope>test</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>io.github.a2asdk</groupId>
<artifactId>a2a-java-sdk-server-common</artifactId>
<version>${version.sdk}</version>
</dependency>
<dependency>
<groupId>io.github.a2asdk</groupId>
<artifactId>a2a-java-sdk-tests-server-common</artifactId>
<version>${version.sdk}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.github.a2asdk</groupId>
<artifactId>a2a-java-sdk-tests-server-common</artifactId>
<type>test-jar</type>
<scope>test</scope>
<version>${version.sdk}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.enterprise</groupId>
<artifactId>jakarta.enterprise.cdi-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.inject</groupId>
<artifactId>jakarta.inject-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.json</groupId>
<artifactId>jakarta.json-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.ws.rs</groupId>
<artifactId>jakarta.ws.rs-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<version>${version.rest-assured}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit5</groupId>
<artifactId>arquillian-junit5-container</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.wildfly.arquillian</groupId>
<artifactId>wildfly-arquillian-container-managed</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.shrinkwrap</groupId>
<artifactId>shrinkwrap-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${version.junit}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.threads</groupId>
<artifactId>jboss-threads</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
<version>${version.hamcrest}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
Expand Down Expand Up @@ -259,27 +236,6 @@
</systemPropertyVariables>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
</configuration>
<executions>
<execution>
<id>copy</id>
<phase>generate-test-resources</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<includeScope>test</includeScope>
<excludeScope>provided</excludeScope>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
Expand Down Expand Up @@ -320,27 +276,20 @@
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.7.1</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.wildfly.glow</groupId>
<artifactId>wildfly-glow-arquillian-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
</plugin>
</plugins>
</build>
<modules>
<module>impl</module>
<module>wildfly-jar</module>
<module>tests/common</module>
<module>tests/impl</module>
<module>tests/wildfly-jar</module>
</modules>
<profiles>
<profile>
<id>debug.profile</id>
Expand Down
Loading