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
static TextResult fromHtml(Str text)
Creates a
TextResult
with the MimeTypetext/html; charset=utf-8
- fromMime
static TextResult fromMime(Str text, MimeType mimeType)
Creates a
TextResult
with the MimeTypetext/xml; charset=utf-8
- fromPlain
static TextResult fromPlain(Str text)
Creates a
TextResult
with the MimeTypetext/plain; charset=utf-8
- fromXml
static TextResult fromXml(Str text)
Creates a
TextResult
with the MimeTypetext/xml; charset=utf-8
- mimeType
const MimeType mimeType
- text
const Str text