Flipkart Search

Sunday, 3 March 2013

get user's details / Browser's details in Oracle ADF

        RequestContext rCtx = RequestContext.getCurrentInstance();
        FacesContext fctx=FacesContext.getCurrentInstance();
        Agent agnt = rCtx.getAgent();
  1.         //Get user's Browser's engine name
        String browser = agnt.getAgentName();

     2.   //Get user's Browser's engine version
        String browser_version = agnt.getAgentVersion();

    3. //Get user's IP address
        String userIpAddress =                      ((HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest()).getRemoteAddr();
     4.   //Get user's Platform
        String platform = agnt.getPlatformName();
      
      5. //Get user's Platform's version
        String platformVersion = agnt.getPlatformVersion();
        Map reqHeader=
FacesContext.getCurrentInstance().getExternalContext().getRequestHeaderMap();
     6. // Get the User agent
 System.out.println(reqHeader.get("User-Agent"));