Package io.ktor.http.content
Types
class ByteArrayContent : ByteArrayContent Implementation of the OutgoingContent.ByteArrayContent for sending array of bytes |
|
data class CachingOptions Specifies caching properties for an OutgoingContent such as Cache-Control or Expires |
|
data class EntityTagVersion : Version This version checks etag value and pass it through conditions supplied by the remote client. Depending on conditions it produces return value of enum type VersionCheckResult |
|
class HttpStatusCodeContent : NoContent Represents a simple status code response with no content |
|
class JarFileContent : ReadChannelContent Represents an OutgoingContent for a resource inside a Jar file |
|
data class LastModifiedVersion : Version This version passes the given lastModified date through the client provided http conditional headers If-Modified-Since and If-Unmodified-Since. |
|
class LocalFileContent : ReadChannelContent OutgoingContent representing a local file with a specified contentType, expires date and caching |
|
interface MultiPartData Represents a multipart data stream that could be received from a call |
|
sealed class OutgoingContent Information about the content to be sent to the peer, recognized by a client or server engine |
|
class OutputStreamContent : WriteChannelContent OutgoingContent to respond with OutputStream. The stream would be automatically closed after body finish. |
|
sealed class PartData Represents a multipart/form-data entry. Could be a FormItem or FileItem |
|
class TextContent : ByteArrayContent Represents a text content that could be sent |
|
class URIFileContent : ReadChannelContent Represents a content that is served from the specified uri |
|
interface Version Represents content version |
|
enum class VersionCheckResult Represent result of the version comparison between content being sent and HTTP request. |
|
class WriterContent : WriteChannelContent Represents a content that is produced by body function |
Properties
val CachingProperty: AttributeKey<CachingOptions> Specifies a key for CacheControl extension property for OutgoingContent |
|
val VersionListProperty: AttributeKey<List<Version>> Specifies a key for VersionList extension property for OutgoingContent |
|
var OutgoingContent.caching: CachingOptions? Gets or sets CacheControl instance as an extension property on this content |
|
Base package for relative resources calculations for static content |
|
Base folder for relative files calculations for static content |
|
val FileItem.streamProvider: () -> InputStream Provides file item’s content as an InputStream |
|
var OutgoingContent.versions: List<Version> Gets or sets list of Version instances as an extension property on this content |
Functions
fun CachingOptions( Creates CachingOptions instance with ZonedDateTime expiration time |
|
fun EntityTagVersion(spec: String): EntityTagVersion Creates an instance of EntityTagVersion parsing the spec via EntityTagVersion.parseSingle. |
|
fun LastModifiedVersion( Construct LastModifiedVersion version from a ZonedDateTime instance fun LastModifiedVersion( Construct LastModifiedVersion version from a FileTime instance |
|
fun LocalFileContent( fun LocalFileContent( Creates an instance of LocalFileContent for a file designated by relativePath in a baseDir |
|
Specifies localPath as a default file to serve when folder is requested |
|
Specifies resource as a default resources to serve when folder is requested |
|
Sets up routing to serve localPath file as remotePath |
|
Sets up routing to serve all files from folder |
|
suspend fun MultiPartData.forEachPart( Parse multipart data stream and invoke partHandler for each PartData encountered |
|
suspend fun MultiPartData.readAllParts(): List<PartData> Parse multipart data stream and put all parts into a list |
|
fun ApplicationCall.resolveResource( |
|
fun Route.resource( Sets up routing to serve resource as remotePath in resourcePackage |
|
fun resourceClasspathResource( Attempt to find a local file or a file inside of zip. This is not required but very good to have to improve performance and unnecessary java.io.InputStream creation. |
|
Sets up routing to serve all resources in resourcePackage |
|
Create a block for static content Create a block for static content at specified remotePath |
|
fun PipelineContext<Any, ApplicationCall>.transformDefaultContent( Default outgoing content transformation |