Class SpartaServerClient
java.lang.Object
be.kuleuven.cs.distrinet.sparta.cli.SpartaServerClient
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.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceWrites the JSON request body to the supplied writer. -
Method Summary
Modifier and TypeMethodDescriptionstatic booleansubmit(String serverUrl, String token, String commitId, SpartaServerClient.BodyWriter body) POST a JSON payload to the SPARTA server.
-
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 behttps(the token would otherwise be sent in the clear).token- the submission token, sent as thetokenheader.commitId- the commit id, sent as thecommitIdheader.body- writes the JSON request body.- Returns:
trueif the server accepted the submission (HTTP < 400);falseon an insecure URL, a write error, an HTTP error status, or any I/O failure.
-