Class BinaryDownloadOptions.BinaryDownloadOptionsBuilder
- java.lang.Object
-
- org.apache.jackrabbit.api.binary.BinaryDownloadOptions.BinaryDownloadOptionsBuilder
-
- Enclosing class:
- BinaryDownloadOptions
public static final class BinaryDownloadOptions.BinaryDownloadOptionsBuilder extends java.lang.Object
Used to build an instance ofBinaryDownloadOptions
with the options set as desired by the caller.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull BinaryDownloadOptions
build()
Construct aBinaryDownloadOptions
instance with the properties specified to the builder.@NotNull BinaryDownloadOptions.BinaryDownloadOptionsBuilder
withCharacterEncoding(@NotNull java.lang.String characterEncoding)
Sets the character encoding of theBinaryDownloadOptions
object to be built.@NotNull BinaryDownloadOptions.BinaryDownloadOptionsBuilder
withDispositionTypeAttachment()
Sets the disposition type of theBinaryDownloadOptions
object to be built toattachment
.@NotNull BinaryDownloadOptions.BinaryDownloadOptionsBuilder
withDispositionTypeInline()
Sets the disposition type of theBinaryDownloadOptions
object to be built toinline
.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.@NotNull BinaryDownloadOptions.BinaryDownloadOptionsBuilder
withFileName(@NotNull java.lang.String fileName)
Sets the filename of theBinaryDownloadOptions
object to be built.@NotNull BinaryDownloadOptions.BinaryDownloadOptionsBuilder
withMediaType(@NotNull java.lang.String mediaType)
Sets the internet media type of theBinaryDownloadOptions
object to be built.
-
-
-
Method Detail
-
withMediaType
@NotNull public @NotNull BinaryDownloadOptions.BinaryDownloadOptionsBuilder withMediaType(@NotNull @NotNull java.lang.String mediaType)
Sets the internet media type of theBinaryDownloadOptions
object to be built. This value should be a validjcr:mimeType
.Calling this method has the effect of instructing the service provider to set
mediaType
as the internet media type in theContent-Type
header field of the response to a request issued with a URI obtained by callingBinaryDownload.getURI(BinaryDownloadOptions)
. This value can be later retrieved by callingBinaryDownloadOptions.getMediaType()
on the instance returned from a call tobuild()
.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 theBinaryDownloadOptions
object to be built. This value should be a validjcr: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 theContent-Type
header field of the response to a request issued with a URI obtained by callingBinaryDownload.getURI(BinaryDownloadOptions)
. This value can be later retrieved by callingBinaryDownloadOptions.getCharacterEncoding()
on the instance returned by a call tobuild()
.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
-
withFileName
@NotNull public @NotNull BinaryDownloadOptions.BinaryDownloadOptionsBuilder withFileName(@NotNull @NotNull java.lang.String fileName)
Sets the filename of theBinaryDownloadOptions
object to be built. This would typically be based on a JCR node name.Calling this method has the effect of instructing the service provider to set
fileName
as the filename in theContent-Disposition
header of the response to a request issued with a URI obtained by callingBinaryDownload.getURI(BinaryDownloadOptions)
. This value can be later retrieved by callingBinaryDownloadOptions.getFileName()
on the instance returned by a call tobuild()
.- Parameters:
fileName
- The filename.- Returns:
- The calling instance.
- See Also:
- RFC 6266, Section 4.3
-
withDispositionTypeInline
@NotNull public @NotNull BinaryDownloadOptions.BinaryDownloadOptionsBuilder withDispositionTypeInline()
Sets the disposition type of theBinaryDownloadOptions
object to be built toinline
.Calling this method has the effect of instructing the service provider to set the disposition type in the
Content-Disposition
header of the response toinline
. This value can be later retrieved by callingBinaryDownloadOptions.getDispositionType()
on the instance built by callingbuild()
.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 theBinaryDownloadOptions
object to be built toattachment
.Calling this method has the effect of instructing the service provider to set the disposition type in the
Content-Disposition
header of the response toattachment
. This value can later be retrieved by callingBinaryDownloadOptions.getDispositionType()
on the instance built by callingbuild()
.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.
-
build
@NotNull public @NotNull BinaryDownloadOptions build()
Construct aBinaryDownloadOptions
instance with the properties specified to the builder.- Returns:
- A new
BinaryDownloadOptions
instance built with the properties specified to the builder.
-
-