4.6.7 Client

The Client interface represents the device making the request, not the user. The Client object can be retrieved from the PortletRequest object as illustrated in Example 4-5. Figure 4-4 illustrates the result of most of the methods of the client object when requested via Internet Explorer and a Nokia WAP emulator.

Example 4-5 Working with the client object

Client client  = request.getClient();

out.print("<P>Manufacturer: " + client.getManufacturer() + "<br/>");

out.print("MarkupName:" + client.getMarkupName() + "<br/>");

out.print("MimeType   " + client.getMimeType() + "<br/>");

out.print("Model:     " + client.getModel() + "<br/>");

out.print("UserAgent: " + client.getUserAgent() + "<br/>");

out.print("Version:   " + client.getVersion() + "</P>");

Generally, the client object is used to determine the markup language to which the device is mapped. Based on that information, device-specific markup can be generated.

Figure 4-4 Client Information displayed on various clients


Redbooks
ibm.com/redbooks