diff --git a/api-webapp/src/main/kotlin/org/jeudego/pairgoth/model/Pairing.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/model/Pairing.kt
index 2a1452e..0cf8fbe 100644
--- a/api-webapp/src/main/kotlin/org/jeudego/pairgoth/model/Pairing.kt
+++ b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/model/Pairing.kt
@@ -190,7 +190,7 @@ class MacMahon(
)
),
placementParams: PlacementParams = PlacementParams(
- Criterion.NBW, Criterion.SOSW, Criterion.SOSOSW
+ Criterion.MMS, Criterion.SOSM, Criterion.SOSOSM
),
var mmFloor: Int = -20, // 20k
var mmBar: Int = 0 // 1D
diff --git a/view-webapp/pom.xml b/view-webapp/pom.xml
index ba1edbd..ecb2550 100644
--- a/view-webapp/pom.xml
+++ b/view-webapp/pom.xml
@@ -108,7 +108,9 @@
${project.build.directory}/generated-resources/css
css
+ index.css
main.css
+ tour.css
diff --git a/view-webapp/src/main/kotlin/org/jeudego/pairgoth/view/ApiTool.kt b/view-webapp/src/main/kotlin/org/jeudego/pairgoth/view/ApiTool.kt
index c73c23d..913e483 100644
--- a/view-webapp/src/main/kotlin/org/jeudego/pairgoth/view/ApiTool.kt
+++ b/view-webapp/src/main/kotlin/org/jeudego/pairgoth/view/ApiTool.kt
@@ -6,14 +6,17 @@ import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.RequestBody.Companion.toRequestBody
import okhttp3.internal.EMPTY_REQUEST
+import org.jeudego.pairgoth.web.WebappManager
import org.slf4j.LoggerFactory
class ApiTool {
companion object {
const val JSON = "application/json"
const val XML = "application/xml"
- val apiRoot = System.getProperty("pairgoth.api.external.url")?.let { "${it.removeSuffix("/")}/" }
- ?: throw Error("no configured API url")
+ val apiRoot by lazy {
+ WebappManager.getProperty("api.external.url")?.let { "${it.removeSuffix("/")}/" }
+ ?: throw Error("no configured API url")
+ }
val logger = LoggerFactory.getLogger("api")
}
private val client = OkHttpClient()
diff --git a/view-webapp/src/main/kotlin/org/jeudego/pairgoth/web/ApiServlet.kt b/view-webapp/src/main/kotlin/org/jeudego/pairgoth/web/ApiServlet.kt
index c1a5877..b4159b6 100644
--- a/view-webapp/src/main/kotlin/org/jeudego/pairgoth/web/ApiServlet.kt
+++ b/view-webapp/src/main/kotlin/org/jeudego/pairgoth/web/ApiServlet.kt
@@ -19,7 +19,9 @@ class ApiServlet : AsyncProxyServlet() {
}
companion object {
- private val apiRoot = System.getProperty("pairgoth.api.external.url")?.let { "${it.removeSuffix("/")}" }
- ?: throw Error("no configured API url")
+ private val apiRoot by lazy {
+ WebappManager.getProperty("api.external.url")?.let { "${it.removeSuffix("/")}" }
+ ?: throw Error("no configured API url")
+ }
}
}
diff --git a/view-webapp/src/main/kotlin/org/jeudego/pairgoth/web/ImportServlet.kt b/view-webapp/src/main/kotlin/org/jeudego/pairgoth/web/ImportServlet.kt
index 1a23e27..59a9b01 100644
--- a/view-webapp/src/main/kotlin/org/jeudego/pairgoth/web/ImportServlet.kt
+++ b/view-webapp/src/main/kotlin/org/jeudego/pairgoth/web/ImportServlet.kt
@@ -9,7 +9,7 @@ import javax.servlet.http.HttpServletResponse
class ImportServlet: HttpServlet() {
- private val api = ApiTool()
+ private val api by lazy { ApiTool() }
override fun doPost(req: HttpServletRequest, resp: HttpServletResponse) {
val uploads = Upload.handleFileUpload(req)
diff --git a/webserver/src/main/kotlin/org/jeudego/pairgoth/application/Pairgoth.kt b/webserver/src/main/kotlin/org/jeudego/pairgoth/application/Pairgoth.kt
index 6a7fb4d..9ceda35 100644
--- a/webserver/src/main/kotlin/org/jeudego/pairgoth/application/Pairgoth.kt
+++ b/webserver/src/main/kotlin/org/jeudego/pairgoth/application/Pairgoth.kt
@@ -32,7 +32,6 @@ import java.util.*
import java.util.jar.JarFile
import java.util.regex.Pattern
-
fun main(vararg args: String) {
try {
// register a shutdown hook for any global necessary cleanup
@@ -67,13 +66,13 @@ private fun readProperties() {
val properties = File("./pairgoth.properties")
if (properties.exists()) {
serverProps.load(FileReader(properties))
- serverProps.entries.forEach { entry ->
- val property = entry.key as String
- val value = entry.value as String
- if (!property.startsWith("webapp.ssl.")) {
- // do not propagate ssl properties further
- System.setProperty("pairgoth.$property", value)
- }
+ }
+ serverProps.entries.forEach { entry ->
+ val property = entry.key as String
+ val value = entry.value as String
+ if (!property.startsWith("webapp.ssl.")) {
+ // do not propagate ssl properties further
+ System.setProperty("pairgoth.$property", value)
}
}
// we want colorized output on linux
@@ -118,7 +117,7 @@ private fun launchServer() {
// create webapps contexts
val webAppContexts = mutableListOf()
val mode = serverProps["mode"] ?: "standalone"
- if (mode == "server" || mode == "standalone") webAppContexts.add(createContext("api", "/api"))
+ if (mode == "server" || mode == "standalone") webAppContexts.add(createContext("api", "/api/tour"))
if (mode == "client" || mode == "standalone") webAppContexts.add(createContext("view", "/"))
// special handling for logger properties
@@ -132,7 +131,12 @@ private fun launchServer() {
}
}
- val webappUrl = serverProps.getProperty("webapp.url")?.let { URL(it) } ?: throw Error("missing property webapp.url")
+ val webappUrl = URL(
+ serverProps.getProperty("webapp.protocol") ?: throw Error("missing property webapp.protocol"),
+ serverProps.getProperty("webapp.protocol") ?: throw Error("missing property webapp.protocol"),
+ serverProps.getProperty("webapp.port")?.toInt() ?: 80,
+ "/"
+ )
val secure = webappUrl.protocol == "https"
// create server
@@ -156,6 +160,9 @@ private fun launchServer() {
private fun createContext(webapp: String, contextPath: String) = WebAppContext().also { context ->
context.war = "$tmp/pairgoth/webapps/$webapp-webapp-$version.war"
context.contextPath = contextPath
+ if (webapp == "api") {
+ context.allowNullPathInfo = true
+ }
}
private fun buildSecureConnector(server: Server, port: Int): ServerConnector {
diff --git a/webserver/src/main/resources/server.default.properties b/webserver/src/main/resources/server.default.properties
index 3357646..eae3474 100644
--- a/webserver/src/main/resources/server.default.properties
+++ b/webserver/src/main/resources/server.default.properties
@@ -1,5 +1,19 @@
-webapp.url = https://localhost:8443
+mode = standalone
+env = prod
+# webapp connector
+webapp.protocol = http
+webapp.interface = localhost
+webapp.port = 8080
+webapp.context = /
+webapp.external.url = http://localhost:8080
+
+# api connector
+api.protocol = http
+api.interface = localhost
+api.port = 8080
+api.context = /api/tour
+api.external.url = http://localhost:8080/api/
+
webapp.ssl.key = jar:file:$jar!/ssl/localhost.key
webapp.ssl.pass =
webapp.ssl.cert = jar:file:$jar!/ssl/localhost.crt
-mode = standalone