vibe.web.web

Implements a declarative framework for building web interfaces.

This module contains the sister funtionality to the vibe.web.rest module. While the REST interface generator is meant for stateless machine-to-machine communication, this module aims at implementing user facing web services. Apart from that, both systems use the same declarative approach.

See registerWebInterface for an overview of how the system works.

Public Imports

vibe.web.common
public import vibe.web.common;
Undocumented in source.
vibe.web.i18n
public import vibe.web.i18n;
Undocumented in source.
vibe.web.validation
public import vibe.web.validation;
Undocumented in source.

Members

Classes

WebInterfaceSettings
class WebInterfaceSettings

Encapsulates settings used to customize the generated web interface.

Functions

before (from vibe.internal.meta.funcattr)
auto before(string parameter_name) via public import vibe.internal.meta.funcattr : PrivateAccessProxy, before, after;

Marks function/method for usage with AttributedFunction.

header
void header(string name, string value)

Sets a response header.

nestedNameStyle
NestedNameStyleAttribute nestedNameStyle(NestedNameStyle style)

Determines how nested D fields/array entries are mapped to form field * names. Note that this attribute only works if applied to the class.

redirect
void redirect(string url, int status)
void redirect(URL url, int status)

Redirects to the given URL.

registerWebInterface
URLRouter registerWebInterface(URLRouter router, C instance, WebInterfaceSettings settings)

Registers a HTTP/web interface based on a class instance.

status
void status(int statusCode)

Sets the response status code.

terminateSession
void terminateSession()

Terminates the currently active session (if any).

trWeb
string trWeb(string text, string context)
string trWeb(string text, string plural_text, int count, string context)

Translates text based on the language of the current web request.

Mixin templates

PrivateAccessProxy (from vibe.internal.meta.funcattr)
mixintemplate PrivateAccessProxy() via public import vibe.internal.meta.funcattr : PrivateAccessProxy, before, after;

Helper mixin to support private member functions for @before attributes.

Properties

after (from vibe.internal.meta.funcattr)
auto after [@property getter] via public import vibe.internal.meta.funcattr : PrivateAccessProxy, before, after;

Marks function/method for usage with AttributedFunction.

errorDisplay
errorDisplay [@property getter]

Attribute to customize how errors/exceptions are displayed.

language
string language [@property getter]

Returns the agreed upon language.

request
HTTPServerRequest request [@property getter]

Returns the current request.

response
HTTPServerResponse response [@property getter]

Returns the current response.

Structs

SessionVar
struct SessionVar(T, string name)

Maps a web interface member variable to a session field.

Templates

render
template render(string diet_file, ALIASES...)

Renders a Diet template file to the current HTTP response.

Meta

License

Subject to the terms of the MIT license, as written in the included LICENSE.txt file.

Authors

Sönke Ludwig