Debug standalone mode, plus various bugfixes

This commit is contained in:
Claude Brisson
2023-12-25 14:46:55 +01:00
parent e33bc995c6
commit 58c6c7fcf9
7 changed files with 46 additions and 18 deletions

View File

@@ -108,7 +108,9 @@
<directory>${project.build.directory}/generated-resources/css</directory>
<targetPath>css</targetPath>
<includes>
<include>index.css</include>
<include>main.css</include>
<include>tour.css</include>
</includes>
</resource>
</webResources>

View File

@@ -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()

View File

@@ -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")
}
}
}

View File

@@ -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)