Package-level declarations

Types

Link copied to clipboard
interface Application

Static class interface which equips a Micronaut application with extra initialization features powered by Elide; to use, simply enforce that your entrypoint object complies with this interface.

Link copied to clipboard
class AssetHandler(initialExpectedType: AssetType? = null, handler: ElideController, request: HttpRequest<*>, moduleId: AtomicReference<AssetModuleId?> = AtomicReference(null), expectedType: AtomicReference<AssetType?> = AtomicReference(initialExpectedType)) : BaseResponseHandler<ByteArray>
Link copied to clipboard
typealias AssetModuleId = String

Typealias for a registered string which is used as an Asset Module ID.

Link copied to clipboard
typealias AssetTag = String

Typealias for a registered string which is used as an Asset Tag.

Link copied to clipboard

Raw streamed file wrapper, after unwrapping the type.

Link copied to clipboard
typealias FinalizedAssetResponse = MutableHttpResponse<FinalizedAsset>

Raw streamed asset response, used internally for assets.

Link copied to clipboard
class HtmlRenderer(prettyhtml: Boolean = false, handler: PageController? = null, builder: suspend HTML.() -> Unit) : SuspensionRenderer<ByteArrayOutputStream>
Link copied to clipboard
typealias RawPayload = ByteArray

Raw bytes body type used internally by Elide.

Link copied to clipboard
typealias RawResponse = HttpResponse<RawPayload>

Raw bytes response typealias used internally by Elide.

Link copied to clipboard

Describes a handler object which can respond to a request with a given ResponseBody type; these throw-away handlers are typically spawned by utility functions to create a context where rendering can take place.

Link copied to clipboard

Affixed to classes which initialize Elide server instances.

Link copied to clipboard
typealias StreamedAsset = Pair<MediaType, ByteArray>

Raw streamed file alias, used internally for assets.

Link copied to clipboard
typealias StreamedAssetResponse = MutableHttpResponse<StreamedAsset>

Raw streamed file response, used internally for assets with a type attached.

Link copied to clipboard

Describes the expected interface for a streaming response rendered via co-routines.

Link copied to clipboard

Describes the expected interface for a response rendering object which leverages co-routines.

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
suspend fun PageController.asset(request: HttpRequest<*>, type: AssetType? = null, block: suspend AssetHandler.() -> Unit): FinalizedAssetResponse

Generate a StreamedAssetResponse which serves an asset embedded within the application, and specified by the provided block; request will be considered when producing the response.

suspend fun PageController.asset(request: HttpRequest<*>, moduleId: AssetModuleId, type: AssetType? = null): FinalizedAssetResponse

Serve an application asset file which is embedded in the application JAR as a registered server asset, from the application resource path /assets.

Link copied to clipboard
fun css(block: CssBuilder.() -> Unit): FinalizedAssetResponse

Responds to a client with an HTML response, using specified block to build the CSS document via Kotlin's CSS DSL.

Link copied to clipboard
suspend fun PageController.html(block: suspend HTML.() -> Unit): RawResponse

Responds to a client with an HTML response, using specified block to build an HTML page via Kotlin's HTML DSL.

Link copied to clipboard
inline suspend fun <T, C : TagConsumer<T>> C.htmlSuspend(namespace: String? = null, crossinline block: suspend HTML.() -> Unit): T
Link copied to clipboard
suspend fun BODY.injectSSR(handler: ElideController, request: HttpRequest<*>, domId: String = DEFAULT_SSR_DOM_ID, classes: Set<String> = emptySet(), attrs: List<Pair<String, String>> = emptyList(), path: String? = null, embeddedRoot: String? = null)

Evaluate and inject SSR content into a larger HTML page, using a <main> tag as the root element in the dom; apply domId, classes, and any additional attrs to the root element, if specified.

Link copied to clipboard
suspend fun PageController.script(request: HttpRequest<*>, block: AssetHandler.() -> Unit): FinalizedAssetResponse

Serve a static script asset embedded within the application, based on the provided block, which should customize the serving of the script and declare a module ID.

suspend fun PageController.script(request: HttpRequest<*>, moduleId: AssetModuleId): FinalizedAssetResponse

Serve a static script asset embedded within the application, based on the provided moduleId, and customizing the response based on the provided request.

fun BODY.script(asset: AssetReference, defer: Boolean = false, async: Boolean = false, type: String = JAVASCRIPT_TYPE, attrs: Map<String, String>? = null)

Generates a <body> script link from the provided asset, optionally including the specified attrs, etc.

fun BODY.script(uri: String, defer: Boolean = false, async: Boolean = false, type: String = JAVASCRIPT_TYPE, attrs: Map<String, String>? = null)

Generates a <body> script link from the provided handler uri, optionally including the specified attrs.

fun HEAD.script(uri: String, defer: Boolean = false, async: Boolean = false, type: String = JAVASCRIPT_TYPE, attrs: Map<String, String>? = null)

Generates a <head> script link from the provided handler uri, optionally including the specified attrs.

fun HEAD.script(asset: AssetReference, defer: Boolean = false, async: Boolean = false, nomodule: Boolean = false, type: String = JAVASCRIPT_TYPE, attrs: Map<String, String>? = null)

Generates a <head> script link from the provided asset, optionally including the specified attrs, etc.

Link copied to clipboard
suspend fun ssr(request: HttpRequest<*>, path: String = SSR_SCRIPT_DEFAULT, response: MutableHttpResponse<ByteArrayOutputStream> = HttpResponse.ok(), wrap: Boolean = false, block: suspend HTML.() -> Unit): Mono<HttpResponse<Publisher<ByteArray>>>

Load and serve a JavaScript bundle server-side, executing it within the context of an isolated GraalVM JavaScript runtime; then, collect the output and return it as an HTTP response, within the provided HTML builder, which will be used to render the initial page frame.

Link copied to clipboard
fun staticFile(file: String, contentType: String): HttpResponse<*>

Serve a static file which is embedded in the application JAR, at the path /static/[file].

Link copied to clipboard
suspend fun BODY.streamSSR(handler: ElideController, request: HttpRequest<*>, domId: String = DEFAULT_SSR_DOM_ID, classes: Set<String> = emptySet(), attrs: List<Pair<String, String>> = emptyList(), path: String = SSR_SCRIPT_DEFAULT, embeddedRoot: String = EMBEDDED_ROOT)

Stream and inject SSR content into a larger HTML page, using a <main> tag as the root element in the dom; apply domId, classes, and any additional attrs to the root element, if specified.

Link copied to clipboard
suspend fun PageController.stylesheet(request: HttpRequest<*>, block: AssetHandler.() -> Unit): FinalizedAssetResponse

Serve a static stylesheet asset embedded within the application, based on the provided block, which should customize the serving of the document and declare a module ID.

suspend fun PageController.stylesheet(request: HttpRequest<*>, moduleId: AssetModuleId): FinalizedAssetResponse

Serve a static stylesheet asset embedded within the application, based on the provided moduleId, and customizing the response based on the provided request.

fun HEAD.stylesheet(asset: AssetReference, media: String? = null, attrs: SortedMap<String, String>? = null)

Generate a stylesheet link from an embedded server asset, optionally with the provided media declaration.

fun HEAD.stylesheet(uri: String, media: String? = null, attrs: Map<String, String>? = null)

Generates a CSS link from the provided handler uri, optionally including the specified attrs.

Link copied to clipboard
inline suspend fun <T : Tag, R> T.visitAndFinalizeSuspend(consumer: TagConsumer<R>, crossinline block: suspend T.() -> Unit): R