com.atlassian.confluence.util
Class UserAgentUtil

java.lang.Object
  extended by com.atlassian.confluence.util.UserAgentUtil

public class UserAgentUtil
extends Object

Utility class for UserAgents sniffing. Use this class as a last resort when server-side code must be different between browsers.

Since:
4.3.4

Nested Class Summary
static class UserAgentUtil.Browser
           
static class UserAgentUtil.BrowserFamily
           
static class UserAgentUtil.BrowserMajorVersion
           
static class UserAgentUtil.UserAgent
           
 
Constructor Summary
UserAgentUtil()
           
 
Method Summary
static UserAgentUtil.UserAgent getCurrentUserAgent()
          Retrieves the user agent for the current request.
static UserAgentUtil.UserAgent getUserAgentInfo(String userAgent)
          Parses the User-Agent string from the request header and returns user agent data.
static boolean isBrowserFamily(UserAgentUtil.BrowserFamily browserFamily)
          Checks if the current user agent is in the given browser family.
static boolean isBrowserMajorVersion(UserAgentUtil.BrowserMajorVersion browserMajorVersion)
          Checks if the current user agent is part of the browser family and has the major version of the given version
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserAgentUtil

public UserAgentUtil()
Method Detail

isBrowserFamily

public static boolean isBrowserFamily(@NotNull
                                      UserAgentUtil.BrowserFamily browserFamily)
Checks if the current user agent is in the given browser family.

Since:
5.0

isBrowserMajorVersion

public static boolean isBrowserMajorVersion(@NotNull
                                            UserAgentUtil.BrowserMajorVersion browserMajorVersion)
Checks if the current user agent is part of the browser family and has the major version of the given version

Since:
5.0

getCurrentUserAgent

public static UserAgentUtil.UserAgent getCurrentUserAgent()
Retrieves the user agent for the current request. If there is no current request returns a user agent with an unknown browser.

Returns:
UserAgent

getUserAgentInfo

public static UserAgentUtil.UserAgent getUserAgentInfo(String userAgent)
Parses the User-Agent string from the request header and returns user agent data.

Parameters:
userAgent - User-Agent string from the request header
Returns:
UserAgent


Copyright © 2003-2013 Atlassian. All Rights Reserved.