NAME

WWW::Kontent::Request - Kontent request object

SYNOPSIS

# Eventually, when Pugs supports this sort of thing
method adapter(WWW::Kontent::Request $request where { .mode eq 'view' }) {
	return WWW::Kontent::Parser::parse(
		:type($.attributes<kiki:type>),
		:content($.attributes<kiki:content>),
	);
}

DESCRIPTION

WWW::Kontent::Request represents a request for a page. It is used to:

  • Store and organize information which may be used and modified over the lifetime of the request.

  • Execute the overall store-driver-renderer control flow.

  • Carry information between the various components.

  • Parse and resolve paths.

Attributes

path

WWW::Kontent::Path object representing the path being resolved in this request.

mode

Contains the name of the rendering mode, such as "view" (the default), "history" and "edit". Drivers, adapters, and renderers are all concerned with these modes. This actually retrieves it from the object in path.

format

Contains the name of the page's format, such as "html" (the default), "xml", "pdf", or "jpg". This field is mostly the purview of the renderer (and is used to select the renderer), but may be of interest to certain adapters as well, such as those used to store images. This actually retrieves it from the object in path.

parameters

Contains a hash of parameters to the page. Parameters may be accessed in Kolophon by using $$NAME, and are used to communicate information to drivers besides the mode and format; they usually correspond to HTTP POST or GET parameters.

nested

Indicates the subrequest depth. Zero indicates that this object is the top-level request; one indicates it is a first-level subrequest; and so on. Many renderers will omit "chrome" such as headers or navigation tools in a subrequest, but drivers and adapters may be interested in this as well.

type

Contains the MIME type of the final output; as such, this is usually set by the renderer, but sometimes the adapter handles this instead. HTTP supervisors will typically output this value as the Content-Type header.

status

Contains the HTTP status code that should be returned to the browser; defaults to 200.

root

Contains the store's root page.

page
revision

After a call to .path.resolve, contains the page and revision so resolved. These fields should usually be used only by supervisors; the request object will arrange for renderers and page classes to receive their own references to the revision object.

renderer

Contains the renderer to be used for this request.

Constructors

WWW::Kontent::Request.new(:root($store_root), :path("/foo/bar[42].atom{edit}"), :parameters({ baz => 'quux' }))

The normal constructor for a Request object; usually called only from the supervisor. Parses path if provided to acquire an address.

$request.subrequest($path, { :param1<value1, :param2<value2> })>

Constructs a subrequest with the same format and mode as the current request, but the parameters and path provided.

Note that the same renderer class will be used as $request, even if a different format is provided. The reason for this will become clear through deep meditation on exactly what the Kolophon code {{/images/foo.jpg}} should do in an HTML renderer.

Methods

go

Convenience method which calls .path.resolve, then the revision's driver, and finally the renderer. Returns a string containing the renderer's output. It also handles restarts and other inner exceptions.

SEE ALSO

WWW::Kontent

4 POD Errors

The following errors were encountered while parsing the POD:

Around line 34:

=back doesn't take any parameters, but you said =back 4

Around line 101:

=back doesn't take any parameters, but you said =back 4

Around line 159:

=back doesn't take any parameters, but you said =back 4

Around line 208:

=back doesn't take any parameters, but you said =back 4