Package-level declarations

Types

Link copied to clipboard

Supported pre compressed file types and associated extensions

Link copied to clipboard
interface FileSystemPaths

Wrapper on FileSystem for more specific delegation since we use only getPath method from it.

Link copied to clipboard

Represents a simple status code response with no content

Link copied to clipboard
class JarFileContent(val jarFile: File, val resourcePath: String, val contentType: ContentType) : OutgoingContent.ReadChannelContent

Represents an OutgoingContent for a resource inside a Jar file

Link copied to clipboard
class LocalFileContent(val file: File, val contentType: ContentType = ContentType.defaultForFile(file)) : OutgoingContent.ReadChannelContent

OutgoingContent representing a local file with a specified contentType, expires date and caching

Link copied to clipboard
class LocalPathContent(val path: Path, val contentType: ContentType = ContentType.defaultForFileExtension(path.extension)) : OutgoingContent.ReadChannelContent
Link copied to clipboard
class SPAConfig(var defaultPage: String = "index.html", var applicationRoute: String = "/", var filesPath: String = "", var useResources: Boolean = false, ignoredFiles: MutableList<(String) -> Boolean> = mutableListOf())

Configuration for the Route.singlePageApplication plugin.

Link copied to clipboard

A config for serving static content

Properties

Link copied to clipboard

Checks if response body compression is suppressed for this ApplicationCall.

Link copied to clipboard
var <Error class: unknown class>.staticBasePackage: String?

Base package for relative resources calculations for static content

Link copied to clipboard

Attribute to assign the path of a static file served in the response. The main use of this attribute is to indicate to subsequent interceptors that a static file was served via the ApplicationCall.isStaticContent() extension function.

Link copied to clipboard
var <Error class: unknown class>.staticRootFolder: File?

Base folder for relative files calculations for static content

Link copied to clipboard

Attribute that could be added to an application call to prevent its response from being compressed

Functions

Link copied to clipboard
fun SPAConfig.angular(filesPath: String)

Creates an application configuration for the Angular project. Resources will be shared from the filesPath directory. The root file is index.html

Link copied to clipboard
fun SPAConfig.backbone(filesPath: String)

Creates an application configuration for the Backbone project. Resources will be shared from the filesPath directory. The root file is index.html

Link copied to clipboard
fun CachingOptions(cacheControl: CacheControl? = null, expires: ZonedDateTime): CachingOptions

Creates CachingOptions instance with ZonedDateTime expiration time

Link copied to clipboard
fun <Error class: unknown class>.default(localPath: File)
fun <Error class: unknown class>.default(localPath: String)

Specifies localPath as a default file to serve when folder is requested

Link copied to clipboard
fun <Error class: unknown class>.defaultResource(resource: String, resourcePackage: String? = null)

Specifies resource as a default resources to serve when folder is requested

Link copied to clipboard
fun SPAConfig.ember(filesPath: String)

Creates an application configuration for the Ember project. Resources will be shared from the filesPath directory. The root file is index.html

Link copied to clipboard
fun <Error class: unknown class>.file(remotePath: String, localPath: File)
fun <Error class: unknown class>.file(remotePath: String, localPath: String = remotePath)

Sets up routing to serve localPath file as remotePath

Link copied to clipboard
fun <Error class: unknown class>.files(folder: File)
fun <Error class: unknown class>.files(folder: String)

Sets up routing to serve all files from folder

Link copied to clipboard
fun SPAConfig.ignoreFiles(block: (path: String) -> Boolean)

Registers a block in ignoredFiles returns true if path should be ignored.

Link copied to clipboard
fun <Error class: unknown class>.isStaticContent(): Boolean

Checks if the application call is requesting static content

Link copied to clipboard

Construct LastModifiedVersion version from a FileTime instance

Construct LastModifiedVersion version from a ZonedDateTime instance

Construct LastModifiedVersion version from a Long instance

Link copied to clipboard
fun LocalFileContent(baseDir: File, relativePath: String, contentType: ContentType = ContentType.defaultForFilePath(relativePath)): LocalFileContent

Creates an instance of LocalFileContent for a file designated by relativePath in a baseDir

fun LocalFileContent(baseDir: Path, relativePath: Path, contentType: ContentType = ContentType.defaultForPath(relativePath)): LocalPathContent

Creates an instance of LocalPathContent for a path designated by relativePath in a baseDir

Link copied to clipboard
fun LocalPathContent(baseDir: Path, relativePath: Path, contentType: ContentType = ContentType.defaultForPath(relativePath)): LocalPathContent

Creates an instance of LocalPathContent for a path designated by relativePath in a baseDir

Link copied to clipboard
fun <Error class: unknown class>.preCompressed(vararg types: CompressedFileType = CompressedFileType.entries.toTypedArray(), configure: <Error class: unknown class>.() -> Unit)

Support pre-compressed files and resources

Link copied to clipboard
fun SPAConfig.react(filesPath: String)

Creates an application configuration for the React project. Resources will be shared from the filesPath directory. The root file is index.html

Link copied to clipboard
fun <Error class: unknown class>.resolveResource(path: String, resourcePackage: String? = null, classLoader: ClassLoader = application.environment.classLoader, mimeResolve: (String) -> ContentType = { ContentType.defaultForFileExtension(it) }): OutgoingContent.ReadChannelContent?
Link copied to clipboard
fun <Error class: unknown class>.resource(remotePath: String, resource: String = remotePath, resourcePackage: String? = null)

Sets up routing to serve resource as remotePath in resourcePackage

Link copied to clipboard

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.

Link copied to clipboard
fun <Error class: unknown class>.resources(resourcePackage: String? = null)

Sets up routing to serve all resources in resourcePackage

Link copied to clipboard
fun <Error class: unknown class>.singlePageApplication(configBuilder: SPAConfig.() -> Unit = {})

Serves a single-page application. You can learn more from Serving single-page applications.

Link copied to clipboard
fun <Error class: unknown class>.static(configure: <Error class: unknown class>.() -> Unit): <Error class: unknown class>

Create a block for static content

fun <Error class: unknown class>.static(remotePath: String, configure: <Error class: unknown class>.() -> Unit): <Error class: unknown class>

Create a block for static content at specified remotePath

Link copied to clipboard
fun <Error class: unknown class>.staticFiles(remotePath: String, dir: File, index: String? = "index.html", block: StaticContentConfig<File>.() -> Unit = {}): <Error class: unknown class>

Sets up RoutingRoot to serve static files. All files inside dir will be accessible recursively at "remotePath/path/to/file". If the requested file is a directory and index is not null, then response will be index file in the requested directory.

Link copied to clipboard
fun <Error class: unknown class>.staticFileSystem(remotePath: String, basePath: String?, index: String? = "index.html", fileSystem: FileSystemPaths = FileSystems.getDefault().paths(), block: StaticContentConfig<Path>.() -> Unit = {}): <Error class: unknown class>

Sets up RoutingRoot to serve fileSystem as static content. All paths inside basePath will be accessible recursively at "remotePath/path/to/resource". If requested path doesn't exist and index is not null, then response will be index path in the requested package.

Link copied to clipboard
fun <Error class: unknown class>.staticResources(remotePath: String, basePackage: String?, index: String? = "index.html", block: StaticContentConfig<URL>.() -> Unit = {}): <Error class: unknown class>

Sets up RoutingRoot to serve resources as static content. All resources inside basePackage will be accessible recursively at "remotePath/path/to/resource". If requested resource doesn't exist and index is not null, then response will be index resource in the requested package.

Link copied to clipboard
fun <Error class: unknown class>.staticZip(remotePath: String, basePath: String?, zip: Path, index: String? = "index.html", block: StaticContentConfig<Path>.() -> Unit = {}): <Error class: unknown class>

Sets up RoutingRoot to serve contents of zip as static content. All paths inside basePath will be accessible recursively at "remotePath/path/to/resource". If requested path doesn't exist and index is not null, then response will be index path in the requested package.

Link copied to clipboard

Suppress response body compression plugin for this ApplicationCall.

Link copied to clipboard

Default outgoing content transformation

Link copied to clipboard
fun SPAConfig.vue(filesPath: String)

Creates an application configuration for the Vue project. Resources will be shared from the filesPath directory. The root file is index.html