public abstract class AbstractHttpFileBuilder extends Object
HttpFile builder.| Constructor and Description |
|---|
AbstractHttpFileBuilder() |
| Modifier and Type | Method and Description |
|---|---|
AbstractHttpFileBuilder |
addHeader(CharSequence name,
Object value)
Adds the specified HTTP header.
|
AbstractHttpFileBuilder |
addHeaders(Iterable<? extends Map.Entry<? extends CharSequence,?>> headers)
Adds the specified HTTP headers.
|
AbstractHttpFileBuilder |
autoDetectedContentType(boolean contentTypeAutoDetectionEnabled)
Sets whether to set the
"content-type" header automatically based on the extension of the file. |
protected HttpHeaders |
buildHeaders()
Returns the immutable additional
HttpHeaders which will be set when building an
HttpResponse. |
AbstractHttpFileBuilder |
cacheControl(CacheControl cacheControl)
Sets the
"cache-control" header. |
AbstractHttpFileBuilder |
cacheControl(CharSequence cacheControl)
Sets the
"cache-control" header. |
protected Clock |
clock()
Returns the
Clock that provides the current date and time. |
AbstractHttpFileBuilder |
clock(Clock clock)
Sets the
Clock that provides the current date and time. |
AbstractHttpFileBuilder |
contentType(CharSequence contentType)
Sets the
"content-type" header. |
AbstractHttpFileBuilder |
contentType(MediaType contentType)
Sets the
"content-type" header. |
AbstractHttpFileBuilder |
date(boolean dateEnabled)
Sets whether to set the
"date" header automatically. |
AbstractHttpFileBuilder |
entityTag(BiFunction<String,HttpFileAttributes,String> entityTagFunction)
Sets the function which generates the entity tag that's used for setting the
"etag" header
automatically. |
AbstractHttpFileBuilder |
entityTag(boolean enabled)
Sets whether to set the
"etag" header automatically based on the path and attributes of the
file. |
protected BiFunction<String,HttpFileAttributes,String> |
entityTagFunction()
Returns the function which generates the entity tag that's used for setting the
"etag" header
automatically. |
protected boolean |
isContentTypeAutoDetectionEnabled()
Sets whether to set the
"content-type" header automatically based on the extension of the file. |
protected boolean |
isDateEnabled()
Returns whether to set the
"date" header automatically. |
protected boolean |
isLastModifiedEnabled()
Returns whether to set the
"last-modified" header automatically. |
AbstractHttpFileBuilder |
lastModified(boolean lastModifiedEnabled)
Sets whether to set the
"last-modified" header automatically. |
AbstractHttpFileBuilder |
setHeader(CharSequence name,
Object value)
Sets the specified HTTP header.
|
AbstractHttpFileBuilder |
setHeaders(Iterable<? extends Map.Entry<? extends CharSequence,?>> headers)
Sets the specified HTTP headers.
|
public AbstractHttpFileBuilder clock(Clock clock)
Clock that provides the current date and time. By default, Clock.systemUTC()
is used.protected final boolean isDateEnabled()
"date" header automatically.public AbstractHttpFileBuilder date(boolean dateEnabled)
"date" header automatically. By default, the "date" header is
set automatically.protected final boolean isLastModifiedEnabled()
"last-modified" header automatically.public AbstractHttpFileBuilder lastModified(boolean lastModifiedEnabled)
"last-modified" header automatically. By default,
the "last-modified" is set automatically.protected final boolean isContentTypeAutoDetectionEnabled()
"content-type" header automatically based on the extension of the file.public AbstractHttpFileBuilder autoDetectedContentType(boolean contentTypeAutoDetectionEnabled)
"content-type" header automatically based on the extension of the file.
By default, the "content-type" header is set automatically.protected final BiFunction<String,HttpFileAttributes,String> entityTagFunction()
"etag" header
automatically.null if the "etag" header is not set automatically.public AbstractHttpFileBuilder entityTag(boolean enabled)
"etag" header automatically based on the path and attributes of the
file. By default, the "etag" header is set automatically. Use entityTag(BiFunction) to
customize how an entity tag is generated.public AbstractHttpFileBuilder entityTag(BiFunction<String,HttpFileAttributes,String> entityTagFunction)
"etag" header
automatically.entityTagFunction - the entity tag function that generates the entity tag, or null
to disable setting the "etag" header.protected final HttpHeaders buildHeaders()
HttpHeaders which will be set when building an
HttpResponse.public AbstractHttpFileBuilder addHeader(CharSequence name, Object value)
public AbstractHttpFileBuilder addHeaders(Iterable<? extends Map.Entry<? extends CharSequence,?>> headers)
public AbstractHttpFileBuilder setHeader(CharSequence name, Object value)
public AbstractHttpFileBuilder setHeaders(Iterable<? extends Map.Entry<? extends CharSequence,?>> headers)
public AbstractHttpFileBuilder contentType(MediaType contentType)
"content-type" header. This method is a shortcut for:
builder.autoDetectedContentType(false);
builder.setHeader(HttpHeaderNames.CONTENT_TYPE, contentType);
public AbstractHttpFileBuilder contentType(CharSequence contentType)
"content-type" header. This method is a shortcut for:
builder.autoDetectedContentType(false);
builder.setHeader(HttpHeaderNames.CONTENT_TYPE, contentType);
public AbstractHttpFileBuilder cacheControl(CacheControl cacheControl)
"cache-control" header. This method is a shortcut for:
builder.setHeader(HttpHeaderNames.CACHE_CONTROL, cacheControl);
public AbstractHttpFileBuilder cacheControl(CharSequence cacheControl)
"cache-control" header. This method is a shortcut for:
builder.setHeader(HttpHeaderNames.CACHE_CONTROL, cacheControl);
Copyright © 2020 LeanCloud. All rights reserved.