|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jalios.util.Browser
public class Browser
Analyse the user agent of a http request to determine full information about the client's browser. Can be slow, store in session attribute! Browser Detection: http://www.apptools.com/phptools/browser/source.php Robot detection: http://sitemesh.dev.java.net/
Nested Class Summary | |
---|---|
static class |
Browser.OS
|
Field Summary | |
---|---|
protected static org.apache.oro.text.regex.Pattern |
botPattern
|
static String |
botPatternStr
|
protected String |
browserName
|
protected String |
browserVersion
|
protected boolean |
isAndroid
|
protected boolean |
isBlackberry
|
protected boolean |
isChrome
|
protected boolean |
isChromeFrame
|
protected boolean |
isFirefox
|
protected boolean |
isIE
|
protected boolean |
isIE5
|
protected boolean |
isIE55
|
protected boolean |
isIE6
|
protected boolean |
isIE7
|
protected boolean |
isIE8
|
protected boolean |
isIE9
|
protected boolean |
isIEMobile
|
protected boolean |
isIMode
|
protected boolean |
isIPad
|
protected boolean |
isIPhone
|
protected boolean |
isModernBrowser
|
protected boolean |
isOldBrowser
|
protected boolean |
isOpera
|
protected boolean |
isOperaMini
|
protected boolean |
isRobot
|
protected boolean |
isSafari
|
protected String |
platform
|
static String |
REVISION
|
protected String |
userAgent
All known robot user-agent headers (list can be found here). |
Constructor Summary | |
---|---|
Browser(javax.servlet.http.HttpServletRequest request,
boolean checkRemoteHost)
|
Method Summary | |
---|---|
protected void |
checkDevice(javax.servlet.http.HttpServletRequest request)
|
static boolean |
ereg(String regexp,
String str)
|
static boolean |
eregi(String regexp,
String str)
|
String |
getBrowserName()
|
String |
getBrowserShortName()
|
String |
getBrowserVersion()
|
String |
getDeviceCPU()
|
int |
getDeviceScreenDepth()
|
int |
getDeviceScreenHeight()
|
int |
getDeviceScreenWidth()
|
String |
getPlatform()
|
String |
getUserAgent()
|
static double |
getVersion(String browserVersion)
|
static void |
init(String botPatternStr)
Initialise a Robot pattern matching a given regexp |
boolean |
isAndroid()
|
boolean |
isChrome()
|
boolean |
isChromeFrame()
|
boolean |
isDeviceDescribed()
|
boolean |
isFirefox()
|
boolean |
isIE()
|
boolean |
isIE5()
|
boolean |
isIE55()
|
boolean |
isIE6()
|
boolean |
isIE6Only()
|
boolean |
isIE7()
|
boolean |
isIE8()
|
boolean |
isIE9()
|
boolean |
isIEMobile()
|
boolean |
isIMode()
|
boolean |
isIPad()
|
boolean |
isIPhone()
|
boolean |
isKnownBrowser()
|
boolean |
isModernBrowser()
|
boolean |
isOldBrowser()
|
boolean |
isOpera()
|
boolean |
isOperaMini()
|
boolean |
isPDA()
|
boolean |
isRobot()
|
boolean |
isSafari()
|
boolean |
isSmallDevice()
Returns true if the user-client is hosted on a small device such as a PDA or an i-mode cell phone. |
static void |
main(String[] args)
|
void |
setBrowserName(String browserName)
|
void |
setBrowserVersion(String browserVersion)
|
void |
setFirefox(boolean isFirefox)
|
void |
setIE5(boolean isIE5)
|
void |
setIE55(boolean isIE55)
|
void |
setIMode(boolean isIMode)
|
void |
setModernBrowser(boolean isModernBrowser)
|
void |
setOldBrowser(boolean isOldBrowser)
|
void |
setPlatform(String platform)
|
void |
setRobot(boolean isRobot)
|
void |
setUserAgent(String userAgent)
|
static String |
stristr(String haystack,
String needle)
Return the substring of the given haystack starting from the first occurence of the needle |
boolean |
supportCSS3()
|
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String REVISION
protected String userAgent
NOTE: To avoid bad detection:
protected String platform
protected String browserName
protected String browserVersion
protected boolean isIE
protected boolean isIE9
protected boolean isIE8
protected boolean isIE7
protected boolean isIE6
protected boolean isIE55
protected boolean isIE5
protected boolean isIEMobile
protected boolean isFirefox
protected boolean isOpera
protected boolean isOperaMini
protected boolean isSafari
protected boolean isIPhone
protected boolean isIPad
protected boolean isBlackberry
protected boolean isAndroid
protected boolean isModernBrowser
protected boolean isOldBrowser
protected boolean isChrome
protected boolean isChromeFrame
protected boolean isRobot
protected boolean isIMode
protected static org.apache.oro.text.regex.Pattern botPattern
public static String botPatternStr
Constructor Detail |
---|
public Browser(javax.servlet.http.HttpServletRequest request, boolean checkRemoteHost)
Method Detail |
---|
public static void init(String botPatternStr)
protected void checkDevice(javax.servlet.http.HttpServletRequest request)
public String getDeviceCPU()
public int getDeviceScreenWidth()
public int getDeviceScreenHeight()
public int getDeviceScreenDepth()
public boolean isPDA()
public boolean isSmallDevice()
public boolean isDeviceDescribed()
public static boolean eregi(String regexp, String str)
regexp
- the regexpstr
- the String
public static boolean ereg(String regexp, String str)
regexp
- the regexpstr
- the String
public static String stristr(String haystack, String needle)
haystack
- the Stringneedle
- the first occurence
public static double getVersion(String browserVersion)
public String toString()
toString
in class Object
public static void main(String[] args)
public String getBrowserName()
public void setBrowserName(String browserName)
public String getBrowserVersion()
public void setBrowserVersion(String browserVersion)
public String getBrowserShortName()
public boolean isFirefox()
public void setFirefox(boolean isFirefox)
public boolean isIE()
public boolean isIE5()
public void setIE5(boolean isIE5)
public boolean isIE55()
public void setIE55(boolean isIE55)
public boolean isIE6()
public boolean isIE6Only()
public boolean isIE7()
public boolean isIE9()
public boolean isIE8()
public boolean isIEMobile()
public boolean isChromeFrame()
public boolean isOpera()
public boolean isOperaMini()
public boolean isChrome()
public boolean isSafari()
public boolean isIPhone()
public boolean isIPad()
public boolean isAndroid()
public boolean isModernBrowser()
public void setModernBrowser(boolean isModernBrowser)
public boolean isOldBrowser()
public void setOldBrowser(boolean isOldBrowser)
public boolean isKnownBrowser()
public boolean isRobot()
public void setRobot(boolean isRobot)
public boolean isIMode()
public void setIMode(boolean isIMode)
public String getPlatform()
public void setPlatform(String platform)
public String getUserAgent()
public void setUserAgent(String userAgent)
public boolean supportCSS3()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |