diff --git a/api-webapp/src/main/kotlin/org/jeudego/pairgoth/store/FileStore.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/store/FileStore.kt index 22fd6a2..1f70fb3 100644 --- a/api-webapp/src/main/kotlin/org/jeudego/pairgoth/store/FileStore.kt +++ b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/store/FileStore.kt @@ -40,7 +40,7 @@ class FileStore(pathStr: String): StoreImplementation { return path.useDirectoryEntries("*.tour") { entries -> entries.mapNotNull { entry -> filenameRegex.matchEntire(entry.fileName.toString())?.groupValues?.get(1)?.toID() - }.toSet() + }.toSortedSet() } } diff --git a/api-webapp/src/main/kotlin/org/jeudego/pairgoth/web/ApiServlet.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/web/ApiServlet.kt index 269fca1..34d2d9b 100644 --- a/api-webapp/src/main/kotlin/org/jeudego/pairgoth/web/ApiServlet.kt +++ b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/web/ApiServlet.kt @@ -170,7 +170,7 @@ class ApiServlet : HttpServlet() { } // check charset - if (charset != null && EXPECTED_CHARSET != charset) throw ApiException( + if (charset != null && EXPECTED_CHARSET != charset.lowercase(Locale.ROOT).replace("-", "")) throw ApiException( HttpServletResponse.SC_BAD_REQUEST, "UTF-8 content expected" ) @@ -215,6 +215,8 @@ class ApiServlet : HttpServlet() { HttpServletResponse.SC_BAD_REQUEST, "Missing 'Accept' header" ) + // CB TODO 1) a reference to a specific API call at this point is a code smell. + // 2) there will e other content types: .tou, .h9, .html if (!isJson(accept) && (!isXml(accept) || !request.requestURI.matches(Regex("/api/tour/\\d+")))) throw ApiException( HttpServletResponse.SC_BAD_REQUEST, "Invalid 'Accept' header" diff --git a/view-webapp/pom.xml b/view-webapp/pom.xml index 5523f07..bfa5175 100644 --- a/view-webapp/pom.xml +++ b/view-webapp/pom.xml @@ -196,34 +196,12 @@ 70.1 --> - - org.apache.httpcomponents - httpclient - 4.5.13 - - - commons-logging - commons-logging - - + com.squareup.okhttp3 + okhttp + 4.8.1 - - org.apache.httpcomponents - httpmime - 4.5.13 - - - commons-io - commons-io - 2.11.0 - - - commons-net - commons-net - 3.8.0 - - --> com.republicate diff --git a/view-webapp/src/main/config/layouts/standard.html b/view-webapp/src/main/config/layouts/standard.html index 9cf65df..f291ed8 100644 --- a/view-webapp/src/main/config/layouts/standard.html +++ b/view-webapp/src/main/config/layouts/standard.html @@ -9,9 +9,13 @@ - -