IBM websphere supports client profile information in portlets which is defined in JSR188 (https://jcp.org/en/jsr/detail?id=188)
You can check if client request is coming from mobile/tablet or from desktop and redirect to different view accordingly with following sample code
String VIEW_JSP =
"desktopView";
javax.ccpp.Profile
profile = (javax.ccpp.Profile) portletRequest.getAttribute("javax.portlet.ccpp");
javax.ccpp.Attribute
attr = profile.getAttribute("DeviceClass");
if(attr!=null
&& attr.toString().equals("tablet")){
VIEW_JSP
= "tabletView";
}else if(attr!=null
&& attr.toString().equals("smartphone")){
VIEW_JSP
= "mobileView";
}
NOTE:
- DeviceClass=smartphone/tablet
- Vendor=Apple/Samsung ..etc
No comments:
Post a Comment