Class A2AServerResource

java.lang.Object
org.wildfly.extras.a2a.server.apps.jsonrpc.A2AServerResource

@Path("/") public class A2AServerResource extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    jakarta.ws.rs.core.Response
    Handles incoming GET requests to the agent card endpoint.
    jakarta.ws.rs.core.Response
    handleNonStreamingRequests(String body, jakarta.servlet.http.HttpServletRequest httpRequest, jakarta.ws.rs.core.SecurityContext securityContext)
    Handles incoming POST requests to the main A2A endpoint.
    void
    handleStreamingRequests(String body, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.http.HttpServletRequest httpRequest, jakarta.ws.rs.core.SecurityContext securityContext)
    Handles incoming POST requests to the main A2A endpoint that involve Server-Sent Events (SSE).
    static void
    setStreamingIsSubscribedRunnable(Runnable streamingIsSubscribedRunnable)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • A2AServerResource

      public A2AServerResource()
  • Method Details

    • handleNonStreamingRequests

      @POST @Consumes("application/json") @Produces("application/json") public jakarta.ws.rs.core.Response handleNonStreamingRequests(String body, @Context jakarta.servlet.http.HttpServletRequest httpRequest, @Context jakarta.ws.rs.core.SecurityContext securityContext)
      Handles incoming POST requests to the main A2A endpoint. Dispatches the request to the appropriate JSON-RPC handler method and returns the response.
      Parameters:
      body - the JSON-RPC request string
      Returns:
      the JSON-RPC response which may be an error response
    • handleStreamingRequests

      @POST @Consumes("application/json") @Produces("text/event-stream") public void handleStreamingRequests(String body, @Context jakarta.servlet.http.HttpServletResponse response, @Context jakarta.servlet.http.HttpServletRequest httpRequest, @Context jakarta.ws.rs.core.SecurityContext securityContext) throws IOException
      Handles incoming POST requests to the main A2A endpoint that involve Server-Sent Events (SSE). Uses custom SSE response handling to avoid JAX-RS SSE compatibility issues with async publishers.
      Throws:
      IOException
    • getAgentCard

      @GET @Path("/.well-known/agent-card.json") @Produces("application/json") public jakarta.ws.rs.core.Response getAgentCard()
      Handles incoming GET requests to the agent card endpoint. Returns the agent card in JSON format with appropriate caching headers.

      Per A2A specification section 8.6, Agent Card HTTP endpoints SHOULD include:

      • Cache-Control header with max-age directive (CARD-CACHE-001)
      • ETag header for conditional request support (CARD-CACHE-002)
      • Last-Modified header in RFC 1123 format (CARD-CACHE-003)
      Returns:
      the agent card with caching headers
    • setStreamingIsSubscribedRunnable

      public static void setStreamingIsSubscribedRunnable(Runnable streamingIsSubscribedRunnable)