com.sas.servlet.util
Class ClientInfo

com.sas.servlet.util.ClientInfo

public class ClientInfo

Bean to access Client Information from within JSP tags and Servlets.


Field Summary
static int HDML_BROWSER
          Handheld Device Markup Language Browser
static java.lang.String HDML_CONTENT_TYPE
          Content types for HDML
static int HTML_BROWSER
          HTML Browser
static java.lang.String HTML_CONTENT_TYPE
          Content types for HTML
static java.lang.String WML_CONTENT_TYPE
          Content types for WML
static int WML_OTHER_BROWSER
          Wireless Markup Language Other Browser (i.e.
static int WML_UP_BROWSER
          Wireless Markup Language UP Browser
 
Constructor Summary
ClientInfo(javax.servlet.http.HttpServletRequest request)
          Constructs a new ClientInfo object and calls the initialize method.
 
Method Summary
 java.lang.String getAccept()
          Gets the HTTP_ACCEPT header
 java.lang.String getBrowserType()
          Gets the browser type.
 java.lang.String getBrowserVersion()
          Gets the browser version
 java.lang.String getUserAgent()
          Gets the browser type
 void initialize()
          Initializes the client info object.
 boolean isHDML()
          Determines if the browser supports HDML
 boolean isInternetExplorer()
          Determines if the browser is Internet Explorer
 boolean isMobile()
          Returns true if the user-agent is thought to be a mobile device.
 boolean isNetscape()
          Determines if the browser is Netscape
 boolean isPalmVII()
          Determines if the browser is PalmVII
 boolean isUP()
          Determines if the browser is UP
 boolean isWML()
          Determines if the browser supports WML
 void setAccept(java.lang.String acceptHeader)
          Sets the HTTP accept header
 void setApplicationSettings(java.util.Properties settings)
          Sets the application's name value pair settings on this client info instance.
 void setBrowserType(java.lang.String browser)
          Sets the browser type
 void setBrowserVersion(java.lang.String version)
          Sets the browser version
 void setUserAgent(java.lang.String agent)
          Sets the browser type
 

Field Detail

WML_UP_BROWSER

public static final int WML_UP_BROWSER
Wireless Markup Language UP Browser

See Also:
Constant Field Values

WML_OTHER_BROWSER

public static final int WML_OTHER_BROWSER
Wireless Markup Language Other Browser (i.e. Nokia)

See Also:
Constant Field Values

HDML_BROWSER

public static final int HDML_BROWSER
Handheld Device Markup Language Browser

See Also:
Constant Field Values

HTML_BROWSER

public static final int HTML_BROWSER
HTML Browser

See Also:
Constant Field Values

WML_CONTENT_TYPE

public static final java.lang.String WML_CONTENT_TYPE
Content types for WML

See Also:
Constant Field Values

HDML_CONTENT_TYPE

public static final java.lang.String HDML_CONTENT_TYPE
Content types for HDML

See Also:
Constant Field Values

HTML_CONTENT_TYPE

public static final java.lang.String HTML_CONTENT_TYPE
Content types for HTML

See Also:
Constant Field Values
Constructor Detail

ClientInfo

public ClientInfo(javax.servlet.http.HttpServletRequest request)
Constructs a new ClientInfo object and calls the initialize method.

Parameters:
request - The request object holds information about the client
Method Detail

initialize

public void initialize()
Initializes the client info object. This includes setting the browser type and determining the browser Version. The value of either of these Strings may be ? if it can not be determined.


setBrowserType

public void setBrowserType(java.lang.String browser)
Sets the browser type

Parameters:
browser - the browser type

setBrowserVersion

public void setBrowserVersion(java.lang.String version)
Sets the browser version

Parameters:
version - the browser version

setUserAgent

public void setUserAgent(java.lang.String agent)
Sets the browser type

Parameters:
agent - the user agent

setAccept

public void setAccept(java.lang.String acceptHeader)
Sets the HTTP accept header

Parameters:
acceptHeader - the HTTP accept header

getBrowserType

public java.lang.String getBrowserType()
Gets the browser type. The following list shows current detectable types:
 AOL
 AvantGo
 Blackberry
 Ericsson
 HotJava
 imode
 Lynx
 Mosaic
 MSIE
 MSPIE
 Netscape
 Nokia
 Opera
 Oracle
 PalmVII
 Prodigy
 UP
 Webster Pro
 WebTV
 WebView
 WAPman
 ? (for unknown type)
 

Returns:
The browser type

getBrowserVersion

public java.lang.String getBrowserVersion()
Gets the browser version

Returns:
The browser version

getUserAgent

public java.lang.String getUserAgent()
Gets the browser type

Returns:
The browser type

getAccept

public java.lang.String getAccept()
Gets the HTTP_ACCEPT header

Returns:
accept header

isInternetExplorer

public boolean isInternetExplorer()
Determines if the browser is Internet Explorer

Returns:
true if the browser is Internet Explorer

isNetscape

public boolean isNetscape()
Determines if the browser is Netscape

Returns:
true if the browser is Netscape

isUP

public boolean isUP()
Determines if the browser is UP

Returns:
true if the browser is UP

isPalmVII

public boolean isPalmVII()
Determines if the browser is PalmVII

Returns:
true if the browser is PalmVII

isWML

public boolean isWML()
Determines if the browser supports WML

Returns:
true if the browser supports WML

isHDML

public boolean isHDML()
Determines if the browser supports HDML

Returns:
true if the browser supports HDML

setApplicationSettings

public void setApplicationSettings(java.util.Properties settings)
Sets the application's name value pair settings on this client info instance. Typically these are obtained for a particular application by the ConfigurationService. One usage of these properties in ClientInfo is in the isMobile() method.

Parameters:
settings - Properties for a SAS application.

isMobile

public boolean isMobile()
Returns true if the user-agent is thought to be a mobile device. This method uses the applicationSettings to determine the regular expressions used to check the user-agent. If no applicationSettings have been set, a default set of expression will be used to determine if mobile.

Returns:
true if a mobile device, false if otherwise



Copyright © 2009 SAS Institute Inc. All Rights Reserved.