Package vaultWeb.services
Class CloudPageMediaClient
java.lang.Object
vaultWeb.services.CloudPageMediaClient
Streams file bytes out of the cloud-page service on behalf of a user.
The request is forwarded rather than proxied blindly: this client mints a short-lived cloud-page access token for the named user, so cloud-page performs its own ownership and path-traversal checks exactly as it would for a direct call. The proxy therefore never widens what a user can reach.
Responses are returned as a live InputStream. Nothing is buffered into memory, which
is the whole point of the exercise: a multi-gigabyte video must not be materialised on the
vault-web heap in order to serve a 500 KB range request.
-
Constructor Summary
ConstructorsConstructorDescriptionCloudPageMediaClient(String sharedSecret, String cloudPageBaseUrl, boolean trustSelfSigned) -
Method Summary
Modifier and TypeMethodDescriptionForwards a view request for a single file to cloud-page.
-
Constructor Details
-
CloudPageMediaClient
-
-
Method Details
-
fetch
public HttpResponse<InputStream> fetch(String username, String path, String rangeHeader, String ifNoneMatch, String ifModifiedSince) throws IOException, InterruptedException Forwards a view request for a single file to cloud-page.- Parameters:
username- the user whose storage the file is read frompath- the user-root-relative file pathrangeHeader- the inboundRangeheader, ornullif absentifNoneMatch- the inboundIf-None-Matchheader, ornullifModifiedSince- the inboundIf-Modified-Sinceheader, ornull- Returns:
- the upstream response, its body still streaming
- Throws:
IOExceptionInterruptedException
-