--- a/base/src/sqwl/cms/Server.scala Tue Nov 24 11:17:26 2020 +0100
+++ b/base/src/sqwl/cms/Server.scala Tue Nov 24 13:15:49 2020 +0100
@@ -1,20 +1,37 @@
+/*
+ * Copyright 2018-2020 Tomas Zeman <tomas@functionals.cz>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package sqwl.cms
-import akka.actor.ActorSystem
+import akka.actor.typed.ActorSystem
+import akka.actor.typed.scaladsl.Behaviors
import akka.http.scaladsl.Http
import akka.http.scaladsl.model.headers.ETag
import akka.http.scaladsl.model.{ContentTypes, HttpEntity, HttpHeader, HttpResponse}
import akka.http.scaladsl.server.Directives._
-import akka.stream.{ActorMaterializer, Materializer}
import scala.collection.immutable
import scala.concurrent.ExecutionContextExecutor
import scala.io.StdIn
-trait Server extends App with Service with config with UrlScheme {
- override implicit val system: ActorSystem = ActorSystem()
- override implicit val executor: ExecutionContextExecutor = system.dispatcher
- override implicit val materializer: Materializer = ActorMaterializer()
+trait Server extends App with Service[Nothing] with config with UrlScheme {
+
+ override implicit val system: ActorSystem[Nothing] =
+ ActorSystem(Behaviors.empty, "Server")
+ override implicit val executor: ExecutionContextExecutor =
+ system.executionContext
protected def content: iContent
@@ -54,7 +71,7 @@
}
}
- Http().bindAndHandle(routes, http.interface, http.port)
+ Http().newServerAt(http.interface, http.port).bind(routes)
if (run.mode == "devel") {
system.log.info("Click `Enter` to close application...")
StdIn.readLine()