mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 16:28:12 -07:00
Deprecation comments.
This commit is contained in:
parent
4b6d53d3dd
commit
781a2c65c3
2 changed files with 10 additions and 2 deletions
|
@ -44,6 +44,7 @@ interface Api {
|
||||||
@GET("/ping")
|
@GET("/ping")
|
||||||
fun ping() : Call<String>
|
fun ping() : Call<String>
|
||||||
|
|
||||||
|
@Deprecated(message = "Replaced with /v1/getDependencies")
|
||||||
@POST("/v0/getDependencies")
|
@POST("/v0/getDependencies")
|
||||||
fun getDependencies(@Query("buildFile") buildFile: String) : Call<List<DependencyData.GetDependenciesData>>
|
fun getDependencies(@Query("buildFile") buildFile: String) : Call<List<DependencyData.GetDependenciesData>>
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ class SparkServer(val initCallback: (String) -> List<Project>, val cleanUpCallba
|
||||||
override fun run(port: Int) {
|
override fun run(port: Int) {
|
||||||
log.debug("RUNNING")
|
log.debug("RUNNING")
|
||||||
Spark.port(port)
|
Spark.port(port)
|
||||||
Spark.webSocket("/v1/getDependencies", GetDependenciesChatHandler::class.java)
|
Spark.webSocket("/v1/getDependencies", GetDependenciesHandler::class.java)
|
||||||
Spark.get("/ping", { req, res -> """ { "result" : "ok" } """ })
|
Spark.get("/ping", { req, res -> """ { "result" : "ok" } """ })
|
||||||
Spark.get("/quit", { req, res ->
|
Spark.get("/quit", { req, res ->
|
||||||
Executors.newFixedThreadPool(1).let { executor ->
|
Executors.newFixedThreadPool(1).let { executor ->
|
||||||
|
@ -60,6 +60,10 @@ class SparkServer(val initCallback: (String) -> List<Project>, val cleanUpCallba
|
||||||
KobaltServer.OK
|
KobaltServer.OK
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
//
|
||||||
|
// The /v0 endpoints are deprecated and will eventually be removed
|
||||||
|
// (replaced by /v1 which uses WebSockets
|
||||||
jsonRoute("/v0/getDependencies", Route { request, response ->
|
jsonRoute("/v0/getDependencies", Route { request, response ->
|
||||||
val buildFile = request.queryParams("buildFile")
|
val buildFile = request.queryParams("buildFile")
|
||||||
initCallback(buildFile)
|
initCallback(buildFile)
|
||||||
|
@ -89,7 +93,10 @@ class SparkServer(val initCallback: (String) -> List<Project>, val cleanUpCallba
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class GetDependenciesChatHandler : WebSocketListener {
|
/**
|
||||||
|
* Manage the websocket endpoint "/v1/getDependencies".
|
||||||
|
*/
|
||||||
|
class GetDependenciesHandler : WebSocketListener {
|
||||||
// The SparkJava project refused to merge https://github.com/perwendel/spark/pull/383
|
// The SparkJava project refused to merge https://github.com/perwendel/spark/pull/383
|
||||||
// so I have to do dependency injections manually :-(
|
// so I have to do dependency injections manually :-(
|
||||||
val projectFinder = Kobalt.INJECTOR.getInstance(ProjectFinder::class.java)
|
val projectFinder = Kobalt.INJECTOR.getInstance(ProjectFinder::class.java)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue