# HG changeset patch # User Tomas Zeman # Date 1606220149 -3600 # Node ID 2d14f02ba3bd62b26e94c7d78a947bbaf008cdce # Parent 5c4364d6e726471cbc302294d0805ffecef2670b SQWL#2014 Server platform (component) upgrade diff -r 5c4364d6e726 -r 2d14f02ba3bd base/src/sqwl/cms/Server.scala --- 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 + * + * 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() diff -r 5c4364d6e726 -r 2d14f02ba3bd base/src/sqwl/cms/Service.scala --- a/base/src/sqwl/cms/Service.scala Tue Nov 24 11:17:26 2020 +0100 +++ b/base/src/sqwl/cms/Service.scala Tue Nov 24 13:15:49 2020 +0100 @@ -1,12 +1,26 @@ +/* + * Copyright 2018-2020 Tomas Zeman + * + * 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.stream.Materializer + +import akka.actor.typed.ActorSystem import scala.concurrent.ExecutionContextExecutor -trait Service { - implicit val system: ActorSystem +trait Service[T] { + implicit val system: ActorSystem[T] implicit def executor: ExecutionContextExecutor - implicit val materializer: Materializer } diff -r 5c4364d6e726 -r 2d14f02ba3bd build.sc --- a/build.sc Tue Nov 24 11:17:26 2020 +0100 +++ b/build.sc Tue Nov 24 13:15:49 2020 +0100 @@ -79,16 +79,16 @@ override def ivyDeps = Agg( ivy"com.wacai::config-annotation:0.3.6", + ivy"com.typesafe.akka::akka-actor-typed:$akkaVer", ivy"com.typesafe.akka::akka-http:$akkaHttp", ivy"com.typesafe.akka::akka-slf4j:$akkaVer", ivy"com.typesafe.akka::akka-stream:$akkaVer", - ivy"org.json4s::json4s-native:3.6.2", ivy"ch.qos.logback:logback-classic:1.2.3", - ivy"com.lihaoyi::scalatags:0.6.7", + ivy"com.lihaoyi::scalatags:0.9.2", ivy"org.webjars:bootstrap:$bootstrap", ivy"org.webjars:font-awesome:$fontAwesome", ivy"org.webjars:jquery:$jquery", - ivy"com.lihaoyi::scalatex-api:0.3.12" + ivy"org.openmole::scalatex-api:0.4.6" ) override def scalacOptions = T{super.scalacOptions.map(_ :+