1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portal.kernel.servlet;
24  
25  import javax.servlet.http.HttpServletRequest;
26  
27  /**
28   * <a href="BrowserSnifferUtil.java.html"><b><i>View Source</i></b></a>
29   *
30   * See http://www.zytrax.com/tech/web/browser_ids.htm for examples.
31   *
32   * @author Brian Wing Shun Chan
33   * @author Eduardo Lundgren
34   *
35   */
36  public class BrowserSnifferUtil {
37  
38      public static boolean acceptsGzip(HttpServletRequest request) {
39          return getBrowserSniffer().acceptsGzip(request);
40      }
41  
42      public static String getBrowserId(HttpServletRequest request) {
43          return getBrowserSniffer().getBrowserId(request);
44      }
45  
46      public static BrowserSniffer getBrowserSniffer() {
47          return _browserSniffer;
48      }
49  
50      public static float getMajorVersion(HttpServletRequest request) {
51          return getBrowserSniffer().getMajorVersion(request);
52      }
53  
54      public static String getRevision(HttpServletRequest request) {
55          return getBrowserSniffer().getRevision(request);
56      }
57  
58      public static String getVersion(HttpServletRequest request) {
59          return getBrowserSniffer().getVersion(request);
60      }
61  
62      public static boolean isAir(HttpServletRequest request) {
63          return getBrowserSniffer().isAir(request);
64      }
65  
66      public static boolean isChrome(HttpServletRequest request) {
67          return getBrowserSniffer().isChrome(request);
68      }
69  
70      public static boolean isFirefox(HttpServletRequest request) {
71          return getBrowserSniffer().isFirefox(request);
72      }
73  
74      public static boolean isGecko(HttpServletRequest request) {
75          return getBrowserSniffer().isGecko(request);
76      }
77  
78      public static boolean isIe(HttpServletRequest request) {
79          return getBrowserSniffer().isIe(request);
80      }
81  
82      public static boolean isIphone(HttpServletRequest request) {
83          return getBrowserSniffer().isIphone(request);
84      }
85  
86      public static boolean isLinux(HttpServletRequest request) {
87          return getBrowserSniffer().isLinux(request);
88      }
89  
90      public static boolean isMac(HttpServletRequest request) {
91          return getBrowserSniffer().isMac(request);
92      }
93  
94      public static boolean isMobile(HttpServletRequest request) {
95          return getBrowserSniffer().isMobile(request);
96      }
97  
98      public static boolean isMozilla(HttpServletRequest request) {
99          return getBrowserSniffer().isMozilla(request);
100     }
101 
102     public static boolean isOpera(HttpServletRequest request) {
103         return getBrowserSniffer().isOpera(request);
104     }
105 
106     public static boolean isRtf(HttpServletRequest request) {
107         return getBrowserSniffer().isRtf(request);
108     }
109 
110     public static boolean isSafari(HttpServletRequest request) {
111         return getBrowserSniffer().isSafari(request);
112     }
113 
114     public static boolean isSun(HttpServletRequest request) {
115         return getBrowserSniffer().isSun(request);
116     }
117 
118     public static boolean isWap(HttpServletRequest request) {
119         return getBrowserSniffer().isWap(request);
120     }
121 
122     public static boolean isWapXhtml(HttpServletRequest request) {
123         return getBrowserSniffer().isWapXhtml(request);
124     }
125 
126     public static boolean isWebKit(HttpServletRequest request) {
127         return getBrowserSniffer().isWebKit(request);
128     }
129 
130     public static boolean isWindows(HttpServletRequest request) {
131         return getBrowserSniffer().isWindows(request);
132     }
133 
134     public static boolean isWml(HttpServletRequest request) {
135         return getBrowserSniffer().isWml(request);
136     }
137 
138     public void setBrowserSniffer(BrowserSniffer browserSniffer) {
139         _browserSniffer = browserSniffer;
140     }
141 
142     private static BrowserSniffer _browserSniffer;
143 
144 }