diff --git a/build.gradle b/build.gradle index 027c102..3391c24 100644 --- a/build.gradle +++ b/build.gradle @@ -21,12 +21,12 @@ dependencies { } task sourcesJar(type: Jar, dependsOn: classes) { - classifier = 'sources' + archiveClassifier.set("sources") from sourceSets.main.allSource } task javadocJar(type: Jar, dependsOn: javadoc) { - classifier = 'javadoc' + archiveClassifier.set("javadoc") from javadoc.destinationDir } diff --git a/src/main/java/io/tus/java/client/TusClient.java b/src/main/java/io/tus/java/client/TusClient.java index 9b3a5fb..f64b8ea 100644 --- a/src/main/java/io/tus/java/client/TusClient.java +++ b/src/main/java/io/tus/java/client/TusClient.java @@ -156,6 +156,8 @@ public TusUploader createUpload(@NotNull TusUpload upload) throws ProtocolExcept throw new ProtocolException("missing upload URL in response for creating upload", connection); } + onConnectionOpened(connection); + // The upload URL must be relative to the URL of the request by which is was returned, // not the upload creation URL. In most cases, there is no difference between those two // but there may be cases in which the POST request is redirected. @@ -168,6 +170,13 @@ public TusUploader createUpload(@NotNull TusUpload upload) throws ProtocolExcept return new TusUploader(this, uploadURL, upload.getTusInputStream(), 0); } + /** + * Hook for subclasses to do any post-open tasks + * + * @param urlConnection + */ + protected void onConnectionOpened(HttpURLConnection urlConnection) {} + /** * Try to resume an already started upload. Before call this function, resuming must be * enabled using {@link #enableResuming(TusURLStore)}. This method will look up the URL for this @@ -212,6 +221,8 @@ public TusUploader resumeUpload(@NotNull TusUpload upload) throws FingerprintNot } long offset = Long.parseLong(offsetStr); + onConnectionOpened(connection); + return new TusUploader(this, uploadURL, upload.getTusInputStream(), offset); }