enum class CompressedFileType
Supported pre compressed file types and associated extensions |
|
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 |
|
class LocalFileContent : ReadChannelContent
OutgoingContent representing a local file with a specified contentType, expires date and caching |
var Route.staticBasePackage: String?
Base package for relative resources calculations for static content |
|
var Route.staticRootFolder: File?
Base folder for relative files calculations for static content |
fun CachingOptions(cacheControl: CacheControl? = null, expires: ZonedDateTime): CachingOptions
Creates CachingOptions instance with ZonedDateTime expiration time |
|
fun LastModifiedVersion(lastModified: ZonedDateTime): LastModifiedVersion
Construct LastModifiedVersion version from a ZonedDateTime instance fun LastModifiedVersion(lastModified: FileTime): LastModifiedVersion
Construct LastModifiedVersion version from a FileTime instance |
|
fun LocalFileContent(baseDir: File, relativePath: String, contentType: ContentType = ContentType.defaultForFilePath(relativePath)): LocalFileContent fun LocalFileContent(baseDir: Path, relativePath: Path, contentType: ContentType = ContentType.defaultForFile(relativePath)): LocalFileContent
Creates an instance of LocalFileContent for a file designated by relativePath in a baseDir |
|
fun Route.default(localPath: String): Unit fun Route.default(localPath: File): Unit
Specifies localPath as a default file to serve when folder is requested |
|
fun Route.defaultResource(resource: String, resourcePackage: String? = null): Unit
Specifies resource as a default resources to serve when folder is requested |
|
fun Route.file(remotePath: String, localPath: String = remotePath): Unit fun Route.file(remotePath: String, localPath: File): Unit
Sets up routing to serve localPath file as remotePath |
|
fun Route.files(folder: String): Unit fun Route.files(folder: File): Unit
Sets up routing to serve all files from folder |
|
fun Route.preCompressed(vararg types: CompressedFileType = CompressedFileType.values(), configure: Route.() -> Unit): Unit
Support pre-compressed files in the file system only (not just any classpath resource) |
|
fun ApplicationCall.resolveResource(path: String, resourcePackage: String? = null, classLoader: ClassLoader = application.environment.classLoader, mimeResolve: (String) -> ContentType = { ContentType.defaultForFileExtension(it) }): OutgoingContent? |
|
fun Route.resource(remotePath: String, resource: String = remotePath, resourcePackage: String? = null): Unit
Sets up routing to serve resource as remotePath in resourcePackage |
|
fun resourceClasspathResource(url: URL, path: String, mimeResolve: (String) -> ContentType): OutgoingContent?
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. |
|
fun Route.resources(resourcePackage: String? = null): Unit
Sets up routing to serve all resources in resourcePackage |
|
fun Route.static(configure: Route.() -> Unit): Route
Create a block for static content fun Route.static(remotePath: String, configure: Route.() -> Unit): Route
Create a block for static content at specified remotePath |