facet classafPillow::Page

sys::Obj
  afPillow::Page : sys::Facet

@FacetMeta { inherited=true }
@Serializable

Place on a EfanComponent to define a Pillow web page.

contentType

Source

const MimeType? contentType

Use to set an explicit Content-Type the page should be served with. The Content-Type is set in the HTTP response header.

using afPillow
using afEfanXtra

@Page { contentType=MimeType("text/plain") }
const mixin Matrix : EfanComponent { ... }
httpMethod

Source

const Str httpMethod := "GET"

The HTTP method the Page should respond to.

Defaults to GET

template

Source

const Uri? template

By default, pillow looks for a template with the same name as the page class.

Use this to explicitly set the location of efan template. The URI may take several forms:

  • if fully qualified, the template is resolved, e.g. fan://acmePod/templates/Notice.efan
  • if relative, the template is assumed to be on the file system, e.g. etc/templates/Notice.efan
  • if absolute, the template is assumed to be a pod resource, e.g. /templates/Notice.efan

ALIEN-AID: Use a value of fan://afEfanXtra/res/viaRenderMethod.efan and don't create a template file at all!

Instead, just declare the method Str render() {...} and return whatever you want!

uri

Source

const Uri? uri

Use to map the page to a specific URI. Page URIs should start with a leading /slash/. Example:

using afEfanXtra
using afPillow

@Page { uri=`/matrix_explained.html` }
const mixin Matrix : EfanComponent { ... }