MobileAware Interaction Server User Guide
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
To access the MobileAware proprietary database set, you must use the MobileAware Interaction Server Delivery Context API. The following code block shows how this is done.
<%@ taglib uri="mmJSPtaglib" prefix="mm" %>
<mm:page content="false">
<%@ page import="com.mobileaware.deliverycontext.*" %>
<%
DeliveryContext dc = null;
String deviceName = null;
String imgList = null;
%>
<html>
<head>
<title>MA Delivery Context API</title>
<mm:structure id="st_101" where="IsMenuDriven">
<mm:group-ref idref="gp_101" depth="flat" type="normal" display="all"/>
</mm:structure>
</head>
<body>
<%
try {
dc = DeliveryContextFactory.getDeliveryContext(request);
} catch(Exception e) {
out.println("<p>Problem creating delivery context.</p>");
}
%>
<mm:group id="gp_101" title="Details">
<%
try{
deviceName= dc.getAttribute("DeviceName");
imgList = dc.getAttribute("ImgTypePref");
}
catch(Exception e){System.out.println(e);}
%>
<p>I am a <%=deviceName%>.</p>
<p>I accept images that are: <%=imgList%></p>
</mm:group>
</body>
</html>
</mm:page>
The results when accessing MobileAware attributes of a WML emulator are shown below.
Image Courtesy of Openwave Systems Inc
There are a number of public methods that can be used to access the MobileAware Device Database device attributes.
The methods listed here have either one or two parameters: an attribute name or an attribute name and a default value to return in the event that no value is available.
GetIntAttributes("MaxWapDeckSize");
GetIntAttribute("MaxWapDeckSize", 1400);
There are four exceptions that can be thrown when using the methods listed in the table above. It is considered good practice to place try - catch blocks around these method calls.
Thrown when an unexpected condition causes DeliveryContext creation or method to fail. The exception message describes the problem, such as "invalid ServletRequest Object".
Thrown when a type-specific method is called on an attribute of the wrong type. For example, using getBooleanAttribute() to obtain a String value.
Thrown when an attribute name is requested and that attribute does not exist. This is different from the attribute existing and not having a value defined for the requesting device.
Thrown when an attribute name is requested but the attribute value does not exist.
Note: The MobileAware Delivery Context API is able to access both the CC/PP attrbutes and the proprietary set.
![]() ![]() |
![]() |
![]() |