Running an Application in HTTP Mode
In AVRO, running an application in HTTP mode involves initializing the main addon and handling HTTP requests through defined actions.

Application Runtime Schema in HTTP Mode
The run() method of the application object is responsible for initializing the main addon. It is called once by the framework loader at startup.
Hooks are functions that are called by the framework before the application code starts to run. This allows you to execute global initializations, such as defining database connection values (path, login, password, etc.).
Application Object Methods for HTTP Mode
All these methods can be called through $this->app:
string action()
Returns the name of the method (without any prefix) that will be invoked within the main addon.
Example:
If the requested URL is:
https://example.com/test/show_form/some_item/some_value
Executing:
$action = $this->app->action();
Will set $action to 'show_form'.
Methods in addon classes are accessible from an HTTP request only if they are defined with special prefixes:
// 'action_' prefix for standard HTTP requests
public function action_show_form() {
// ...
}
// 'action_ax_' prefix for Ajax requests
public function action_ax_show_form() {
// ...
}
Any other method defined in an addon class can't be accessed via an external request and can therefore be considered as private to the application.
string alias()
Returns the alias name if defined or an empty string otherwise.
$alias = $this->app->alias();
array allowed_languages([string $lp])
Returns an array containing the application's allowed languages for HTTP mode as defined in the /application/config/application.ini configuration file's [HTTP] section when called without parameters.
$allowed_languages = $this->app->allowed_languages();
When called with a language prefix parameter, it will return the language name.
// Get language by prefix
$en = $this->app->allowed_languages('en');
The result will be 'English'.
string app_url()
Returns the URL of the application instance, including the path where it resides.
Example:
If the web server document root is located in /var/www/html and the application directory is located in /var/www/html/application/, then:
$app_url = $this->app->app_url();
Will set $app_url to 'http://example.com/application/'.
bool cached_output()
Returns true if the HTML page content could be retrieved from the cache and was loaded in the output buffer.
$is_cached = $this->app->cached_output();
void error_404([string $message = NULL, string $file = NULL, int $line = NULL])
Redirects to the "Error 404 - Page not found" page. In this case, the application will send an actual 404-header status.
$this->app->error_404('Invalid ID', __FILE__, __LINE__);
$this->app->error_404('Article not found');
string get_template()
Returns the name of the template for the main addon.
$template = $this->app->get_template();