Skip to content

Commit

Permalink
chore: KTOR-8101 Update engine artifacts (#580)
Browse files Browse the repository at this point in the history
* Update Jetty client artifact

* Update Jetty server artifact

*Update Tomcat server artifact
  • Loading branch information
osipxd authored Jan 29, 2025
1 parent 4feffe0 commit e4005ac
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 22 deletions.
4 changes: 2 additions & 2 deletions codeSnippets/snippets/_misc_client/JettyConfig.kt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import io.ktor.client.*
import io.ktor.client.engine.jetty.*
import io.ktor.client.engine.jetty.jakarta.*
import org.eclipse.jetty.util.ssl.SslContextFactory

val client = HttpClient(Jetty) {
engine {
// this: [[[JettyEngineConfig|https://api.ktor.io/ktor-client/ktor-client-jetty/io.ktor.client.engine.jetty/-jetty-engine-config/index.html]]]
// this: [[[JettyEngineConfig|https://api.ktor.io/ktor-client/ktor-client-jetty-jakarta/io.ktor.client.engine.jetty.jakarta/-jetty-engine-config/index.html]]]
sslContextFactory = SslContextFactory.Client()
clientCacheSize = 12
}
Expand Down
2 changes: 1 addition & 1 deletion codeSnippets/snippets/_misc_client/JettyCreate.kt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import io.ktor.client.*
import io.ktor.client.engine.jetty.*
import io.ktor.client.engine.jetty.jakarta.*

val client = HttpClient(Jetty)
2 changes: 1 addition & 1 deletion codeSnippets/snippets/client-ssl-config/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ dependencies {
implementation("io.ktor:ktor-client-core:$ktor_version")
implementation("io.ktor:ktor-client-apache5:$ktor_version")
implementation("io.ktor:ktor-client-java:$ktor_version")
implementation("io.ktor:ktor-client-jetty:$ktor_version")
implementation("io.ktor:ktor-client-jetty-jakarta:$ktor_version")
implementation("org.eclipse.jetty:jetty-alpn-java-client:11.0.20")
implementation("io.ktor:ktor-client-cio:$ktor_version")
implementation("io.ktor:ktor-client-android:$ktor_version")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import io.ktor.client.engine.android.*
import io.ktor.client.engine.apache5.*
import io.ktor.client.engine.cio.*
import io.ktor.client.engine.java.*
import io.ktor.client.engine.jetty.*
import io.ktor.client.engine.jetty.jakarta.*
import io.ktor.client.engine.okhttp.*
import io.ktor.client.request.*
import io.ktor.client.statement.*
Expand Down
4 changes: 2 additions & 2 deletions codeSnippets/snippets/http2-jetty/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
}

application {
mainClass.set("io.ktor.server.jetty.EngineMain")
mainClass.set("io.ktor.server.jetty.jakarta.EngineMain")
}

repositories {
Expand All @@ -19,7 +19,7 @@ repositories {
dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version")
implementation("io.ktor:ktor-server-core:$ktor_version")
implementation("io.ktor:ktor-server-jetty:$ktor_version")
implementation("io.ktor:ktor-server-jetty-jakarta:$ktor_version")
implementation("io.ktor:ktor-server-html-builder:$ktor_version")
implementation("ch.qos.logback:logback-classic:$logback_version")
}
10 changes: 5 additions & 5 deletions topics/client-engines.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Client engines targeting JVM or both JVM and Android support the following Andro
|---------|-------------------|--------------|
| Apache | | 8+ |
| Java | | 11+ |
| Jetty | | 8+ |
| Jetty | | 11+ |
| CIO | 7.0+ <sup>*</sup> | 8+ |
| Android | 1.x+ | 8+ |
| OkHttp | 5.0+ | 8+ |
Expand Down Expand Up @@ -176,15 +176,15 @@ The `Java` engine uses the [Java HTTP Client](https://openjdk.java.net/groups/ne

### Jetty {id="jetty"}
The `Jetty` engine supports only HTTP/2 and can be configured in the following way:
1. Add the `ktor-client-jetty` dependency:
1. Add the `ktor-client-jetty-jakarta` dependency:

<var name="artifact_name" value="ktor-client-jetty"/>
<var name="artifact_name" value="ktor-client-jetty-jakarta"/>
<include from="lib.topic" element-id="add_ktor_artifact"/>
2. Pass the [Jetty](https://api.ktor.io/ktor-client/ktor-client-jetty/io.ktor.client.engine.jetty/-jetty/index.html) class as an argument to the `HttpClient` constructor:
2. Pass the [Jetty](https://api.ktor.io/ktor-client/ktor-client-jetty-jakarta/io.ktor.client.engine.jetty.jakarta/-jetty/index.html) class as an argument to the `HttpClient` constructor:
```kotlin
```
{src="snippets/_misc_client/JettyCreate.kt"}
3. To configure an engine, pass settings exposed by [JettyEngineConfig](https://api.ktor.io/ktor-client/ktor-client-jetty/io.ktor.client.engine.jetty/-jetty-engine-config/index.html) to the `engine` method:
3. To configure an engine, pass settings exposed by [JettyEngineConfig](https://api.ktor.io/ktor-client/ktor-client-jetty-jakarta/io.ktor.client.engine.jetty.jakarta/-jetty-engine-config/index.html) to the `engine` method:
```kotlin
```
{src="snippets/_misc_client/JettyConfig.kt" interpolate-variables="true" disable-links="false"}
Expand Down
12 changes: 6 additions & 6 deletions topics/server-configuration-code.topic
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,13 @@
<chapter title="Jetty" id="jetty-code">
<p>
Jetty-specific options are exposed by the
<a href="https://api.ktor.io/ktor-server/ktor-server-jetty/io.ktor.server.jetty/-jetty-application-engine-base/-configuration/index.html">
<a href="https://api.ktor.io/ktor-server/ktor-server-jetty-jakarta/io.ktor.server.jetty.jakarta/-jetty-application-engine-base/-configuration/index.html">
JettyApplicationEngineBase.Configuration
</a>
class.
</p>
<p>You can configure the Jetty server inside the
<a href="https://api.ktor.io/ktor-server/ktor-server-jetty/io.ktor.server.jetty/-jetty-application-engine-base/-configuration/configure-server.html">
<a href="https://api.ktor.io/ktor-server/ktor-server-jetty-jakarta/io.ktor.server.jetty.jakarta/-jetty-application-engine-base/-configuration/configure-server.html">
configureServer
</a>
block, which provides access to a
Expand All @@ -127,7 +127,7 @@
</p>
<code-block lang="kotlin"><![CDATA[
import io.ktor.server.engine.*
import io.ktor.server.jetty.*
import io.ktor.server.jetty.jakarta.*
fun main() {
embeddedServer(Jetty, configure = {
Expand Down Expand Up @@ -163,16 +163,16 @@
</chapter>
<chapter title="Tomcat" id="tomcat-code">
<p>If you use Tomcat as the engine, you can configure it using the
<a href="https://api.ktor.io/ktor-server/ktor-server-tomcat/io.ktor.server.tomcat/-tomcat-application-engine/-configuration/configure-tomcat.html">
<a href="https://api.ktor.io/ktor-server/ktor-server-tomcat-jakarta/io.ktor.server.tomcat.jakarta/-tomcat-application-engine/-configuration/configure-tomcat.html">
configureTomcat
</a>
property, which provides access to a
<a href="https://tomcat.apache.org/tomcat-9.0-doc/api/org/apache/catalina/startup/Tomcat.html">Tomcat</a>
<a href="https://tomcat.apache.org/tomcat-10.1-doc/api/org/apache/catalina/startup/Tomcat.html">Tomcat</a>
instance.
</p>
<code-block lang="kotlin"><![CDATA[
import io.ktor.server.engine.*
import io.ktor.server.tomcat.*
import io.ktor.server.tomcat.jakarta.*
fun main() {
embeddedServer(Tomcat, configure = {
Expand Down
8 changes: 4 additions & 4 deletions topics/server-engines.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ Before using the desired engine, you need to add the corresponding dependency to
your [build script](server-dependencies.topic):

* `ktor-server-netty`
* `ktor-server-jetty`
* `ktor-server-tomcat`
* `ktor-server-jetty-jakarta`
* `ktor-server-tomcat-jakarta`
* `ktor-server-cio`

Below are examples of adding a dependency for Netty:
Expand Down Expand Up @@ -62,8 +62,8 @@ server with the Netty engine and listen on the `8080` port:
`EngineMain` represents an engine for running a server. You can use the following engines:

* `io.ktor.server.netty.EngineMain`
* `io.ktor.server.jetty.EngineMain`
* `io.ktor.server.tomcat.EngineMain`
* `io.ktor.server.jetty.jakarta.EngineMain`
* `io.ktor.server.tomcat.jakarta.EngineMain`
* `io.ktor.server.cio.EngineMain`

The `EngineMain.main` function is used to start a server with the selected engine and loads
Expand Down

0 comments on commit e4005ac

Please sign in to comment.