Package

org.http4s.dsl

impl

Permalink

package impl

Visibility
  1. Public
  2. All

Type Members

  1. final case class /(parent: Path, child: String) extends Path with Product with Serializable

    Permalink
  2. trait AllowResponseGenerator[F[_], G[_]] extends ResponseGenerator

    Permalink

    Helper for the generation of a org.http4s.Response which must contain an Allow header and may contain a body.

    Helper for the generation of a org.http4s.Response which must contain an Allow header and may contain a body.

    A 405 status MUST contain an Allow header, which distinguishes this from other ResponseGenerators.

  3. trait Auth extends AnyRef

    Permalink
  4. trait EmptyResponseGenerator[F[_], G[_]] extends ResponseGenerator

    Permalink

    Helper for the generation of a org.http4s.Response which will not contain a body

    Helper for the generation of a org.http4s.Response which will not contain a body

    While it is possible to for the org.http4s.Response manually, the EntityResponseGenerators offer shortcut syntax to make intention clear and concise.

    Example:
    1. val resp: F[Response] = Status.Continue()
  5. trait EntityResponseGenerator[F[_], G[_]] extends ResponseGenerator

    Permalink

    Helper for the generation of a org.http4s.Response which may contain a body

    Helper for the generation of a org.http4s.Response which may contain a body

    While it is possible to construct the org.http4s.Response manually, the EntityResponseGenerators offer shortcut syntax to make intention clear and concise.

    Example:
    1. val resp: IO[Response] = Ok("Hello world!")
  6. abstract class FlagQueryParamMatcher extends AnyRef

    Permalink

    Flag (value-less) query param extractor

  7. trait LocationResponseGenerator[F[_], G[_]] extends EntityResponseGenerator[F, G]

    Permalink

    Helper for the generation of a org.http4s.Response which may contain a Location header and may contain a body.

    Helper for the generation of a org.http4s.Response which may contain a Location header and may contain a body.

    A 300, 301, 302, 303, 307 and 308 status SHOULD contain a Location header, which distinguishes this from other EntityResponseGenerators.

  8. class MethodConcat extends AnyRef

    Permalink
  9. trait Methods extends AnyRef

    Permalink
  10. abstract class OptionalMultiQueryParamDecoderMatcher[T] extends AnyRef

    Permalink

    Capture a query parameter that appears 0 or more times.

    Capture a query parameter that appears 0 or more times.

    case class Foo(i: Int)
    implicit val fooDecoder: QueryParamDecoder[Foo] = ...
    implicit val fooParam: QueryParam[Foo] = ...
    
    object FooMatcher extends OptionalMultiQueryParamDecoderMatcher[Foo]("foo")
    val routes = HttpRoutes.of {
      // matches http://.../closest?foo=2&foo=3&foo=4
      case GET -> Root / "closest" :? FooMatcher(Some(Seq(2,3,4))) => ...
    
      /*
      *  matches http://.../closest?foo=2&foo=3&foo=4 as well as http://.../closest (no parameters)
      *  or http://.../closest?foo=2 (single occurrence)
      */
      case GET -> Root / "closest" :? FooMatcher(is) => ...
  11. abstract class OptionalQueryParamDecoderMatcher[T] extends AnyRef

    Permalink
  12. abstract class OptionalQueryParamMatcher[T] extends OptionalQueryParamDecoderMatcher[T]

    Permalink
  13. abstract class OptionalValidatingQueryParamDecoderMatcher[T] extends AnyRef

    Permalink

    param extractor using org.http4s.QueryParamDecoder.

    param extractor using org.http4s.QueryParamDecoder. Note that this will _always_ match, but will return an Option possibly containing the result of the conversion to T

    case class Foo(i: Int)
    implicit val fooDecoder: QueryParamDecoder[Foo] = ...
    
    case class Bar(i: Int)
    implicit val barDecoder: QueryParamDecoder[Bar] = ...
    
    object FooMatcher extends ValidatingQueryParamDecoderMatcher[Foo]("foo")
    object BarMatcher extends OptionalValidatingQueryParamDecoderMatcher[Bar]("bar")
    
    val routes = HttpRoutes.of {
      case GET -> Root / "closest" :? FooMatcher(fooValue) +& BarMatcher(barValue) => {
        ^(fooValue, barValue getOrElse 42.right) { (foo, bar) =>
          ...
        }.fold(
          nelE => BadRequest(nelE.toList.map(_.sanitized).mkString("\n")),
          baz  => { ... }
        )
      }
  14. trait Path extends AnyRef

    Permalink

    Base class for path extractors.

  15. class PathVar[A] extends AnyRef

    Permalink
    Attributes
    protected
  16. trait ProxyAuthenticateResponseGenerator[F[_], G[_]] extends ResponseGenerator

    Permalink

    Helper for the generation of a org.http4s.Response which must contain a Proxy-Authenticate header and may contain a body.

    Helper for the generation of a org.http4s.Response which must contain a Proxy-Authenticate header and may contain a body.

    A 407 status MUST contain a Proxy-Authenticate header, which distinguishes this from other EntityResponseGenerators.

  17. abstract class QueryParamDecoderMatcher[T] extends AnyRef

    Permalink

    param extractor using QueryParamDecoder:

    param extractor using QueryParamDecoder:

    case class Foo(i: Int)
    implicit val fooDecoder: QueryParamDecoder[Foo] = ...
    
    object FooMatcher extends QueryParamDecoderMatcher[Foo]("foo")
    val routes = HttpRoutes.of {
      case GET -> Root / "closest" :? FooMatcher(2) => ...
  18. abstract class QueryParamMatcher[T] extends QueryParamDecoderMatcher[T]

    Permalink

    param extractor using QueryParamDecoder:

    param extractor using QueryParamDecoder:

    case class Foo(i: Int)
    implicit val fooDecoder: QueryParamDecoder[Foo] = ...
    implicit val fooParam: QueryParam[Foo] = ...
    
    object FooMatcher extends QueryParamDecoderMatcher[Foo]
    val routes = HttpRoutes.of {
      case GET -> Root / "closest" :? FooMatcher(2) => ...
  19. trait ResponseGenerator extends Any

    Permalink
  20. trait Responses[F[_], G[_]] extends AnyRef

    Permalink
  21. trait Statuses extends AnyRef

    Permalink
  22. abstract class ValidatingQueryParamDecoderMatcher[T] extends AnyRef

    Permalink

    param extractor using org.http4s.QueryParamDecoder.

    param extractor using org.http4s.QueryParamDecoder. Note that this will return a ParseFailure if the parameter cannot be decoded.

    case class Foo(i: Int)
    implicit val fooDecoder: QueryParamDecoder[Foo] = ...
    
    object FooMatcher extends ValidatingQueryParamDecoderMatcher[Foo]("foo")
    val routes: HttpRoutes.of = {
      case GET -> Root / "closest" :? FooMatcher(fooValue) => {
        fooValue.fold(
          nelE => BadRequest(nelE.toList.map(_.sanitized).mkString("\n")),
          foo  => { ... }
        )
      }
  23. trait WwwAuthenticateResponseGenerator[F[_], G[_]] extends ResponseGenerator

    Permalink

    Helper for the generation of a org.http4s.Response which must contain a WWW-Authenticate header and may contain a body.

    Helper for the generation of a org.http4s.Response which must contain a WWW-Authenticate header and may contain a body.

    A 401 status MUST contain a WWW-Authenticate header, which distinguishes this from other ResponseGenerators.

Value Members

  1. object +&

    Permalink

    Multiple param extractor:

    Multiple param extractor:

    object A extends QueryParamDecoderMatcher[String]("a")
    object B extends QueryParamDecoderMatcher[Int]("b")
    val routes = HttpRoutes.of {
      case GET -> Root / "user" :? A(a) +& B(b) => ...
  2. object ->

    Permalink
  3. object /:

    Permalink

    Path separator extractor:

    Path separator extractor:

    Path("/1/2/3/test.json") match {
      case "1" /: "2" /: _ =>  ...
  4. object :?

    Permalink
  5. object IntVar extends PathVar[Int]

    Permalink

    Integer extractor of a path variable:

    Integer extractor of a path variable:

    Path("/user/123") match {
       case Root / "user" / IntVar(userId) => ...
  6. object LongVar extends PathVar[Long]

    Permalink

    Long extractor of a path variable:

    Long extractor of a path variable:

    Path("/user/123") match {
       case Root / "user" / LongVar(userId) => ...
  7. object Path

    Permalink
  8. object Responses

    Permalink
  9. object Root extends Path with Product with Serializable

    Permalink

    Root extractor:

    Root extractor:

    Path("/") match {
      case Root => ...
    }
  10. object UUIDVar extends PathVar[UUID]

    Permalink

    UUID extractor of a path variable:

    UUID extractor of a path variable:

    Path("/user/13251d88-7a73-4fcf-b935-54dfae9f023e") match {
       case Root / "user" / UUIDVar(userId) => ...
  11. object ~

    Permalink

    File extension extractor

Ungrouped