spring-projects / spring-hateoas-examples

Collection of examples on how (and why) to build hypermedia-driven apps with Spring HATEOAS
Apache License 2.0
384 stars 186 forks source link

Create WebFlux + Boot example #27

Open gregturn opened 5 years ago

SchlammSpringer commented 5 years ago

That would be very interessting. Especially it looks like that X-Forwarded-Prefix: is no more added to Link in such a scenario

spring:
  main:
    web-application-type: reactive
server:
  forward-headers-strategy: native

Perhaps this could be some example:

private fun wrapInHateoas(someObject: SomeObject): Mono<EntityModel<SomeObject>> =
      someObject
          .toMono()
          .zipWith(linkTo(controller.getSomeObject(someObject.id)).withSelfRel().toMono()) {
              some: SomeObject, link: Link -> EntityModel(some, link)
            }