Class NetSubmitter

java.lang.Object
io.github.projectunified.faststats.net.NetSubmitter
All Implemented Interfaces:
Submitter

public class NetSubmitter extends Object implements Submitter
Implementation of Submitter that uses HttpURLConnection to submit GZIP-compressed telemetry payloads.
  • Constructor Details

    • NetSubmitter

      public NetSubmitter(String token)
      Constructs a new NetSubmitter with default settings.
      Parameters:
      token - the authorization token (bearer)
    • NetSubmitter

      public NetSubmitter(String baseUrl, String token, String userAgent)
      Constructs a new NetSubmitter.
      Parameters:
      baseUrl - the base URL
      token - the authorization token (bearer)
      userAgent - the user agent header value
  • Method Details

    • execute

      public Submitter.Response execute(String path, String json, boolean compressed) throws Exception
      Description copied from interface: Submitter
      Executes the HTTP request and returns the response context.
      Specified by:
      execute in interface Submitter
      Parameters:
      path - the target path or URL
      json - the JSON payload
      compressed - whether to compress the payload using GZIP
      Returns:
      the response context
      Throws:
      Exception - if a non-recoverable error occurs