Package org.apache.wicket.protocol.http
Class ClientProperties
java.lang.Object
org.apache.wicket.protocol.http.ClientProperties
- All Implemented Interfaces:
Serializable
,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:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
int
int
int
int
Get the client's time zone if that could be detected.boolean
Flag indicating support of JavaScript in the browser.boolean
boolean
void
read
(IRequestParameters parameters) Read parameters.void
setBrowserHeight
(int browserHeight) void
setBrowserWidth
(int browserWidth) void
setHostname
(String hostname) void
setJavaScriptEnabled
(boolean javaScriptEnabled) void
setJsTimeZone
(String jsTimeZone) void
setNavigatorAppCodeName
(String navigatorAppCodeName) void
setNavigatorAppName
(String navigatorAppName) void
setNavigatorAppVersion
(String navigatorAppVersion) void
setNavigatorCookieEnabled
(boolean cookiesEnabled) void
setNavigatorJavaEnabled
(boolean navigatorJavaEnabled) void
setNavigatorLanguage
(String navigatorLanguage) void
setNavigatorPlatform
(String navigatorPlatform) void
setNavigatorUserAgent
(String navigatorUserAgent) void
setRemoteAddress
(String remoteAddress) void
setScreenColorDepth
(int screenColorDepth) void
setScreenHeight
(int screenHeight) void
setScreenWidth
(int screenWidth) void
setTimeZone
(TimeZone timeZone) Sets time zone.void
setUtcDSTOffset
(String utcDSTOffset) void
setUtcOffset
(String utcOffset) toString()
-
Constructor Details
-
ClientProperties
public ClientProperties()
-
-
Method Details
-
getBrowserHeight
- Returns:
- The browser height at the time it was measured
-
getBrowserWidth
- Returns:
- The browser width at the time it was measured
-
getRemoteAddress
- Returns:
- The client's remote/ip address.
-
getHostname
- Returns:
- The clients hostname shown in the browser
-
getScreenColorDepth
- Returns:
- Color depth of the screen in bits (integer).
-
getScreenHeight
- Returns:
- Height of the screen in pixels (integer).
-
getScreenWidth
- Returns:
- Height of the screen in pixels (integer).
-
getTimeZone
Get the client's time zone if that could be detected.- Returns:
- The client's time zone
-
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
- 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
Flag indicating support of JavaScript in the browser.- Returns:
- True if JavaScript is enabled
-
setBrowserHeight
- Parameters:
browserHeight
- The height of the browser
-
setBrowserWidth
- Parameters:
browserWidth
- The browser width
-
setRemoteAddress
- Parameters:
remoteAddress
- The client's remote/ip address.
-
setHostname
- Parameters:
hostname
- the hostname shown in the browser.
-
setScreenColorDepth
- Parameters:
screenColorDepth
- Color depth of the screen in bits (integer).
-
setScreenHeight
- Parameters:
screenHeight
- Height of the screen in pixels (integer).
-
setScreenWidth
- Parameters:
screenWidth
- Height of the screen in pixels (integer).
-
setTimeZone
Sets time zone.- Parameters:
timeZone
-
-
setUtcDSTOffset
- Parameters:
utcDSTOffset
-
-
setUtcOffset
- Parameters:
utcOffset
- The client's time offset from UTC in minutes (note: if you do this yourself, use 'new Date().getTimezoneOffset() / -60' (note the -)).
-
setJsTimeZone
- Parameters:
jsTimeZone
-
-
setJavaScriptEnabled
- Parameters:
javaScriptEnabled
- is JavaScript supported in the browser
-
toString
-
read
Read parameters.- Parameters:
parameters
- parameters sent from browser
-