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

 ##########
 File path: common/scala/src/main/scala/whisk/http/BasicHttpService.scala
 ##########
 @@ -86,39 +86,47 @@ trait BasicHttpService extends HttpService with 
TransactionCounter {
      */
     def loglevelForRoute(route: String): Logging.LogLevel = Logging.InfoLevel
 
+    /** Rejection handler to terminate connection on a bad request. Delegates 
to Akka handler. */
+    val prioritizeRejections = recoverRejections { rejections =>
+        val priorityRejection = rejections.find {
+            case rejection: UnacceptedResponseContentTypeRejection => true
+            case _ => false
+        }
+
+        priorityRejection.map(rejection => 
Rejected(Seq(rejection))).getOrElse(Rejected(rejections))
+    }
+
     /**
      * Receives a message and runs the router.
      */
-    def receive = runRoute(
+    def route: Route = {
         assignId { implicit transid =>
-            DebuggingDirectives.logRequest(logRequestInfo _) {
-                DebuggingDirectives.logRequestResponse(logResponseInfo _) {
-                    routes
+            handleRejections(customRejectionHandler) {
 
 Review comment:
   @dubee why did the directive order change?
 
----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to