-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6ddd7ac
commit 1073b5e
Showing
10 changed files
with
66 additions
and
160 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
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
55 changes: 4 additions & 51 deletions
55
src/oracle-tools/src/main/kotlin/org/icpclive/oracle/Application.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
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
4 changes: 2 additions & 2 deletions
4
.../kotlin/org/icpclive/util/JsonSettings.kt → ...otlin/org/icpclive/server/JsonSettings.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
35 changes: 35 additions & 0 deletions
35
src/server-shared/src/main/kotlin/org/icpclive/server/KtorPlugins.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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package org.icpclive.server | ||
|
||
import io.ktor.server.application.* | ||
import io.ktor.server.plugins.autohead.* | ||
import io.ktor.server.plugins.callloging.* | ||
import io.ktor.server.plugins.cors.routing.* | ||
import io.ktor.server.plugins.defaultheaders.* | ||
import io.ktor.server.plugins.statuspages.* | ||
import io.ktor.server.request.* | ||
import io.ktor.server.routing.* | ||
import io.ktor.server.util.* | ||
|
||
fun Application.setupDefaultKtorPlugins() { | ||
install(DefaultHeaders) | ||
install(CallLogging) { | ||
level = org.slf4j.event.Level.INFO | ||
filter { call -> call.request.path().startsWith("/") } | ||
} | ||
install(StatusPages) { | ||
exception<Throwable> { call, ex -> | ||
call.application.environment.log.error("Query ${call.url()} failed with exception", ex) | ||
throw ex | ||
} | ||
} | ||
install(AutoHeadResponse) | ||
install(IgnoreTrailingSlash) | ||
install(CORS) { | ||
allowHeader(io.ktor.http.HttpHeaders.Authorization) | ||
allowHeader(io.ktor.http.HttpHeaders.ContentType) | ||
allowHeader("*") | ||
allowMethod(io.ktor.http.HttpMethod.Delete) | ||
allowSameOrigin = true | ||
anyHost() | ||
} | ||
} |