Class BinaryDownloadOptions.BinaryDownloadOptionsBuilder

  • Enclosing class:
    BinaryDownloadOptions

    public static final class BinaryDownloadOptions.BinaryDownloadOptionsBuilder
    extends java.lang.Object
    Used to build an instance of BinaryDownloadOptions with the options set as desired by the caller.
    • Method Detail

      • withMediaType

        @NotNull
        public @NotNull BinaryDownloadOptions.BinaryDownloadOptionsBuilder withMediaType​(@NotNull
                                                                                         @NotNull java.lang.String mediaType)
        Sets the internet media type of the BinaryDownloadOptions object to be built. This value should be a valid jcr:mimeType.

        Calling this method has the effect of instructing the service provider to set mediaType as the internet media type in the Content-Type header field of the response to a request issued with a URI obtained by calling BinaryDownload.getURI(BinaryDownloadOptions). This value can be later retrieved by calling BinaryDownloadOptions.getMediaType() on the instance returned from a call to build().

        Note that if the internet media type defines a "charset" parameter (as many textual types do), the caller may also wish to set the character encoding which is done separately. See withCharacterEncoding(String).

        The caller should ensure that the internet media type set is valid; the implementation does not perform any validation of this setting.

        If no internet media type is provided, no Content-Type header field will be specified to the service provider.

        Parameters:
        mediaType - The internet media type.
        Returns:
        The calling instance.
        See Also:
        JCR 2.0 Repository Model - jcr:mimeType
      • withCharacterEncoding

        @NotNull
        public @NotNull BinaryDownloadOptions.BinaryDownloadOptionsBuilder withCharacterEncoding​(@NotNull
                                                                                                 @NotNull java.lang.String characterEncoding)
        Sets the character encoding of the BinaryDownloadOptions object to be built. This value should be a valid jcr:encoding property value.

        Calling this method has the effect of instructing the service provider to set characterEncoding as the "charset" parameter of the content type in the Content-Type header field of the response to a request issued with a URI obtained by calling BinaryDownload.getURI(BinaryDownloadOptions). This value can be later retrieved by calling BinaryDownloadOptions.getCharacterEncoding() on the instance returned by a call to build().

        Note that setting the character encoding only makes sense if the internet media type has also been set, and that media type actually defines a "charset" parameter. See withMediaType(String).

        The caller should ensure that the proper character encoding has been set for the internet media type; the implementation does not perform any validation of these settings.

        Parameters:
        characterEncoding - A String representation of the jcr:encoding.
        Returns:
        The calling instance.
        See Also:
        JCR 2.0 Repository Model - jcr:encoding
      • withDispositionTypeInline

        @NotNull
        public @NotNull BinaryDownloadOptions.BinaryDownloadOptionsBuilder withDispositionTypeInline()
        Sets the disposition type of the BinaryDownloadOptions object to be built to inline.

        Calling this method has the effect of instructing the service provider to set the disposition type in the Content-Disposition header of the response to inline. This value can be later retrieved by calling BinaryDownloadOptions.getDispositionType() on the instance built by calling build().

        If this value is not set, the default value of inline will be used.

        Returns:
        The calling instance.
      • withDispositionTypeAttachment

        @NotNull
        public @NotNull BinaryDownloadOptions.BinaryDownloadOptionsBuilder withDispositionTypeAttachment()
        Sets the disposition type of the BinaryDownloadOptions object to be built to attachment.

        Calling this method has the effect of instructing the service provider to set the disposition type in the Content-Disposition header of the response to attachment. This value can later be retrieved by calling BinaryDownloadOptions.getDispositionType() on the instance built by calling build().

        If this value is not set, the default value of inline will be used.

        Returns:
        The calling instance.
      • withDomainOverrideIgnored

        public BinaryDownloadOptions.BinaryDownloadOptionsBuilder withDomainOverrideIgnored​(boolean domainOverrideIgnored)
        Sets a flag to indicate whether any configured download domain override value should be ignored when generating the signed download URI.

        The default value of this flag is false. This means that if a download domain override configuration value is provided, that value will be used in a signed download URI as the hostname, and if not provided the default hostname will be used instead. However, if this flag is set to true, the implementation will use the default hostname for the signed download URI regardless of whether the download domain override value is configured or not. Most clients will want to accept the default behavior. However, if a client understands its deployment topology it may know that ignoring the download domain override will provide better performance. An example of this is if the client is a service running in the same cloud region as the blob store, in which case accessing the storage directly is almost always faster than going through a domain override (e.g. CDN domain).

        Parameters:
        domainOverrideIgnored -
        Returns:
        The calling instance.