KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > container > client > http > HttpClientInfo


1 /***************************************************************************
2  * Copyright 2001-2003 The eXo Platform SARL All rights reserved. *
3  * Please look at license.txt in info directory for more license detail. *
4  **************************************************************************/

5 package org.exoplatform.container.client.http;
6
7 import javax.servlet.http.HttpServletRequest JavaDoc;
8 import org.exoplatform.container.client.ClientInfo;
9 /**
10  * @author Tuan Nguyen (tuan08@users.sourceforge.net)
11  * @since Jan 12, 2005
12  * @version $Id$
13  */

14 public class HttpClientInfo implements ClientInfo {
15   final static public String JavaDoc STANDARD_BROWSER_TYPE = "standard-browser" ;
16   final static public String JavaDoc MOBILE_BROWSER_TYPE = "mobile-browser" ;
17   final static public String JavaDoc PDA_BROWSER_TYPE = "pda-browser" ;
18    
19   private HttpClientType clientType_ ;
20   private String JavaDoc ipAddress_ ;
21   private String JavaDoc remoteUser_ ;
22   
23   public HttpClientInfo(HttpServletRequest JavaDoc request) {
24     clientType_ =
25       ClientTypeMap.getInstance().findClient(request.getHeader("User-Agent")) ;
26     remoteUser_ = request.getRemoteUser() ;
27     ipAddress_ = request.getRemoteAddr() ;
28   }
29   
30   public String JavaDoc getClientType() { return clientType_.getType() ; }
31   
32   public String JavaDoc getRemoteUser() { return remoteUser_ ; }
33   
34   public String JavaDoc getIpAddress() { return ipAddress_ ; }
35
36   public String JavaDoc getClientName() { return clientType_.getName() ; }
37
38   public String JavaDoc getPreferredMimeType() { return clientType_.getPreferredMimeType(); }
39
40   public String JavaDoc getUserAgentPattern() { return clientType_.getPreferredMimeType() ; }
41 }
42
Popular Tags