package staticcontent
Helpers for serving static content from http4s
Note that these tools are relatively primitive and a dedicated server should be used for serious static content serving.
- Source
- package.scala
- Alphabetic
- By Inheritance
- staticcontent
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- trait CacheStrategy[F[_]] extends AnyRef
Cache the body of a Response for future use
Cache the body of a Response for future use
A CacheStrategy acts like a after filter in that it can look at the Response and Uri of the Request and decide if the body for the response has already been cached, needs caching, or to let it pass through.
- class MemoryCache[F[_]] extends CacheStrategy[F]
CacheStrategy that will cache all Response bodies in local memory
CacheStrategy that will cache all Response bodies in local memory
This is useful when serving a very limited amount of static content and want to avoid disk access.
- class NoopCacheStrategy[F[_]] extends CacheStrategy[F]
Cache strategy that doesn't cache anything, ever.
- class ResourceServiceBuilder[F[_]] extends AnyRef
org.http4s.server.staticcontent.ResourceServiceBuilder builder
- class WebjarServiceBuilder[F[_]] extends AnyRef
org.http4s.server.staticcontent.WebjarServiceBuilder builder
Value Members
- def fileService[F[_]](config: Config[F])(implicit arg0: Sync[F]): HttpRoutes[F]
Make a new org.http4s.HttpRoutes that serves static files.
- def resourceServiceBuilder[F[_]](basePath: String, blocker: Blocker)(implicit arg0: Sync[F], arg1: ContextShift[F]): ResourceServiceBuilder[F]
Make a new org.http4s.HttpRoutes that serves static files, possibly from the classpath.
- def webjarServiceBuilder[F[_]](blocker: Blocker)(implicit arg0: Sync[F], arg1: ContextShift[F]): WebjarServiceBuilder[F]
Make a new org.http4s.HttpRoutes that serves static files from webjars
- object FileService
- object MemoryCache
- object NoopCacheStrategy
- object ResourceService
- object ResourceServiceBuilder
- object WebjarService
- object WebjarServiceBuilder
Deprecated Value Members
- def resourceService[F[_]](config: Config[F])(implicit arg0: Sync[F], arg1: ContextShift[F]): HttpRoutes[F]
Make a new org.http4s.HttpRoutes that serves static files, possibly from the classpath.
Make a new org.http4s.HttpRoutes that serves static files, possibly from the classpath.
- Annotations
- @deprecated
- Deprecated
(Since version 1.0.0-M1) use resourceServiceBuilder
- def webjarService[F[_]](config: Config[F])(implicit arg0: Sync[F], arg1: ContextShift[F]): HttpRoutes[F]
Make a new org.http4s.HttpRoutes that serves static files from webjars
Make a new org.http4s.HttpRoutes that serves static files from webjars
- Annotations
- @deprecated
- Deprecated
(Since version 1.0.0-M1) use webjarServiceBuilder