markusthoemmes commented on a change in pull request #2218: Port Controller 
from Spray to Akka
URL: 
https://github.com/apache/incubator-openwhisk/pull/2218#discussion_r127593525
 
 

 ##########
 File path: common/scala/src/main/scala/whisk/http/BasicHttpService.scala
 ##########
 @@ -19,56 +19,57 @@ package whisk.http
 
 import scala.concurrent.duration.DurationInt
 import scala.language.postfixOps
+import scala.collection.immutable.Seq
+import scala.concurrent.ExecutionContext
+import scala.concurrent.Future
 
 import akka.actor.Actor
-import akka.actor.ActorContext
 import akka.actor.ActorSystem
 import akka.actor.Props
 import akka.event.Logging
-import akka.io.IO
 import akka.japi.Creator
-import akka.pattern.ask
 import akka.util.Timeout
-import spray.can.Http
-import spray.http.ContentType
-import spray.http.HttpEntity
-import spray.http.HttpRequest
-import spray.http.HttpResponse
-import spray.http.MediaTypes.`text/plain`
-import spray.httpx.SprayJsonSupport.sprayJsonMarshaller
-import spray.httpx.marshalling
-import spray.httpx.marshalling.ToResponseMarshallable.isMarshallable
-import spray.routing.AuthenticationFailedRejection
-import spray.routing.Directive.pimpApply
-import spray.routing.Directives
-import spray.routing.HttpService
-import spray.routing.RejectionHandler
-import spray.routing.Route
-import spray.routing.directives.DebuggingDirectives
-import spray.routing.directives.LogEntry
-import spray.routing.directives.LoggingMagnet.forMessageFromFullShow
+import akka.http.scaladsl.server.Directives
+import akka.http.scaladsl.server.directives.DebuggingDirectives
+import akka.http.scaladsl.server.directives.LogEntry
+import akka.http.scaladsl.server.Route
+import akka.http.scaladsl.model.HttpRequest
+import akka.http.scaladsl.model._
+import akka.http.scaladsl.server.RejectionHandler
+import akka.http.scaladsl.server.UnacceptedResponseContentTypeRejection
+import akka.http.scaladsl.server.RouteResult.Rejected
+import akka.http.scaladsl.Http
+
+import spray.json._
+
 import whisk.common.LogMarker
 import whisk.common.LogMarkerToken
 import whisk.common.Logging
 import whisk.common.LoggingMarkers
 import whisk.common.TransactionCounter
 import whisk.common.TransactionId
+import akka.stream.ActorMaterializer
 
 /**
- * This trait extends the spray HttpService trait with logging and transaction 
counting
+ * This trait extends the Akka Directives and Actor with logging and 
transaction counting
  * facilities common to all OpenWhisk REST services.
  */
-trait BasicHttpService extends HttpService with TransactionCounter {
-
-    /**
-     * Gets the actor context.
-     */
-    implicit def actorRefFactory: ActorContext
-
-    /**
-     * Gets the logging
-     */
+trait BasicHttpService extends Directives with Actor with TransactionCounter {
     implicit def logging: Logging
+    implicit val materializer = ActorMaterializer()
+    implicit val actorSystem = context.system
+    implicit val executionContext: ExecutionContext
 
 Review comment:
   Same as the other comment: you can just go for `implicit val 
executionContext = actorSystem.dispatcher`
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to