diff --git a/README.md b/README.md index bd5f48e..5a12971 100644 --- a/README.md +++ b/README.md @@ -232,6 +232,12 @@ is JSON); `tags` always holds at least `version`, and `install` whenever the client has an [installation ID](#every-event-carries-a-random-server-id). The server assigns the timestamp. A `201` is success; anything else is logged at `FINE` and dropped. +Redirects are not followed. The body is streamed with a fixed length, so +`HttpURLConnection` cannot re-send it to a redirect target: a redirect is +logged at `FINE` and the report is dropped, like any other answer that is +not `201`. Give `baseUrl` as the final URL — `https://` if the server +redirects `http://` there — or nothing reaches the server. + ## Keys A key identifies the program to the server and lets the operator revoke it; diff --git a/src/main/java/software/stephenson/trace/TraceClient.java b/src/main/java/software/stephenson/trace/TraceClient.java index c83a2b9..6a56831 100644 --- a/src/main/java/software/stephenson/trace/TraceClient.java +++ b/src/main/java/software/stephenson/trace/TraceClient.java @@ -243,7 +243,10 @@ private TraceClient(Builder builder) { * at {@code version}, reporting to the trace server at {@code baseUrl}. * The version is sent as the tag {@code version} on every event; a blank * one, or one longer than {@value #MAX_TAG_LENGTH} characters, is an - * {@link IllegalArgumentException}. + * {@link IllegalArgumentException}. Redirects are not followed, so + * {@code baseUrl} must be the final URL (e.g. {@code https://} when the + * server redirects {@code http://} there); otherwise every report is + * dropped and logged at {@code FINE}. */ public static Builder builder(String baseUrl, String application, String version) { return new Builder(baseUrl, application, version);