spray/spray — pull request #391 by andrebeat (2013-07-23 23:20:56+00:00)
Title: Change `detachTo` to execute the route in a future rather than an actor

This fixes issue #240.

I've removed the previous detachTo directive so this breaks the API. The file directives that use `detachTo` now take an implicit `ExecutionContext`. I wasn't able to remove the `ActorRefFactory` since it is needed for stream marshalling and also to get the class loader of the actor system, when loading from resources.

I considered renaming the directive to `detach` since the `ExecutionContext` is implicit. Unfortunately, in the most common use case it is necessary to explicitly pass in the `ExecutionContext`.

```scala
implicit val executionContext = ...

get {
detachTo { // doesn't compile
...
}
}

get {
detachTo(executionContext) {
...
}
}

(get & detachTo) {
...
}
```

Also, the commit messages do not follow the guidelines, but I'll squash the commits after someone reviews this.