|
Actions Every request a Helma application receives is handled by an "action" associated with the requested URL. For example, a request to http://localhost:8080/example will be handled by the "example" action. The "welcome" application defines such an action at ./apps/welcome/code/Root/example.hac
res.write('Hello, this is the action defined \
at ./apps/welcome/code/Root/example.hac');
The file example.hac contains the Javascript code that Helma will evaluate when handling that request. In this example, the code inside the example.hac file automatically becomes a prototype method with an "_action" suffix. By leveraging such conventions, Helma allows you to structure your code in clean and uncluttered ways. Alternatively, you can also define actions in generic Javascript files, an examples of which can be found in ./apps/welcome/code/Root/example.js and tested via the URL http://localhost:8080/anotherexample
function anotherexample_action() {
res.write('Hello again, this is the action \
defined in ./apps/welcome/Root/example.js');
}
Requests that do not specify a particular action are handled by the "main" action. For example, a request to http://localhost:8080/ will be handled by the "main" action, defined at ./apps/welcome/code/Guide/main.hacMore information about the way Helma handles requests and maps them to actions, and how Helma maps directories and filename extensions to objects in the Javascript environment: /docs/guide/framework/
... comment
|
navigation
Download
Community
Weblog
Mailing Lists
IRC Channel
Documentation
Introductions
Tools
Reference
Project
Roadmap
Bug Reporting
Source
Wiki
Tags
Updates
Related Projects
search
|
||||