Class SpartaServerClient

java.lang.Object
be.kuleuven.cs.distrinet.sparta.cli.SpartaServerClient

public final class SpartaServerClient extends Object
Shared client for submitting SPARTA analysis results to a CTAM server over HTTP. This centralizes the POST mechanics — https enforcement, connect/read timeouts, the token and commit-id headers, UTF-8 body encoding, HTTP status handling and error-stream reading — so that both the CLI exporter (SubmitToSpartaServer) and the CI runner (SpartaCi) use one implementation instead of duplicating it. Callers supply only the endpoint, credentials and a SpartaServerClient.BodyWriter that serializes the (differently-shaped) JSON payload.
  • Method Details

    • submit

      public static boolean submit(String serverUrl, String token, String commitId, SpartaServerClient.BodyWriter body)
      POST a JSON payload to the SPARTA server.
      Parameters:
      serverUrl - the server URL; must be https (the token would otherwise be sent in the clear).
      token - the submission token, sent as the token header.
      commitId - the commit id, sent as the commitId header.
      body - writes the JSON request body.
      Returns:
      true if the server accepted the submission (HTTP < 400); false on an insecure URL, a write error, an HTTP error status, or any I/O failure.