Class ClientProperties

  • All Implemented Interfaces:
    Serializable, IClusterable

    public class ClientProperties
    extends Object
    implements IClusterable
    Description of various user agent (browser) properties. To fill the properties with values from the user agent you need to probe the browser using javascript and request header analysis. Wicket provides a default implementation of this in BrowserInfoPage.

    A convenient way of letting Wicket do a sneaky redirect to BrowserInfoPage (and back again) is to put this in your Application's init method:

     getRequestCycleSettings().setGatherExtendedBrowserInfo(true);
     

    WARNING: Be sure you think about the dangers of depending on information you pull from the client too much. They may be easily spoofed or inaccurate in other ways, and properties like window and browser size are all too easy to be used naively.

    Author:
    Frank Bille (frankbille)
    See Also:
    BrowserInfoPage, Serialized Form
    • Method Detail

      • getBrowserHeight

        public int getBrowserHeight()
        Returns:
        The browser height at the time it was measured
      • getBrowserWidth

        public int getBrowserWidth()
        Returns:
        The browser width at the time it was measured
      • getNavigatorLanguage

        public String getNavigatorLanguage()
        Returns:
        The client's navigator.language (or navigator.userLanguage) property.
      • getHostname

        public String getHostname()
        Returns:
        The clients hostname shown in the browser
      • getScreenColorDepth

        public int getScreenColorDepth()
        Returns:
        Color depth of the screen in bits (integer).
      • getScreenHeight

        public int getScreenHeight()
        Returns:
        Height of the screen in pixels (integer).
      • getScreenWidth

        public int getScreenWidth()
        Returns:
        Height of the screen in pixels (integer).
      • getTimeZone

        public TimeZone getTimeZone()
        Get the client's time zone if that could be detected.
        Returns:
        The client's time zone
      • getUtcDSTOffset

        public String getUtcDSTOffset()
        Returns:
        The client's time DST offset from UTC in hours (note: if you do this yourself, use 'new Date(new Date().getFullYear(), 0, 6, 0, 0, 0, 0).getTimezoneOffset() / -60' (note the -)).
      • getUtcOffset

        public String getUtcOffset()
        Returns:
        The client's time offset from UTC in hours (note: if you do this yourself, use 'new Date(new Date().getFullYear(), 0, 1, 0, 0, 0, 0).getTimezoneOffset() / -60' (note the -)).
      • isJavaScriptEnabled

        public boolean isJavaScriptEnabled()
        Flag indicating support of JavaScript in the browser.
        Returns:
        True if JavaScript is enabled
      • isNavigatorCookieEnabled

        public boolean isNavigatorCookieEnabled()
        Returns:
        The client's navigator.cookieEnabled property.
      • isNavigatorJavaEnabled

        public boolean isNavigatorJavaEnabled()
        Returns:
        The client's navigator.javaEnabled property.
      • setBrowserHeight

        public void setBrowserHeight​(int browserHeight)
        Parameters:
        browserHeight - The height of the browser
      • setBrowserWidth

        public void setBrowserWidth​(int browserWidth)
        Parameters:
        browserWidth - The browser width
      • setNavigatorCookieEnabled

        public void setNavigatorCookieEnabled​(boolean cookiesEnabled)
        Parameters:
        cookiesEnabled - The client's navigator.cookieEnabled property.
      • setNavigatorJavaEnabled

        public void setNavigatorJavaEnabled​(boolean navigatorJavaEnabled)
        Parameters:
        navigatorJavaEnabled - The client's navigator.javaEnabled property.
      • setNavigatorAppCodeName

        public void setNavigatorAppCodeName​(String navigatorAppCodeName)
        Parameters:
        navigatorAppCodeName - The client's navigator.appCodeName property.
      • setNavigatorAppName

        public void setNavigatorAppName​(String navigatorAppName)
        Parameters:
        navigatorAppName - The client's navigator.appName property.
      • setNavigatorAppVersion

        public void setNavigatorAppVersion​(String navigatorAppVersion)
        Parameters:
        navigatorAppVersion - The client's navigator.appVersion property.
      • setNavigatorLanguage

        public void setNavigatorLanguage​(String navigatorLanguage)
        Parameters:
        navigatorLanguage - The client's navigator.language (or navigator.userLanguage) property.
      • setNavigatorPlatform

        public void setNavigatorPlatform​(String navigatorPlatform)
        Parameters:
        navigatorPlatform - The client's navigator.platform property.
      • setNavigatorUserAgent

        public void setNavigatorUserAgent​(String navigatorUserAgent)
        Parameters:
        navigatorUserAgent - The client's navigator.userAgent property.
      • setRemoteAddress

        public void setRemoteAddress​(String remoteAddress)
        Parameters:
        remoteAddress - The client's remote/ip address.
      • setHostname

        public void setHostname​(String hostname)
        Parameters:
        hostname - the hostname shown in the browser.
      • setScreenColorDepth

        public void setScreenColorDepth​(int screenColorDepth)
        Parameters:
        screenColorDepth - Color depth of the screen in bits (integer).
      • setScreenHeight

        public void setScreenHeight​(int screenHeight)
        Parameters:
        screenHeight - Height of the screen in pixels (integer).
      • setScreenWidth

        public void setScreenWidth​(int screenWidth)
        Parameters:
        screenWidth - Height of the screen in pixels (integer).
      • setTimeZone

        public void setTimeZone​(TimeZone timeZone)
        Sets time zone.
        Parameters:
        timeZone -
      • setUtcOffset

        public void setUtcOffset​(String utcOffset)
        Parameters:
        utcOffset - The client's time offset from UTC in minutes (note: if you do this yourself, use 'new Date().getTimezoneOffset() / -60' (note the -)).
      • setJavaScriptEnabled

        public void setJavaScriptEnabled​(boolean javaScriptEnabled)
        Parameters:
        javaScriptEnabled - is JavaScript supported in the browser
      • read

        public void read​(IRequestParameters parameters)
        Read parameters.
        Parameters:
        parameters - parameters sent from browser