Package com.linecorp.armeria.server.file
Interface AggregatedHttpFile
public interface AggregatedHttpFile
A complete HTTP file whose attributes and content are readily available.
-
Method Summary
Modifier and Type Method Description HttpFileAttributes
attributes()
Returns the attributes of the file.static AggregatedHttpFileBuilder
builder(HttpData data)
Returns a newAggregatedHttpFileBuilder
that builds anAggregatedHttpFile
from the specifiedHttpData
.static AggregatedHttpFileBuilder
builder(HttpData data, long lastModifiedMillis)
Returns a newAggregatedHttpFileBuilder
that builds anAggregatedHttpFile
from the specifiedHttpData
andlastModifiedMillis
.HttpData
content()
Returns the content of the file.ResponseHeaders
headers()
Returns the attributes of this file asResponseHeaders
, which could be useful for building a response for aHEAD
request.static AggregatedHttpFile
nonExistent()
Returns anAggregatedHttpFile
which represents a non-existent file.static AggregatedHttpFile
of(HttpData data)
Creates a newAggregatedHttpFile
which streams the specifiedHttpData
.static AggregatedHttpFile
of(HttpData data, long lastModifiedMillis)
default AggregatedHttpResponse
response()
Returns theAggregatedHttpResponse
generated from this file.HttpFile
toHttpFile()
Converts this file into anHttpFile
.
-
Method Details
-
of
Creates a newAggregatedHttpFile
which streams the specifiedHttpData
. This method is a shortcut forAggregatedHttpFile.of(data, System.currentTimeMillis()
. -
of
- Parameters:
data
- the data that provides the content of an HTTP responselastModifiedMillis
- when thedata
has been last modified, represented as the number of millisecond since the epoch
-
nonExistent
Returns anAggregatedHttpFile
which represents a non-existent file. -
builder
Returns a newAggregatedHttpFileBuilder
that builds anAggregatedHttpFile
from the specifiedHttpData
. The last modified date of the file is set to 'now'. -
builder
Returns a newAggregatedHttpFileBuilder
that builds anAggregatedHttpFile
from the specifiedHttpData
andlastModifiedMillis
.- Parameters:
data
- the content of the filelastModifiedMillis
- the last modified time represented as the number of milliseconds since the epoch
-
attributes
Returns the attributes of the file.- Returns:
- the attributes, or
null
if the file does not exist.
-
headers
Returns the attributes of this file asResponseHeaders
, which could be useful for building a response for aHEAD
request.- Returns:
- the headers, or
null
if the file does not exist.
-
response
Returns theAggregatedHttpResponse
generated from this file.- Returns:
- the
AggregatedHttpResponse
of the file, ornull
if the file does not exist.
-
content
Returns the content of the file.- Returns:
- the content, or
null
if the file does not exist.
-
toHttpFile
HttpFile toHttpFile()Converts this file into anHttpFile
.- Returns:
- the
HttpFile
converted from this file.
-