WebMCP

WebMCP is web application framework written in Lua and C. Instead of using the classical Model-View-Controller (MVC) concept, WebMCP makes use of a so-called Model-View-Action concept. The database is accessed through the Model layer, which provides an Object-Relational Mapping (ORM). HTTP-GET requests are handled by Views, which process the request data, query the database, and render the result. HTTP-POST requests are handled by Actions, which can write to the database and redirect to a View, dependent on success or failure.

WebMCP 2.x is based on the Moonbridge Network Server for Lua Applications.

Documentation

Please read the Installation section of our Online Documentation for information about how to install the framework on your system.

Download

Dependencies

Changes

  • 2016-05-16: Version 2.1.0
    • New features
      • Support for mutable data types (e.g. mutable JSON structures) in mondelefant library
      • JSON support for the mondelefant library
        • Support for primary keys stored as JSON field
        • Setting <db_class>.document_column enables direct access to JSON object instead of columns
        • New attibute <db_object>._col to always access columns instead of JSON fields (when document_column is set)
      • Improved encoding and decoding of JSON numbers by JSON library
        • Round floating point numbers if reimporting them as double precision integer does not cause loss of precision
        • Decode certain JSON numbers as Lua 5.3 integers (if Lua 5.3 is used)
      • Extended mondelefant library to support asynchronous notifications (methods <db_handle>:wait(...) and <db_handle>:try_wait(...))
      • Function mondelefant.connect{...} returns a database error object as third argument
      • Information structure <db_object>._column_info includes string keys now (column names, in addition to column numbers)
      • Callback of ui.list{...} receives the row index as second argument
      • Added net.configure_mail{...} function to allow other mail interfaces than sendmail (or sendmail compatible interfaces)
      • Automatic documentation system (autodoc) improved by adding support for URL fragments
    • Bugfixes
      • Fixed segmentation fault in json.export(...) (may be security relevant)
      • Huge integers were not handled properly by the mondelefant atom connector library
      • Bugfix in ui.submit{...} to properly process attr parameter
      • Fixed issue with Lua 5.3 compatibility in multirand library if Lua was compiled without LUA_COMPAT_5_2 (use luaL_checkinteger instead of luaL_checkint)
      • Fixed bug in error handling of extos.pfilter(...) function due to noncompliant strerror_r() implementation when _GNU_SOURCE is set during compile time
      • Fixed bug in error handling when PQsendQuery function of PostgreSQL's libpq library returned an error
    • Fixes in documentation
      • Fixed wrong and/or broken documentation of <db_handle>:create_list(...), <db_handle>:quote_binary(...), and extos.pfilter(...)
      • Updated documentation of listen{...} to match Moonbridge 1.0.1
      • Added documentation for certain fields of <db_error> objects
      • Added missing execute.inner() call to post-fork initializer example for opening database connections
    • Code cleanup
      • Use Lua uservalues (available since Lua 5.2) instead of ephemeron (or weak-key) tables in C implementation of mondelefant library
      • Dropped old compatibility code for Lua 5.1 and PostgreSQL 8.1
      • Further code cleanup
    • Other improvements
      • Include stack traceback of initializers or finalizers (executed as coroutine) in error message
      • Use pg_config binary of PostgreSQL by default during make process
      • Better behavior in case of out-of-memory errors or emergency garbage collection in certain cases
    • Further changes
      • Passing engine=postgresql to function mondelefant.connect{...} has been deprecated (PostgreSQL is the only supported database and always used)
      • Deprecated <db_error>:escalate() method in favor of error(...)
  • 2015-08-07: Version 2.0.3
    • Bugfix in functions request.set_absolute_baseurl(...) and request.register_mime_type(...)
    • Updated documentation to match Moonbridge v1.0.x
  • 2015-03-29: Version 2.0.2
    • Included Makefile.options file, which was missing in the tarball of version 2.0.1
    • Minor fix in autodoc comment of function auth.openid.verify{...}
  • 2015-03-26: Version 2.0.1
    • Bugfixes
      • Fixed function request.get_param_strings{...}, which always returned an empty table
      • Respect index passed to request.get_param{...}
      • Fixed error which caused always a MIME-type of application/octet-stream when delivering static content
      • Show trace timers for all sections, even in case of error
      • Proper handling of nil values passed to trace.debug(...)
      • Prohibit possibility to peek into directory listings of subdirectories of static/ on BSD systems
    • Allow access to POST field metadata (using the meta parameter of request.get_param{...})
    • New functions extos.stat(...), extos.lstat(...), and extos.fstat(...)
    • Added test_existence option to execute.view{...} and execute.action{...}
    • Deprecated functions encode.action_file_path{...} and encode.view_file_path{...}
    • Code cleanup
    • Minor fixes in autodoc documentation
  • 2015-03-24: Version 2.0.0
    • Dropped Lua 5.1 compatibility; Lua 5.2 or Lua 5.3 are now required
    • Usage of the Moonbridge Network Server for Lua Applications
      • Replaces CGI invocation
      • WebMCP will open a TCP port to directly respond to HTTP/1.1 requests (persistent connections supported)
      • Pre-fork and post-fork initializers
      • Background tasks may be configured directly in the application's configuration file (or its pre-fork initializers)
      • Caching compiled Lua functions of framework and application code in memory instead of loading source code from the filesystem
      • Reusing the application state to serve multiple requests (the global table app may be used for variables which have a request lifetime)
      • New functions request.for_each(...), request.configure(...), and request.initialize() to register and execute request-based initializers
    • Prohibit accidental setting of global variables
    • New JSON library
    • Support for external redirects and redirects to static files
    • Further API changes
      • Functions request.get_config(), request.get_app_basepath(), request.get_app_name() have been replaced by corresponding constants WEBMCP_CONFIG_NAMES, WEBMCP_BASE_PATH, WEBMCP_APP_NAME
      • encode.json{...} does not support atoms anymore (atoms need to be converted to strings first)
      • Removal of previously deprecated functions
    • Hashbang line in translation files is now disallowed
    • Multiple configuration files may be specified
    • Allow relative URIs in 301/303 HTTP redirects (according to RFC 7231)
    • Improved trace system
      • SQL tracer is enabled automatically (unless trace system is disabled)
      • Automatic tracing of execution time of SQL statements
      • Output of CPU/database/real-time for every section
    • Minor bugfixes
      • Correct handling of nil's in return tuples in execute.chunk…
      • Register two class methods (get_reference(...) and get_foreign_key_reference_name(...)) of the mondelefant library written in C for use in Lua
    • Minor fixes in autodoc documentation
  • 2014-07-10: Version 1.2.6
    • String truncating by counting Unicode codepoints
    • Anchor (#) support for redirect and routing
    • Allow raw access to cgi.post_data for requests that are small (< 256k)
    • Bugfixes regarding 12-hour clock formatting in format.time(...)
    • Logging of time in trace system
    • Code cleanup
  • 2012-10-15: Version 1.2.5
    • URL parsing inside WebMCP to simplify webserver configuration (old style webserver configuration is still supported)
    • Bugfixes in atom library
      • Bugfix for :get_current() methods of date, time and timestamp (missing import of os functions)
      • Bugfix in getters midnight and midday of date atom
  • 2012-07-06: Version 1.2.4
    • Disable trace system for non-cgi sessions to avoid memory leaks
  • 2012-06-28: Version 1.2.3
    • Anchor support in encode.url{...}, ui.link{...} and ui.paginate{...}
    • New function ui.anchor{...}
  • 2012-06-21: Version 1.2.2
    • Allow particular records to be selected and/or disabled in ui.field.select{...}, even if they share the same key, and never select more than one record
  • 2012-06-15: Version 1.2.1
    • Removed wrongly included include/lib path for testing purposes from Makefile.options
  • 2012-04-21: Version 1.2.0
    • Compatibility with Lua 5.2, while keeping compatibility to Lua 5.1 as well
    • Functions of "extos" library are now available via extos instead of os
  • 2012-04-03: Version 1.1.3
    • Bugfixes
      • Allow creation of rows with DEFAULT VALUES in <db_object>:try_save() and <db_object>:save()
      • Added return false statement to onclick event of action links with href="#"
      • Bugfix regarding behaviour of <db_selector>:add_from(...) and <db_selector>:left_join(...) on first FROM entry
      • Bugfix in net.send_mail(...) regarding envelope_from
      • Bugfix in function encode.mime.mailbox_list_header_line(...), which caused arguments to be modified
    • Added documentation
      • Documentation for attr, a_attr and form_attr arguments to function ui.link{...}
    • Features
      • Support file upload via webforms
      • Changed partialload_encodeFormData(...) to allow non-string objects implementing .toString()
  • 2010-11-08: Version 1.1.2
    • Changed default CFLAGS in Makefile.options
    • Allow another script to include the webmcp.lua script when the current working directory is not the cgi-bin directory (the script needs to set a global WEBMCP_PATH variable)
    • New functions
      • trace.debug_traceback()
      • execute.chunk{...}
      • trace.debug_table(...)
      • trace.disable() and trace.is_disabled()
    • Support for disabled records in select widget
    • Allow exceptions in slot.reset_all{...}
    • Allow attributes of some <div>s to be set in cases, where it was not possible before
    • Allow multiple arguments to trace.debug(...)
    • Added method <db_selector>:add_with(...) to create queries WITH RECURSIVE
    • Allow mondelefant.connect{...} to be called with an explicit "conninfo" string
  • 2010-07-08: Version 1.1.1
    • Changed quoting style in auth.openid.xrds_document…
    • Fixed documentation for auth.openid.initiate…
    • Added documentation for mondelefant
    • Code-cleanup in mondelefant:
      • removed unneccessary lines: rows = PQntuples(res); cols = PQnfields(res);
      • avoided extra copy of first argument (self) in mondelefant_conn_query
      • no rawget in meta-method __index of database result lists and objects
      • removed unreachable return 0; in meta-method __newindex of database result lists and objects
    • Make request.get_json_request_slots return nil, when running WebMCP shell (cgi is nil)
    • Year in copyright notice changed to 2009-2010
  • 2010-04-22: Version 1.1.0
    • OpenID 2.0 Relying Party support
  • 2010-03-25: Version 1.0.9
    • New functions rocketcgi.set_cookie{...} and request.set_cookie{...} functions
    • Added some missing inline documentation
    • Make request.set_allowed_json_request_slots(...) work in interactive shell
  • 2010-02-20: Version 1.0.8
    • New function ui.filters{...}
  • 2010-02-19: Version 1.0.7
    • Bugfix in ui.paginate{...}: No negative offset when paginating empty result set (caused trouble in PostgreSQL 8.4)
    • ui.script{...} rejects scripts containing the character sequence ]]> to avoid ambigiuities related to HTML vs XML parsing
    • Partial content replacement using XMLHttpRequests
    • Bugfix in CGI library: accept POST data content-types, which contain additional charset information
    • Support arrays passed as params to encode.url (only for keys ending with "[]")
    • Image support for ui.link
  • 2010-01-22: Version 1.0.6
    • Bugfix: class_prototype:add_reference{...} uses now qualified names in SQL queries to allow JOINs
    • Fixes in the documentation of slot.put_into and trace.debug
  • 2010-01-02: Version 1.0.5
    • Changes in net.send_mail{...}
      • Code cleanup
      • A boolean success value is returned
  • 2009-12-25: Version 1.0.4
    • ui.link{...} with POST target can now be parameterized with BOTH content and text to allow HTML content for JavaScript browsers and a text-only version for accessiblity
    • Changes related to database selectors:
      • Support for row-based locking
      • New method :count(), caching and returning the number of rows, which WOULD have been returned by :exec()
      • Bugfix: WHERE and HAVING expressions are now enclosed in parenthesis to avoid problems with operator precedence
    • ui.script{...} now supports external .js files
    • Changes in langtool.lua to cope with escaped new-line chars (\n)
  • 2009-12-10: Version 1.0.3
    • Important bugfix related to internal forwards (Bug was introduced by the restriction of views with underscore prefix in Version 1.0.2)
  • 2009-12-10: Version 1.0.2
    • Fixed bug with explicit garbage collection (requests > 256kB caused an error)
    • Views prefixed with an underscore can't be called externally
    • ui.paginate now displays the last page, if the selected page number is too high.
  • 2009-11-17: Version 1.0.1
    • New feature: JSON requests
    • Changes in ui.paginate: Current page setting is directly fetched from CGI params, instead of view params
    • Changed behavior of load methods of atom library to accept nil as input
    • Bugfixes in mondelefant_atom_connector timestamp(tz) loaders
    • Added global constant _WEBMCP_VERSION containing a version string
  • 2009-10-25: Version 1.0.0