Leon Framework 0.2 documentation

Configuration

«  Logging   ::   Contents   ::   Java Interoperability  »

Configuration

TODO

install(module)

Installs additional Leon modules.

Arguments:
  • module (Module) – The module to install. (e.g. new Packages.io.leon.persistence.mongo.LeonMongoModule())
setBaseDir(baseDir)

Sets the base directory of the application. All relative locations are relative to this directory.

Arguments:
  • baseDir (string) – Default value is the location of the configuration file.

Resources

addLocation(path)

Adds a directory where Leon should lookup resources.

Arguments:
  • path (string) – Relative paths are relative to the base directory.
exposeUrl(regex)

Exposes paths that match the given regular expression to clients.

By default, Leon gives client access to the following paths/files: *.html, *.png, *.jpg, *.gif, *.css, favicon.ico, */browser/*.js, */browser/*.json. To allow access on other paths or files to clients, you have to expose them by calling this function.

Arguments:
  • regex (string) – Regular expression to match.
loadFile(fileName)

Loads JavaScript files in the server environment.

Arguments:
  • fileName (string) – A server-side JavaScript file to load. The path must be relative to a registered location or to the application’s classpath.

AJAX-Support

browser(browserName).linksToServer([serverName])

Makes a server-side object accessible by clients via AJAX.

Arguments:
  • browserName (string) – Name of the client-side variable.
  • serverName (string) – Variable name of the server-side object. If not given, serverName is the same as browser name.
browser(browserName).linksToServer(clazz)

Makes Java objects directly accessible by clients via AJAX.

Arguments:
  • browserName (string) – Name of the client-side variable.
  • clazz (Class) – Java class on the server-side.

Dependency injection

bind(clazz)

TODO: Registers a binding in google guice. See Google Guice Binder for more information about how to use bindings.

Arguments:
  • clazz (Class) – The Java class to bind.

«  Logging   ::   Contents   ::   Java Interoperability  »