gaetan
03/02/2018, 11:32 AM/path
to ‘/path/’ because the HTML returned by ‘/path/’ has some relative paths for images, css, …
But when I declare theses 2 paths in routing
, ktor seems to make no difference between them.orangy
gaetan
03/02/2018, 11:38 AMorangy
gaetan
03/02/2018, 11:51 AM/path
and /path/
should be considered as distinct.gaetan
03/02/2018, 11:54 AMit.isNotEmpty()
removes the last empty segments that appears in case of trailing slash.orangy
orangy
routing {
route("foo") {
route("bar") {
// what here to make a distinction?
}
}
}
gaetan
03/02/2018, 11:58 AMgaetan
03/02/2018, 12:00 PMorangy
orangy
if (!call.request.path().endsWith('/')) return@get call.respondRedirect("…")
gaetan
03/02/2018, 12:11 PMgaetan
03/02/2018, 12:13 PMrouting {
get("/") { call.respond(call.resolveResource("index.html")!!) }
get("/federerInData") { call.respondRedirect("/federerInData/", permanent = true) }
get("/federerInData/") { call.respond(call.resolveResource("/federerInData/index.html")!!) }
orangy
federerInData
, use one (either) and put that code at topgaetan
03/02/2018, 12:31 PM