Packages

  • package root
    Definition Classes
    root
  • package lol

    This is the documentation for the lolhttp library.

    This is the documentation for the lolhttp library.

    • http is the core module providing HTTP Client and Server.
    • json is an optional module providing integration with the circe JSON library.
    • html is an optional module providing HTML templating.
    Definition Classes
    root
  • package html

    HTML templating.

    HTML templating.

    val items: List[Item] = ???
    val content: Html = tmpl"""
      <­h1>Items<­/h1>
      @if(items.isEmpty) {
        <­em>No results<­/em>
      }
      else {
        <­ul>
           @items.map { item =>
             <li>@item.name</li>
           }
    
      }
    """

    Html values can also be easily created from the html interpolation. Conversion from Scala values is done via the ToHtml type class.

    val content: Html = html"""Hello $${name}!"""

    They will be encoded as lol.http.Content thanks to Html.encoder.

    Definition Classes
    lol
  • Html
  • HtmlInterpolation
  • SeqHtmlExtensions
  • SeqHtmlExtensions0
  • TemplateInterpolation
  • ToHtml
  • package http

    The core module for lolhttp.

    The core module for lolhttp.

    Server.listen(8888) { request =>
      Ok("Hello world!")
    }
    
    Client.run(Get("http://localhost:8888/")) { response =>
      response.readAs[String]
    }

    Provides an HTTP Client and an HTTP Server. Both client and server are Service functions. A service function takes a Request and eventually returns a Response. Requests and responses are shared between the client and the server API, making it easy to assemble them. Both are seen as a set of HTTP headers, and a Content body.

    The content fs2.Stream is based on fs2 and can be lazily consumed if needed. It can be encoded and decoded using the appropriate ContentEncoder and ContentDecoder.

    SSL is supported on both sides.

    Definition Classes
    lol
  • package json

    Provides integration with the circe JSON library.

    Provides integration with the circe JSON library.

    Server.listen(8888) { request =>
      request.readAs(json[MyRequestData]).flatMap { data =>
        Ok(MyResponseData(data).asJson)
      }
    }

    Nothing really special here. Just a bunch of useful lol.http.ContentEncoder and lol.http.ContentDecoder for io.circe.Json values.

    This module is optional and you can easily use another scala JSON library by providing the required encoder/decoder (or treating JSON as string).

    Definition Classes
    lol
p

lol

html

package html

HTML templating.

val items: List[Item] = ???
val content: Html = tmpl"""
  <­h1>Items<­/h1>
  @if(items.isEmpty) {
    <­em>No results<­/em>
  }
  else {
    <­ul>
       @items.map { item =>
         <li>@item.name</li>
       }

  }
"""

Html values can also be easily created from the html interpolation. Conversion from Scala values is done via the ToHtml type class.

val content: Html = html"""Hello $${name}!"""

They will be encoded as lol.http.Content thanks to Html.encoder.

Source
package.scala
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. html
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. case class Html(content: String) extends Product with Serializable

    An HTML document.

  2. implicit class HtmlInterpolation extends AnyRef

    The html interpolation allows to create Html values from plain string.

  3. implicit class SeqHtmlExtensions extends AnyRef

    Extension methods for Seq[Html].

  4. implicit class SeqHtmlExtensions0[A] extends AnyRef

    Extension methods for Seq[_].

  5. implicit class TemplateInterpolation extends AnyRef

    The tmpl interpolation allows to create Html values from a string template.

    The tmpl interpolation allows to create Html values from a string template.

    The template syntax is almost the same as Twirl (https://www.playframework.com/documentation/2.6.x/ScalaTemplates). It is often more convenient that using imbricated string interpolation.

  6. trait ToHtml[-A] extends AnyRef

    A type class to provide Html rendering.

Value Members

  1. implicit def toHtml[A](value: A)(implicit arg0: ToHtml[A]): Html

    Convert a value to Html using the right ToHtml type class instance.

    Convert a value to Html using the right ToHtml type class instance.

    If using the provided type class instances, values are encoded this way.:

    • String values are safely HTML escaped to avoid XSS issues with generated documents.
    • scala.Option can be directly inserted. Some values content is included, while
    • None produces an empty string.
    • scala.Unit produces an empty string.
    • scala.Seq outputs every item without any separator.
  2. object Html extends Serializable

    Provides the ContentEncoder for HTML documents.

  3. object ToHtml

    Default instances for the ToHtml type class.

Inherited from AnyRef

Inherited from Any

Ungrouped