org.apache.velocity.tools.view
Class BrowserTool
java.lang.Object
org.apache.velocity.tools.generic.SafeConfig
org.apache.velocity.tools.generic.LocaleConfig
org.apache.velocity.tools.generic.FormatConfig
org.apache.velocity.tools.view.BrowserTool
- All Implemented Interfaces:
- java.io.Serializable
- Direct Known Subclasses:
- BrowserSnifferTool
@DefaultKey(value="browser")
@InvalidScope(value="application")
public class BrowserTool
- extends FormatConfig
- implements java.io.Serializable
browser-sniffing tool (session or request scope requested, session scope advised).
Usage:
BrowserTool defines properties that are used to test the client browser, operating system, device, language...
Apart from properties related to browser version and language, all properties are booleans.
The following properties are available:
- Versioning:version majorVersion minorVersion geckoVersion
- Browser:mosaic netscape nav2 nav3 nav4 nav4up nav45 nav45up nav6 nav6up navgold firefox safari
ie ie3 ie4 ie4up ie5 ie5up ie55 ie55up ie6 ie6up ie7 ie7up ie8 ie8up opera opera3 opera4 opera5 opera6 opera7 opera8 opera9 lynx links w3m
aol aol3 aol4 aol5 aol6 neoplanet neoplanet2 amaya icab avantgo emacs mozilla gecko webtv staroffice java hotjava httpclient lobo
lotusnotes konqueror galeon kmeleon chrome
- Operating systems:win16 win3x win31 win95 win98 winnt windows win32 winme win2k winxp vista dotnet
mac macosx mac68k macppc os2 unix sun sun4 sun5 suni86 irix irix5 irix6 hpux hpux9 hpux10 aix aix1 aix2 aix3 aix4
linux sco unixware mpras reliant dec sinix freebsd bsd vms x11 amiga
- Devices:palm audrey iopener wap blackberry
- Features:javascript css css1 css2 dom0 dom1 dom2
- Special:robot (true if the page is requested by a robot, i.e. when one of the following properties is true:
wget getright yahoo altavista lycos infoseek lwp webcrawler linkexchange slurp google java)
- Language: preferredLanguageTag (a string like 'en', 'da', 'en-US', ...), preferredLocale (a java Locale)
Language properties are filtered by the languagesFilter tool param, if present. If no matching language is found, or if there is no
matching language, the tools defaut locale (or the first value of languagesFilter) is returned.
Their value is guarantied to belong to the set provided in languagesFilter, if any.
Thanks to Lee Semel (lee@semel.net), the author of the HTTP::BrowserDetect Perl module.
See also:
* http://www.zytrax.com/tech/web/browser_ids.htm
* http://en.wikipedia.org/wiki/User_agent
* http://www.user-agents.org/
- Since:
- VelocityTools 2.0
- Version:
- $Revision$ $Date$
- Author:
- Claude Brisson
- See Also:
- Serialized Form
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
LOG
protected org.apache.velocity.runtime.log.Log LOG
userAgent
private java.lang.String userAgent
version
private java.lang.String version
majorVersion
private int majorVersion
minorVersion
private int minorVersion
geckoVersion
private java.lang.String geckoVersion
geckoMajorVersion
private int geckoMajorVersion
geckoMinorVersion
private int geckoMinorVersion
genericVersion
private static java.util.regex.Pattern genericVersion
firefoxVersion
private static java.util.regex.Pattern firefoxVersion
ieVersion
private static java.util.regex.Pattern ieVersion
safariVersion
private static java.util.regex.Pattern safariVersion
mozillaVersion
private static java.util.regex.Pattern mozillaVersion
fallbackVersion
private static java.util.regex.Pattern fallbackVersion
acceptLanguage
private java.lang.String acceptLanguage
languageRangesByQuality
private java.util.SortedMap<java.lang.Float,java.util.List<java.lang.String>> languageRangesByQuality
starLanguageRange
private java.lang.String starLanguageRange
languagesFilter
private java.util.List<java.lang.String> languagesFilter
preferredLanguage
private java.lang.String preferredLanguage
quality
private static java.util.regex.Pattern quality
BrowserTool
public BrowserTool()
setRequest
public void setRequest(javax.servlet.http.HttpServletRequest request)
- Retrieves the User-Agent header from the request (if any).
- See Also:
setUserAgent(java.lang.String)
setLog
public void setLog(org.apache.velocity.runtime.log.Log log)
- Set log.
setUserAgent
public void setUserAgent(java.lang.String ua)
- Sets the User-Agent string to be parsed for info. If null, the string
will be empty and everything will return false or null. Otherwise,
it will set the whole string to lower case before storing to simplify
parsing.
setAcceptLanguage
public void setAcceptLanguage(java.lang.String al)
setLanguagesFilter
public void setLanguagesFilter(java.lang.String filter)
getLanguagesFilter
public java.lang.String getLanguagesFilter()
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
get
public boolean get(java.lang.String key)
getUserAgent
public java.lang.String getUserAgent()
getAcceptLanguage
public java.lang.String getAcceptLanguage()
getVersion
public java.lang.String getVersion()
getMajorVersion
public int getMajorVersion()
getMinorVersion
public int getMinorVersion()
getGeckoVersion
public java.lang.String getGeckoVersion()
getGeckoMajorVersion
public int getGeckoMajorVersion()
getGeckoMinorVersion
public int getGeckoMinorVersion()
getGecko
public boolean getGecko()
getFirefox
public boolean getFirefox()
getIceweasel
public boolean getIceweasel()
getGaleon
public boolean getGaleon()
getKmeleon
public boolean getKmeleon()
getEpiphany
public boolean getEpiphany()
getSafari
public boolean getSafari()
getChrome
public boolean getChrome()
getDillo
public boolean getDillo()
getNetscape
public boolean getNetscape()
getNav2
public boolean getNav2()
getNav3
public boolean getNav3()
getNav4
public boolean getNav4()
getNav4up
public boolean getNav4up()
getNav45
public boolean getNav45()
getNav45up
public boolean getNav45up()
getNavgold
public boolean getNavgold()
getNav6
public boolean getNav6()
getNav6up
public boolean getNav6up()
getMozilla
public boolean getMozilla()
getIe
public boolean getIe()
getIe3
public boolean getIe3()
getIe4
public boolean getIe4()
getIe4up
public boolean getIe4up()
getIe5
public boolean getIe5()
getIe5up
public boolean getIe5up()
getIe55
public boolean getIe55()
getIe55up
public boolean getIe55up()
getIe6
public boolean getIe6()
getIe6up
public boolean getIe6up()
getIe7
public boolean getIe7()
getIe7up
public boolean getIe7up()
getIe8
public boolean getIe8()
getIe8up
public boolean getIe8up()
getNeoplanet
public boolean getNeoplanet()
getNeoplanet2
public boolean getNeoplanet2()
getAol
public boolean getAol()
getAol3
public boolean getAol3()
getAol4
public boolean getAol4()
getAol5
public boolean getAol5()
getAol6
public boolean getAol6()
getAolTV
public boolean getAolTV()
getOpera
public boolean getOpera()
getOpera3
public boolean getOpera3()
getOpera4
public boolean getOpera4()
getOpera5
public boolean getOpera5()
getOpera6
public boolean getOpera6()
getOpera7
public boolean getOpera7()
getOpera8
public boolean getOpera8()
getOpera9
public boolean getOpera9()
getHotjava
public boolean getHotjava()
getHotjava3
public boolean getHotjava3()
getHotjava3up
public boolean getHotjava3up()
getLobo
public boolean getLobo()
getHttpclient
public boolean getHttpclient()
getAmaya
public boolean getAmaya()
getCurl
public boolean getCurl()
getStaroffice
public boolean getStaroffice()
getIcab
public boolean getIcab()
getLotusnotes
public boolean getLotusnotes()
getKonqueror
public boolean getKonqueror()
getLynx
public boolean getLynx()
getLinks
public boolean getLinks()
getW3m
public boolean getW3m()
getWebTV
public boolean getWebTV()
getMosaic
public boolean getMosaic()
getWget
public boolean getWget()
getGetright
public boolean getGetright()
getLwp
public boolean getLwp()
getYahoo
public boolean getYahoo()
getGoogle
public boolean getGoogle()
getJava
public boolean getJava()
getAltavista
public boolean getAltavista()
getScooter
public boolean getScooter()
getLycos
public boolean getLycos()
getInfoseek
public boolean getInfoseek()
getWebcrawler
public boolean getWebcrawler()
getLinkexchange
public boolean getLinkexchange()
getSlurp
public boolean getSlurp()
getRobot
public boolean getRobot()
getBlackberry
public boolean getBlackberry()
getAudrey
public boolean getAudrey()
getIopener
public boolean getIopener()
getAvantgo
public boolean getAvantgo()
getPalm
public boolean getPalm()
getWap
public boolean getWap()
getWin16
public boolean getWin16()
getWin3x
public boolean getWin3x()
getWin31
public boolean getWin31()
getWin95
public boolean getWin95()
getWin98
public boolean getWin98()
getWinnt
public boolean getWinnt()
getWin2k
public boolean getWin2k()
getWinxp
public boolean getWinxp()
getVista
public boolean getVista()
getDotnet
public boolean getDotnet()
getWinme
public boolean getWinme()
getWin32
public boolean getWin32()
getWindows
public boolean getWindows()
getMac
public boolean getMac()
getMacosx
public boolean getMacosx()
getMac68k
public boolean getMac68k()
getMacppc
public boolean getMacppc()
getAmiga
public boolean getAmiga()
getEmacs
public boolean getEmacs()
getOs2
public boolean getOs2()
getSun
public boolean getSun()
getSun4
public boolean getSun4()
getSun5
public boolean getSun5()
getSuni86
public boolean getSuni86()
getIrix
public boolean getIrix()
getIrix5
public boolean getIrix5()
getIrix6
public boolean getIrix6()
getHpux
public boolean getHpux()
getHpux9
public boolean getHpux9()
getHpux10
public boolean getHpux10()
getAix
public boolean getAix()
getAix1
public boolean getAix1()
getAix2
public boolean getAix2()
getAix3
public boolean getAix3()
getAix4
public boolean getAix4()
getLinux
public boolean getLinux()
getSco
public boolean getSco()
getUnixware
public boolean getUnixware()
getMpras
public boolean getMpras()
getReliant
public boolean getReliant()
getDec
public boolean getDec()
getSinix
public boolean getSinix()
getFreebsd
public boolean getFreebsd()
getBsd
public boolean getBsd()
getX11
public boolean getX11()
getUnix
public boolean getUnix()
getVMS
public boolean getVMS()
getCss
public boolean getCss()
getCss1
public boolean getCss1()
getCss2
public boolean getCss2()
getDom0
public boolean getDom0()
getDom1
public boolean getDom1()
getDom2
public boolean getDom2()
getJavascript
public boolean getJavascript()
getPreferredLanguage
public java.lang.String getPreferredLanguage()
getPreferredLocale
public java.util.Locale getPreferredLocale()
test
private boolean test(java.lang.String key)
parseVersion
private void parseVersion()
parseAcceptLanguage
private void parseAcceptLanguage()
filterLanguageTag
private java.lang.String filterLanguageTag(java.lang.String languageTag)
Copyright (c) 2003-2007 Apache Software Foundation