-
With PAW it is possible to write dynamic web pages which can use the functionality of your phone.
Have a look at the folder /sdcard/paw/html/app on your SD card.
Some of the HTML files contain Beanshell code (enclosed in <bsh></bsh> tags).
Here is an example how to retrieve information of the phone:
String[] opts = { "BOARD", "BRAND", "DISPLAY", "MODEL", "PRODUCT",
"TIME", "TYPE", "USER", "VERSION.INCREMENTAL", "VERSION.RELEASE", "VERSION.SDK"};
for(o : opts) {
print(o + ":" + eval("android.os.Build." + o));
}
You can test this code by pasting it into the BeanShell Console.
-
Using the above example a simple web page could look like this:
<html>
<body>
<bsh>
String[] opts = { "BOARD", "BRAND", "DISPLAY", "MODEL", "PRODUCT",
"TIME", "TYPE", "USER", "VERSION.INCREMENTAL", "VERSION.RELEASE", "VERSION.SDK"};
for(o : opts) {
print("<b>" + o + ":</b>" + eval("android.os.Build." + o) + "<br>");
}
</bsh>
</body>
</html>
-
Brazil sunlabs.brazil.server.Server and sunlabs.brazil.server.Request objects are available on each page.
These can be referenced by server and request.
To retrieve the PAW Android Service object you can use the following code:
service = server.props.get("serviceContext");
-
PAW Server utilizes the Brazil Framework and executes code within web pages by using BeanShell.
The Brazil API and BeanShell documentation can be found in the Documentation area.