org.apache.velocity.tools.view
Class BrowserTool

java.lang.Object
  extended by 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 java.lang.Object
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... Apart from properties related to versioning, all properties are booleans.

The following properties are available:

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

Field Summary
private  int geckoMajorVersion
           
private  int geckoMinorVersion
           
private  java.lang.String geckoVersion
           
private  int majorVersion
           
private  int minorVersion
           
private static long serialVersionUID
           
private  java.lang.String userAgent
           
private  java.lang.String version
           
 
Constructor Summary
BrowserTool()
           
 
Method Summary
 boolean get(java.lang.String key)
           
 boolean getAix()
           
 boolean getAix1()
           
 boolean getAix2()
           
 boolean getAix3()
           
 boolean getAix4()
           
 boolean getAltavista()
           
 boolean getAmaya()
           
 boolean getAmiga()
           
 boolean getAol()
           
 boolean getAol3()
           
 boolean getAol4()
           
 boolean getAol5()
           
 boolean getAol6()
           
 boolean getAolTV()
           
 boolean getAudrey()
           
 boolean getAvantgo()
           
 boolean getBlackberry()
           
 boolean getBsd()
           
 boolean getChrome()
           
 boolean getCss()
           
 boolean getCss1()
           
 boolean getCss2()
           
 boolean getCurl()
           
 boolean getDec()
           
 boolean getDillo()
           
 boolean getDom0()
           
 boolean getDom1()
           
 boolean getDom2()
           
 boolean getDotnet()
           
 boolean getEmacs()
           
 boolean getEpiphany()
           
 boolean getFirefox()
           
 boolean getFreebsd()
           
 boolean getGaleon()
           
 boolean getGecko()
           
 int getGeckoMajorVersion()
           
 int getGeckoMinorVersion()
           
 java.lang.String getGeckoVersion()
           
 boolean getGetright()
           
 boolean getGoogle()
           
 boolean getHotjava()
           
 boolean getHotjava3()
           
 boolean getHotjava3up()
           
 boolean getHpux()
           
 boolean getHpux10()
           
 boolean getHpux9()
           
 boolean getHttpclient()
           
 boolean getIcab()
           
 boolean getIceweasel()
           
 boolean getIe()
           
 boolean getIe3()
           
 boolean getIe4()
           
 boolean getIe4up()
           
 boolean getIe5()
           
 boolean getIe55()
           
 boolean getIe55up()
           
 boolean getIe5up()
           
 boolean getIe6()
           
 boolean getIe6up()
           
 boolean getIe7()
           
 boolean getIe7up()
           
 boolean getIe8()
           
 boolean getIe8up()
           
 boolean getInfoseek()
           
 boolean getIopener()
           
 boolean getIrix()
           
 boolean getIrix5()
           
 boolean getIrix6()
           
 boolean getJava()
           
 boolean getJavascript()
           
 boolean getKmeleon()
           
 boolean getKonqueror()
           
 boolean getLinkexchange()
           
 boolean getLinks()
           
 boolean getLinux()
           
 boolean getLobo()
           
 boolean getLotusnotes()
           
 boolean getLwp()
           
 boolean getLycos()
           
 boolean getLynx()
           
 boolean getMac()
           
 boolean getMac68k()
           
 boolean getMacosx()
           
 boolean getMacppc()
           
 int getMajorVersion()
           
 int getMinorVersion()
           
 boolean getMosaic()
           
 boolean getMozilla()
           
 boolean getMpras()
           
 boolean getNav2()
           
 boolean getNav3()
           
 boolean getNav4()
           
 boolean getNav45()
           
 boolean getNav45up()
           
 boolean getNav4up()
           
 boolean getNav6()
           
 boolean getNav6up()
           
 boolean getNavgold()
           
 boolean getNeoplanet()
           
 boolean getNeoplanet2()
           
 boolean getNetscape()
           
 boolean getOpera()
           
 boolean getOpera3()
           
 boolean getOpera4()
           
 boolean getOpera5()
           
 boolean getOpera6()
           
 boolean getOpera7()
           
 boolean getOpera8()
           
 boolean getOpera9()
           
 boolean getOs2()
           
 boolean getPalm()
           
 boolean getReliant()
           
 boolean getRobot()
           
 boolean getSafari()
           
 boolean getSco()
           
 boolean getScooter()
           
 boolean getSinix()
           
 boolean getSlurp()
           
 boolean getStaroffice()
           
 boolean getSun()
           
 boolean getSun4()
           
 boolean getSun5()
           
 boolean getSuni86()
           
 boolean getUnix()
           
 boolean getUnixware()
           
 java.lang.String getUserAgent()
           
 java.lang.String getVersion()
           
 boolean getVista()
           
 boolean getVMS()
           
 boolean getW3m()
           
 boolean getWap()
           
 boolean getWebcrawler()
           
 boolean getWebTV()
           
 boolean getWget()
           
 boolean getWin16()
           
 boolean getWin2k()
           
 boolean getWin31()
           
 boolean getWin32()
           
 boolean getWin3x()
           
 boolean getWin95()
           
 boolean getWin98()
           
 boolean getWindows()
           
 boolean getWinme()
           
 boolean getWinnt()
           
 boolean getWinxp()
           
 boolean getX11()
           
 boolean getYahoo()
           
private  void parseVersion()
           
 void setRequest(javax.servlet.http.HttpServletRequest request)
          Retrieves the User-Agent header from the request (if any).
 void setUserAgent(java.lang.String ua)
          Sets the User-Agent string to be parsed for info.
private  boolean test(java.lang.String key)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

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
Constructor Detail

BrowserTool

public BrowserTool()
Method Detail

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)

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.


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()

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()

test

private boolean test(java.lang.String key)

parseVersion

private void parseVersion()


Copyright (c) 2003-2007 Apache Software Foundation