-
Couldn't load subscription status.
- Fork 344
Merge 3.2.0 release documentation #650
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
862c75e
docs: KTOR-8533 Add docs for SaveBodyPlugin deprecation (#632)
vnikolova 096886c
What's new in Ktor 3.2.0: network and gradle
ElviraMustafina 1c4f9ae
KTOR-8469 Add documentation about wrapWithContent and wrap deprecatio…
daniCsorbaJB 53c070a
Merge branch '3.2.0' into KTOR-8542-access-resolved-ip-address
ElviraMustafina 6b6b392
docs: KTOR-8533 Add docs for SaveBodyPlugin deprecation (#632)
vnikolova 2451f74
KTOR-8469 Add documentation about wrapWithContent and wrap deprecatio…
daniCsorbaJB 88780f0
chore: bump Ktor version to 3.2.0 and add release details (#638)
vnikolova 59b9652
review
ElviraMustafina 57eecb1
Merge branch '3.2.0' into KTOR-8542-access-resolved-ip-address
ElviraMustafina 0665f65
KTOR-8530 Add documentation for version catalog support (#633)
vnikolova b45ac7e
twr review
ElviraMustafina 26d20e3
Merge branch '3.2.0' into KTOR-8542-access-resolved-ip-address
ElviraMustafina 3e43566
two options for running with Gradle
ElviraMustafina fedc041
What's new in Ktor 3.2.0: network and Gradle
ElviraMustafina ae8cedb
chore: rename what's new file and add a release date
vnikolova 4ad71b7
feat: coroutine support for modules
danil-pavlov 55d5268
fix: review suggestions
danil-pavlov 8bece35
KTOR-8405 Add typed configuration in the "What's new" doc (#640)
vnikolova 8990f5f
docs: KTOR-8545 make testApplication client mutable
sarahhaggarty 8378c3d
KTOR-8197 Add documentation for HTMX support (#639)
vnikolova 8483484
fix: review suggestions
danil-pavlov 010b6ac
Merge pull request #642 from ktorio/application-modules
danil-pavlov c60cc87
Merge remote-tracking branch 'origin/main' into 3.2.0
vnikolova dec3083
update: KTOR-8509 Document the Unix domain socket functionality in ma…
zamulla aded430
Add documentation for DI (#643)
vnikolova 68f0365
Fix headings and DI code examples
vnikolova 32827a6
KTOR-8582 Add Gradle properties overview for concurrent module loading
vnikolova File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| # HTMX integration | ||
|
|
||
| A sample Ktor project demonstrating how to integrate HTMX using the HTML DSL and HTMX-aware server-side routing. | ||
|
|
||
| > This sample is a part of the [codeSnippets](../../README.md) Gradle project. | ||
|
|
||
| ## Running | ||
|
|
||
| To run this sample, execute the following command in a repository's root directory: | ||
|
|
||
| ```bash | ||
| ./gradlew :htmx-integration:run | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
|
|
||
| val kotlin_version: String by project | ||
| val logback_version: String by project | ||
|
|
||
| plugins { | ||
| kotlin("jvm") | ||
| id("io.ktor.plugin") version "3.2.0" | ||
| } | ||
|
|
||
| group = "com.example" | ||
| version = "0.0.1" | ||
|
|
||
| application { | ||
| mainClass = "io.ktor.server.netty.EngineMain" | ||
| } | ||
|
|
||
| repositories { | ||
| mavenCentral() | ||
| } | ||
|
|
||
| dependencies { | ||
| implementation("io.ktor:ktor-server-core-jvm") | ||
| implementation("io.ktor:ktor-server-netty") | ||
| implementation("ch.qos.logback:logback-classic:$logback_version") | ||
| implementation("io.ktor:ktor-server-core") | ||
| implementation("io.ktor:ktor-server-htmx") | ||
| implementation("io.ktor:ktor-htmx") | ||
| implementation("io.ktor:ktor-htmx-html") | ||
| implementation("io.ktor:ktor-server-html-builder") | ||
| implementation("io.ktor:ktor-server-config-yaml") | ||
| testImplementation("io.ktor:ktor-server-test-host") | ||
| testImplementation("org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version") | ||
| } |
11 changes: 11 additions & 0 deletions
11
codeSnippets/snippets/htmx-integration/src/main/kotlin/Application.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| package com.example | ||
|
|
||
| import io.ktor.server.application.* | ||
|
|
||
| fun main(args: Array<String>) { | ||
| io.ktor.server.netty.EngineMain.main(args) | ||
| } | ||
|
|
||
| fun Application.module() { | ||
| configureHtmx() | ||
| } |
83 changes: 83 additions & 0 deletions
83
codeSnippets/snippets/htmx-integration/src/main/kotlin/Routing.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| package com.example | ||
|
|
||
| import io.ktor.htmx.HxSwap | ||
| import io.ktor.htmx.html.hx | ||
| import io.ktor.server.application.* | ||
| import io.ktor.server.html.respondHtml | ||
| import io.ktor.server.htmx.hx | ||
| import io.ktor.server.response.* | ||
| import io.ktor.server.routing.* | ||
| import io.ktor.utils.io.ExperimentalKtorApi | ||
| import kotlinx.html.* | ||
|
|
||
| fun Application.configureRouting() { | ||
| routing { | ||
| get("/") { | ||
| call.respondText("Hello World!") | ||
| } | ||
| } | ||
| } | ||
|
|
||
| @OptIn(ExperimentalKtorApi::class) | ||
| fun Application.configureHtmx() { | ||
| routing { | ||
| get("/") { | ||
| call.respondHtml { | ||
| head { | ||
| // Include HTMX library | ||
| script(src = "https://unpkg.com/[email protected]") {} | ||
| } | ||
| body { | ||
| div { | ||
| id = "content" | ||
| h1 { +"HTMX Demo" } | ||
|
|
||
| button { | ||
| id = "load-button" | ||
| attributes.hx { | ||
| get = "/data" | ||
| target = "#result" | ||
| swap = HxSwap.innerHtml | ||
| trigger = "click" | ||
| } | ||
| +"Load Data" | ||
| } | ||
|
|
||
| div { | ||
| id = "result" | ||
| +"Data will appear here" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| route("data") { | ||
| // Regular request | ||
| get { | ||
| call.respondText("Please use HTMX to load this data") | ||
| } | ||
|
|
||
| // Any HTMX request | ||
| hx.get { | ||
| call.respondText("<p>Data loaded via HTMX!</p>") | ||
| } | ||
|
|
||
| // HTMX request with specific target | ||
| hx { | ||
| target("#result") { | ||
| get { | ||
| call.respondText("<p>Data specifically for #result element</p>") | ||
| } | ||
| } | ||
|
|
||
| // HTMX request with specific trigger | ||
| trigger("#load-button") { | ||
| get { | ||
| call.respondText("<p>Data loaded by #load-button</p>") | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
6 changes: 6 additions & 0 deletions
6
codeSnippets/snippets/htmx-integration/src/main/resources/application.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| ktor: | ||
| application: | ||
| modules: | ||
| - com.example.ApplicationKt.module | ||
| deployment: | ||
| port: 8080 |
12 changes: 12 additions & 0 deletions
12
codeSnippets/snippets/htmx-integration/src/main/resources/logback.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| <configuration> | ||
| <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> | ||
| <encoder> | ||
| <pattern>%d{YYYY-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern> | ||
| </encoder> | ||
| </appender> | ||
| <root level="INFO"> | ||
| <appender-ref ref="STDOUT"/> | ||
| </root> | ||
| <logger name="org.eclipse.jetty" level="INFO"/> | ||
| <logger name="io.netty" level="INFO"/> | ||
| </configuration> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Consider pinning HTMX version for consistency.
The HTMX library is loaded from a CDN with a specific version (1.9.10). Consider verifying this is the intended version for the sample.
🌐 Web query:
💡 Result:
The latest stable version of HTMX is 2.0.4, released on December 13, 2024. (github.com) This release introduced several improvements and bug fixes. For a comprehensive list of changes, you can refer to the HTMX changelog.
Citations:
Update HTMX version to the latest stable release
The snippet currently pins HTMX at 1.9.10, but the latest stable version is 2.0.4 (released December 13, 2024). Updating to 2.0.4 ensures you pick up the newest features and bug fixes.
• File:
codeSnippets/snippets/htmx-integration/src/main/kotlin/Routing.ktLine: 28
Suggested change:
📝 Committable suggestion
🤖 Prompt for AI Agents