Hardware Reference
In-Depth Information
Global Configuration
There are a small number of configuration files used in the web portion of Minerva to cope with the different
directories structures you might adopt, as detailed in Table 7-1 .
Table 7-1. Web Configuration Directories
Include Filename
Function
Default Directory
Description
minerva.conf
getMinervaRoot
/usr/local/minerva
The base of the Minerva system itself.
system/setup.conf
getURLRoot
/minerva
The name used by Minerva web
components. Can be changed for
protection against bots that attempt
to break any web pages held in
a Minerva-named directory.
system/setup.conf
getPathRoot
/var/www/sites/homecontrol
The filesystem path of the web root.
Used when you need to access files in
the conventional manner.
system/utils.inc
getServerName
Varies. Use this, instead of IP dotted
quad if virtual servers are used.
system/utils.inc
getServerPort
80.
system/utils.inc
getRemotePort
Varies by client.
system/utils.inc
getIPAddress
Determined by client. Might actually
be IP of router.
Applet Configuration
There are two different types of directory you, as an applet writer, need to consider. The first are those that are
used to serve web data to the client, such as images, configuration data, or supplementary files. There are several
methods inside each applet class to retrieve this, each accepting a filename and returning its full path, such as
getConfFileName (taken from the configuration directory), getAppletFileName (the applet code directory), and
getImageURL (the images directory inside the applet folder).
The second type of directory is one that refers to a location in the filesystem and is referenced with
getFilesystemPathStub and concatenated with the relative filename. In reality, any relative web path can be
converted into a filesystem path by joining it with WarpSetup::getPathRoot , but these methods provide a clean way
of writing code.
There is also an intriguing method called getRefreshTime , which causes the current web page (with all its
applets) to automatically reload itself every n seconds. This allows the applet to more easily reflect changes to data
without needing to implement specific push protocols. If more than one applet supports getRefreshTime , then the
shortest time is used. This is provided as an alternative to the use of Ajax (as demonstrated in the Bluetooth, currency,
and recipe applets) that asynchronously responds to requests from the main server. Remember that most browsers
support only two concurrent Ajax requests, so their issue should be staggered with a timeout.
Utilities
Various utility methods are included as part of the applet manager, as well as the individual applet base class itself.
Indeed, there are even full classes that can be derived from to create near-complete applets with very little work.
Warp_Browser_Applet , as used by the MP3 player and video streamer, lets you traverse an entire directory structure
Search WWH ::




Custom Search