4.1Object Nest

Nest application framework.

Object Nest

This object represents the core of the Nest system. It is mean to be part of the web application loading it, so it should be loaded with the directive


   load nest
Properties
ALRepeat the AuthLevel enumeration
DMRepeat data managers. An enumeration with the following values
  • DBI = DBIDataManager class
PRIORepeat the Priority enumeration
auth_levelFor now, use the max authlevel by default.
debugDebug mode?
extscriptsJavascripts to be loaded in html headers
filterFilter for input variables (POST or GET key/value pairs).
frameFraming.
inputVarsInput variables as parsed and filtered.
log_levelLog level.
loggerBasic logger
nest_dirHome of the nest installed hierarcy.
onStartupFunction called back after routing and before routed page execution.
pidPage ID of the currently served page
routerRouter.
scriptsInline scripts to be put before body.
self_uriURI of the entry point script.
servicesList of active services.
sessionDataNest-specific session data.
sessionExpiredTrue when we detect the session data to be exipred.
sessionManagerManager for persistent variables. By default, it's pointing to a BasicSessionManager object, which implements the stanard WOPI session management.
site_nest_dirNest application directory for current site.
stylesInline scripts to be put before body.
stylesheetsStylesheets to be loaded in html headers
titleTitle for the page. This will be renedered as <?=Nest.title?> when Nest.headings are called.
Methods
ambientInvoke an ambient variable.
dmInvoke a Data Manager.
routeNest entry point.
selectorPage selector.
serviceInvoke a service.

Properties

AL

Repeat the AuthLevel enumeration

DM

Repeat data managers. An enumeration with the following values

PRIO

Repeat the Priority enumeration

auth_level

For now, use the max authlevel by default.

debug

Debug mode?

extscripts

Javascripts to be loaded in html headers

filter

Filter for input variables (POST or GET key/value pairs).

Filters the content of the get and post values and stores them in the Nest.inputVars field as a dictionary pairs.

Cookies and session data are used by Nest and provided to the application via the Nest.sessionData property. However, the application can access them separately (nest uses a "Nest" namespace to save its own variables in cookies or session data).

The filter object must expose a "filter" function, that returns the dictionar function should return a dictionary of variables then saved in the inputVars field.

The basic (default) filter just stores all the GET and POST variables in the inputVars field (post variables having higer priority).

frame

Framing.

When the frame property is set to a function, then Nest will load the page that the routing system required and render it separately. The output of the rendered page will be retrieved through the Nest.content method; then, the function stored in frame will be called, and it will just need to print Nest.content variable at the desired position.

Interesting functions can be:


      Nest.frame = .[ include "some_file" ]
      Nest.frame = .[ include Nest.pageLink("pid-of-frame") ]

The function should produce an output that will be captured by Nest and then rendered.

inputVars

Input variables as parsed and filtered.

At the disposal of services and user applications.

log_level

Log level.

Can be:

logger

Basic logger

nest_dir

Home of the nest installed hierarcy.

It defaults to vmModulePath(), which is the path from where Falcon loaded this Nest module.

onStartup

Function called back after routing and before routed page execution.

This is the ideal place to put code that must be always executed.

Normally, database managers and login services are configured here.

pid

Page ID of the currently served page

router

Router.

This object maps a raw web request into a page id.

The property can be assigned by the user application to an arbitrary router, which is an object exposing a route() function.

The function must return a page id (a string) if the router could determine where the request should be sent, or nil if the page ID cannot be determined.

In this case, Nest raises an error and the execution terminates.

The default router seeks a "pid" field first in the posts, then the gets fields of the Request. If the "pid" is not found, the router returns a "home" page id.

scripts

Inline scripts to be put before body.

self_uri

URI of the entry point script.

If set to nil, in case of need the URI of the entry point script will be determined through the Request fields.

services

List of active services.

Usually not at the disposal of the user application.

sessionData

Nest-specific session data.

Contains data which must be retained across sessions.

Services use it automatically, but it can be used also by the user application at will.

sessionExpired

True when we detect the session data to be exipred.

sessionManager

Manager for persistent variables. By default, it's pointing to a BasicSessionManager object, which implements the stanard WOPI session management.

site_nest_dir

Nest application directory for current site.

It's relative to the entrypoint script, and defaults to "./nest".

styles

Inline scripts to be put before body.

stylesheets

Stylesheets to be loaded in html headers

title

Title for the page. This will be renedered as <?=Nest.title?> when Nest.headings are called.

Methods

ambient

Invoke an ambient variable.

ambient( aname, binding )

Ambient variables are service variables which are immediately repeated to all the system.

dm

Invoke a Data Manager.

dm( name, [config] )
name The name of the data manager to be invoked.
config Dictionary of variables to be used as configuration.

The "type" key must be specified either in the config parameter or in the file named after dm/.fal, and must contain a Nest class (i.e. DBIDataManager)

All the entities relative to this Data Manager name. For example, they are named like dm//.

route

Nest entry point.

route()

This method routes a web request down into the nest sytem.

selector

Page selector.

selector( pid )

Call this function to get the main ID of the page to be displayed.

This is the entry point of a Nest web application.

service

Invoke a service.

service( name, [inst],[vars] )
name The logical name of the service to be invoked.
inst The instance name for the service.
vars A dictionary of configuration key/values pairs.
ReturnA Service instance.
Made with http://www.falconpl.org