Taking Notez – Island Pond Consulting

Notes from My Work with Salesforce and Cloud Technologies

Posts Tagged ‘WebSphere Portal 7

Getting to Know the Browser: Working with Client Profile Information in Portlets

leave a comment »

WebSphere Portal supports the integration of data from disparate systems in order to manage and deliver it to clients. How users experience this content continues to vary depending on the user’s browser. To assist in content delivery, WebSphere Portal provides an API named “CC/PP” that presents a profile of the user’s browser through a request attribute.

To work with this profile you will need to import two objects:
javax.ccpp.Attribute and javax.ccpp.Profile

As an example consider the following:

Profile clientProfile = (Profile) portletRequest.getAttribute(PortletRequest.CCPP_PROFILE);
// By getting an instance of a Profile named clientProfile we can then extract
// one of the members of the profile such as manufacturer of the browser, Vendor.

String vendor null;

if (clientProfile != null) {
Attribute attribute = clientProfile.getAttribute(“Vendor”);
if (attribute != null) {
vendor = attribute.toString();
}
}

// Now that you know the Vendor you can do something interesting.

What are some other members of the profile?
The browser name, version, markup supported, style sheet support, etc.

You may ask why we shouldn’t handle this in JavaScript? One reason I can think of right away is mobile access.
The volume of information to push to the mobile browser can be significantly reduced by determining the markup (JSP) before rendering the page for the client.

Written by David Wilkerson

April 10, 2012 at 4:06 pm