Class HttpResourceProvider
java.lang.Object
wtf.ranked.hytale.server.runner.resource.ResourceProvider
wtf.ranked.hytale.server.runner.resource.HttpResourceProvider
- All Implemented Interfaces:
org.gradle.api.services.BuildService<HytaleExtensionParameters>
HTTP implementation of the
ResourceProvider.
Utilizes the native Java HttpClient to perform file downloads.
Features include:
- Automatic follow-redirects (
HttpClient.Redirect.ALWAYS). - Direct file streaming via
HttpResponse.BodyHandlers.ofFile(Path). - Atomic failure handling: deletes the destination file if the download fails or returns a non-success status code.
-
Nested Class Summary
Nested classes/interfaces inherited from class ResourceProvider
ResourceProvider.ResourceRequest -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected final voidprovide(@NonNull ResourceProvider.ResourceRequest request) Executes an HTTP GET request and streams the response directly to a file.Methods inherited from class ResourceProvider
builderModifier and TypeMethodDescriptionfinal @NonNull ResourceProvider.ResourceRequest.Builderbuilder()Creates a new builder for a resource acquisition request.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.gradle.api.services.BuildService
getParameters
-
Constructor Details
-
HttpResourceProvider
public HttpResourceProvider()
-
-
Method Details
-
provide
protected final void provide(@NonNull ResourceProvider.ResourceRequest request) throws ResourceDownloadException Executes an HTTP GET request and streams the response directly to a file.- Specified by:
providein classResourceProvider- Parameters:
request- the URI and destination file details- Throws:
ResourceDownloadException
-