All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.fintrospect.formats.XHtml.scala Maven / Gradle / Ivy

There is a newer version: 12.21.1
Show newest version
package io.fintrospect.formats

import io.fintrospect.ContentTypes

import scala.xml.Elem

/**
  * Native (Elem-based) XHtml support (application/xhtml+xml content type)
  */
object XHtml {

  object ResponseBuilder extends AbstractResponseBuilder[Elem] {

    private def format(node: Elem): String = node.toString()

    private def formatErrorMessage(errorMessage: String): Elem = {errorMessage} 

    private def formatError(throwable: Throwable): Elem = formatErrorMessage(Option(throwable.getMessage).getOrElse(throwable.getClass.getName))

    override def HttpResponse() = new ResponseBuilder[Elem](format, formatErrorMessage, formatError, ContentTypes.APPLICATION_XHTML_XML)
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy