Function registerFormInterface

Generates a form based interface to the given instance.

Each function is callable with either GET or POST using form encoded parameters. All methods of I that start with "get", "query", "add", "create", "post" are made available via url: url_prefix~method_name. A method named "index" will be made available via url_prefix. All these methods might take a HttpServerRequest parameter and a HttpServerResponse parameter, but don't have to.

All additional parameters will be filled with available form-data fields. Every parameters name has to match a form field name. The registered handler will throw an exception if no overload is found that is compatible with all available form data fields.

For a thorough example of how to use this method, see the form_interface example in the examples directory.

Prototypes

void registerFormInterface((I))(
  UrlRouter router,
  I instance,
  string url_prefix,
  MethodStyle style
);

See_Also

registerFormMethod

Parameters

Parameter nameDescription
router The router the found methods are registered with.
instance The instance whose methods should be called via the registered URLs.
url_prefix The prefix before the method name. A method named getWelcomePage
with a given url_prefix "/mywebapp/welcomePage/" would be made available as "/mywebapp/welcomePage/getWelcomePage" if MethodStyle is Unaltered.
style How the url part representing the method name should be altered.

Authors

Sönke Ludwig, Jan Krüger

Copyright

© 2012 RejectedSoftware e.K.

License

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