-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GH-40 Migrate to Javalin 6.0.0-beta.4, release 6.0.0-SNAPSHOT
- Loading branch information
Showing
10 changed files
with
64 additions
and
34 deletions.
There are no files selected for viewing
This file contains 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 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 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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-all.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
This file contains 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 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 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 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 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
18 changes: 14 additions & 4 deletions
18
routing-coroutines/src/main/kotlin/io/javalin/community/routing/coroutines/Coroutines.kt
This file contains 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 |
---|---|---|
@@ -1,27 +1,37 @@ | ||
package io.javalin.community.routing.coroutines | ||
|
||
import io.javalin.community.routing.coroutines.servlet.CoroutinesServlet | ||
import io.javalin.community.routing.invokeAsSamWithReceiver | ||
import io.javalin.community.routing.sortRoutes | ||
import io.javalin.config.JavalinConfig | ||
import io.javalin.http.Handler | ||
import io.javalin.http.HandlerType | ||
import io.javalin.router.Endpoint | ||
import io.javalin.router.InternalRouter | ||
import io.javalin.router.RoutingApiInitializer | ||
import java.util.function.Consumer | ||
import io.javalin.router.RoutingSetupScope | ||
|
||
class Coroutines<ROUTE : SuspendedRoute<CONTEXT, RESPONSE>, CONTEXT, RESPONSE : Any>( | ||
private val servlet: CoroutinesServlet<CONTEXT, RESPONSE>, | ||
) : RoutingApiInitializer<CoroutinesRouting<ROUTE, CONTEXT, RESPONSE>> { | ||
|
||
override fun initialize(cfg: JavalinConfig, internalRouter: InternalRouter, setup: Consumer<CoroutinesRouting<ROUTE, CONTEXT, RESPONSE>>) { | ||
override fun initialize(cfg: JavalinConfig, internalRouter: InternalRouter, setup: RoutingSetupScope<CoroutinesRouting<ROUTE, CONTEXT, RESPONSE>>) { | ||
val coroutinesRouting = CoroutinesRouting<ROUTE, CONTEXT, RESPONSE>() | ||
setup.accept(coroutinesRouting) | ||
setup.invokeAsSamWithReceiver(coroutinesRouting) | ||
|
||
coroutinesRouting | ||
.routes | ||
.sortRoutes() | ||
.map { it to Handler { ctx -> servlet.handle(ctx, it) } } | ||
.forEach { (route, handler) -> internalRouter.addHttpHandler(HandlerType.valueOf(route.method.toString()), route.path, handler) } | ||
.forEach { (route, handler) -> | ||
internalRouter.addHttpEndpoint( | ||
Endpoint( | ||
method = HandlerType.valueOf(route.method.toString()), | ||
path = route.path, | ||
handler = handler | ||
) | ||
) | ||
} | ||
} | ||
|
||
} |
This file contains 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