- No more global registration
- In most cases registration isn't necessary at all
- Creation of custom HttpMethod and StatusCode is possible through
a configuration setting in ParserSettings
Fixes#15635.
The introduction of BodyParts again showed that not all entity types are
useful for every kind of context. There are now these contexts where
HttpEntities are used:
- requests
- responses
- body parts
And several kinds of entities:
- Strict
- Default
- Chunked
- CloseDelimited
- IndefiniteLength
To increase type safety of the API marker-interfaces are introduced defining
which kinds of entities can be used in which contexts:
- RequestEntity: Strict, Default, Chunked
- ResponseEntity: Strict, Default, Chunked, CloseDelimited
- BodyPartEntity: Strict, Default, IndefiniteLength
Also, to be able still to provide abstractions over some kinds of entities
additional auxiliary interfaces were necessary:
- MessageEntity = RequestEntity >: ResponseEntity: Strict, Default, Chunked (type alias for RequestEntity)
- UniversalEntity = RequestEntity with ResponseEntity with BodyPartEntity = Strict, Default
This makes the `Content-Length` and `Content-Type` types visible - but not
constructible - outside of Akka HTTP. The change partially reverts #15800.
the http package. The types need to be visible so that Play can access
all parsed headers. However they types are not constructible outside Akka
HTTP because it is not desirable for users to create these headers. Users
should set the Content-Length and Content-Type via the members of the
HttpEntity objects.
Includes integration tests in the io.akka package to ensure that objects
have correct visibility outside akka.http.
The most important changes from spray-routing:
- Change Route from `RequestContext => Unit` to `RequestContext => Deferrable[RouteResult]`
- Switch directive extraction model from shapeless HLists to plain Scala Tuples
- Switch API from promoting actors as Route "containers" to being powered by plain executors/flow-materializers
- Make `Directive0` re-execute inner routes per requests, refs spray/spray#780
Other fixes:
- Simplify unmarshalling infrastructure, now based on `Deferrable`, closes#15690
- Change marshalling infrastrucutre to be based on `Deferrable` as well
- Clean up `akka.http` package contents, closes#15689
Changing from HList-based extractions to Tuple-based ones comes with one important drawback:
We can't rely on type bounds anymore to tighten and auto-document the API where generic extractions handled.
Currently we therefore fall back to context bounds where they add value, but this might change if the added overhead or code complexity becomes too much. We'll see when the remaining parts of spray-routing are ported.