!--a11y-->
Use
The device recognition mechanism in the Java Servlet Engine environment ascertains the device type from the HTTP request and enables access to the special properties and capabilities of the mobile device.
Implementing the device recognition process
The
ClientInfo Interface offers a range of methods that investigate the different display capabilities of different browser types. The values of the device properties provided by SAP for a variety of available devices are stored in XML files on the Java-enabled Web server.The device properties of a specific device type are made available in a XML file with the extension .cap. This XML file contains all the properties of the mobile device that provide information on its capabilities, along with properties for which SAP proposes default values for a specific device.
The .cap XML files for all the device types entered by SAP are stored on the Java-enabled Web server. They allow system administrators to perform the following tasks within the device recognition process:

The XML files are stored in <Root_Directory>/mobile.
When the Java Servlet Container is launched, the ClientInfoInitializer servlet is executed. This servlet loads the data from the XML file and stores the Java tables for the device properties in the Web server’s memory. It thus provides access to the special values of the properties of the requesting mobile device.
Using the device type information sent in the HTTP request, the system selects the entry appropriate to the requesting device type from the table This allows the values for this device to be ascertained and made available at runtime when a Java application is launched.
In this way, you can use the methods of the
ClientInfo interface when you create Java applications, and thus take the characteristics of mobile devices into account when developing Web applications.You can use the following source code fragments to access the
ClientInfo interface and device recognition mechanism:ClientInfoFactory factory = ClientInfoFactory.newInstance();
ClientInfo clientInfo = factory.newClientInfo();
clientInfo.load(request);
if(clientInfo.isTitleSupported())
// do sth if title is supported
...
else
// do sth if title is not supported
In these fragments, an implementation of the
ClientInfo interface is instantiated and returned as the ClientInfo interface. The newClientInfo method of the ClientInfoFactory class returns the class implemented using the ClientInfo interface. This is specified as the ClientInfoImpl in the Deployment Descriptor web.xml.
You can, however, develop your own implementation for the
(See also
The Deployment Descriptor).The following graphic shows the device recognition process schematically within the Java-enabled Web server.
