const classafBedSheet::TextResult

sys::Obj
  afBedSheet::TextResult

Return from Handler methods to send a text response to the client.

All MimeTypes have a charset of UTF-8 because that is the default encoding of Fantom Strs.

This is purposely a concrete final class so there's no ambiguity as to what it is. For example, if a handler returned an Obj that was both a TextResult and a "JsonResult' what is BedSheet supposed to do?

Best practice is to have your Entities have a toText() or toJson() method and return that.

Obj myHandler(MyEntity entity) {
  ...
  return entity.toJson
}
fromHtml

Source

static TextResult fromHtml(Str text)

Creates a TextResult with the MimeType text/html; charset=utf-8

fromMime

Source

static TextResult fromMime(Str text, MimeType mimeType)

Creates a TextResult with the MimeType text/xml; charset=utf-8

fromPlain

Source

static TextResult fromPlain(Str text)

Creates a TextResult with the MimeType text/plain; charset=utf-8

fromXml

Source

static TextResult fromXml(Str text)

Creates a TextResult with the MimeType text/xml; charset=utf-8

mimeType

Source

const MimeType mimeType

text

Source

const Str text