object BodyCache

Middleware for caching the request body for multiple compilations

As the body of the request is the Stream of bytes, compiling it several times (e.g. with middlewares) is unsafe. This middleware forbids such behaviour, compiling the body only once. It does so only for the "inner" middlewares:

val route = AMiddleware(BodyCache(SomeOtherMiddleware(myRoute)))

In this example only myRoute & SomeOtherMiddleware will receive cached request body, while the AMiddleware will get the raw one.

As the entire request body will be allocated in memory, there is a possibility of OOM error with a large body. Because of that, using the EntityLimiter middleware is strongly advised.

Source
BodyCache.scala
Note

This middleware has nothing to do with the HTTP caching mechanism and it does not cache bodies between multiple requests.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. BodyCache
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def apply[G[_], F[_], R](old: Kleisli[G, R, Response[F]])(reqGet: (R) ⇒ Request[F], reqSet: (R) ⇒ (Request[F]) ⇒ R)(lift: ~>[F, G])(implicit arg0: Concurrent[G], arg1: Concurrent[F]): Kleisli[G, R, Response[F]]
  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  7. def contextRoutes[T, F[_]](routes: ContextRoutes[T, F])(implicit arg0: Concurrent[F]): ContextRoutes[T, F]
  8. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  9. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  10. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  11. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  12. def hasNoBody[F[_]](req: Request[F]): Boolean
  13. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  14. def httpApp[F[_]](app: HttpApp[F])(implicit arg0: Concurrent[F]): HttpApp[F]
  15. def httpRoutes[F[_]](routes: HttpRoutes[F])(implicit arg0: Concurrent[F]): HttpRoutes[F]
  16. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  17. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  18. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  19. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  20. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  21. def toString(): String
    Definition Classes
    AnyRef → Any
  22. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  23. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  24. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()

Inherited from AnyRef

Inherited from Any

Ungrouped