Package com.atlassian.confluence.util
Class UserAgentUtil
java.lang.Object
com.atlassian.confluence.util.UserAgentUtil
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
Nested ClassesModifier and TypeClassDescriptionstatic class
static enum
static enum
static class
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic UserAgentUtil.UserAgent
Retrieves the user agent for the current request.static @Nullable String
getUserAgent
(javax.servlet.http.HttpServletRequest request) Retrieves the user agent of the http servlet request.static UserAgentUtil.UserAgent
getUserAgentInfo
(String userAgent) Parses the User-Agent string from the request header and returns user agent data.static boolean
isBrowserFamily
(@NonNull UserAgentUtil.BrowserFamily browserFamily) Checks if the current user agent is in the given browser family.static boolean
isBrowserMajorVersion
(@NonNull UserAgentUtil.BrowserMajorVersion browserMajorVersion) Checks if the current user agent is part of the browser family and has the major version of the given version
-
Constructor Details
-
UserAgentUtil
public UserAgentUtil()
-
-
Method Details
-
isBrowserFamily
Checks if the current user agent is in the given browser family.- Since:
- 5.0
-
isBrowserMajorVersion
public static boolean isBrowserMajorVersion(@NonNull 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
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
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
-
getUserAgent
Retrieves the user agent of the http servlet request.- Returns:
- user agent
-