A user agent is an application which is used to browse through the World Wide Web. Web user agents can be web browsers and search engine spiders as well as accessibility products like screen readers and braille browsers.
The user agent provides information about itself, when a web site is accessed. The information contains the brand and version of the browser and the operating system the browser is running on.
User agent
Internet Explorer 5.5 running on MS Windows 2000
Provided information
Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0).
To use the user agent service you have to add a sharing reference entry to the deployment descriptor (file portalapp.xml) in the section <application-config>.
The entry has following format:
<application-config>
<property name="SharingReference" value="com.sap.portal.useragent"/>
.
</application-config>
When you use another service or services in the portal application, you separate the services by a comma.
Example
value="htmlb,com.sap.portal.useragent"
The entry point of the user agent service is the interface IUserAgentService. You get this interface from the Portal Runtime (PRT) with following command:
IUserAgentService userAgentService = |
To get the user agent, you have to get the user agent name first. With the user agent name and the user agent service you get the user agent from the HttpServletRequest object. You can use the following commands:
HttpServletRequest sRequest = request.getServletRequest(); |
For more details about the usage of the userAgent methods refer to the PDK.
The user agent service also provides information about the user agent family with interface IUserAgentService. This interface provides the method getUserAgentFamily() that delivers the information. You get this interface with the following commands:
IUserAgentFamily userAgentFamily = |