O'Reilly logo

RESTful Web Services with Scala by Jos Dirksen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Extracting request parameters and using futures for asynchronous responses

Now that we've got the basics covered, let's see what we need to do to convert the incoming request parameters and body into our domain model (our case classes). In this section, we'll take the following steps:

  1. Convert the incoming request to a Task case class.
  2. Store the converted Task in our dummy TaskService.
  3. The TaskService object returns a Future[Task]; we will change the Unfiltered configuration to start handling requests asynchronously.

Let's start with the first part and look at the route configuration and how to convert the incoming request to a Task case class. The complete source for this example can be found in the Step2.scala file in the rest-with-scala/chapter-03/src/main/scala/org/restwithscala/chapter3/steps/ ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required