com.waveset.util
Class UserAgent

java.lang.Object
  extended bycom.waveset.util.UserAgent

public class UserAgent
extends java.lang.Object

Simple class to model the User-Agent field in a http header.


Field Summary
protected  java.lang.String _company
           
protected  int _majorVersion
           
protected  int _minorVersion
           
protected  java.lang.String _name
           
protected  java.lang.String _os
           
protected  int _revision
           
protected  java.lang.String _userAgent
           
protected  java.lang.String _version
           
static java.lang.String code_id
           
 
Constructor Summary
UserAgent(javax.servlet.http.HttpServletRequest request)
          Using a HttpServletRequest create an object which represents the user's browser.
 
Method Summary
 java.lang.String getCompany()
           
 int getMajorVersion()
           
 int getMinorVersion()
           
 java.lang.String getName()
           
 java.lang.String getOs()
           
 java.lang.String getUserAgent()
           
 java.lang.String getVersion()
           
 boolean isIE()
          Check to see if the given browser object is Internet Explorer.
 boolean isIE(int major, int minor)
          Check to see if this is IE and is less then or equal to the given release major and minor numbers.
 boolean isNetScape()
          Check to see if the given browser object is Netscape Communicator.
 void setUserAgent(java.lang.String httpUserAgent)
           
 java.lang.String toString()
          Format the information in the User-Agent header parameter to string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

code_id

public static final java.lang.String code_id
See Also:
Constant Field Values

_company

protected java.lang.String _company

_name

protected java.lang.String _name

_version

protected java.lang.String _version

_userAgent

protected java.lang.String _userAgent

_os

protected java.lang.String _os

_majorVersion

protected int _majorVersion

_minorVersion

protected int _minorVersion

_revision

protected int _revision
Constructor Detail

UserAgent

public UserAgent(javax.servlet.http.HttpServletRequest request)
Using a HttpServletRequest create an object which represents the user's browser.

Method Detail

setUserAgent

public void setUserAgent(java.lang.String httpUserAgent)

getUserAgent

public java.lang.String getUserAgent()

getCompany

public java.lang.String getCompany()

getName

public java.lang.String getName()

getVersion

public java.lang.String getVersion()

getMajorVersion

public int getMajorVersion()

getMinorVersion

public int getMinorVersion()

getOs

public java.lang.String getOs()

isIE

public boolean isIE()
Check to see if the given browser object is Internet Explorer.


isNetScape

public boolean isNetScape()
Check to see if the given browser object is Netscape Communicator.


isIE

public boolean isIE(int major,
                    int minor)
Check to see if this is IE and is less then or equal to the given release major and minor numbers. Returns true only if the the browser is less then or equal to the given major and minor version numbers. For instance to check if the browser is 6.0 or older use major 6 minor 0. The browser patch level information is NOT included in the header so all we can get is major and minor numbers.


toString

public java.lang.String toString()
Format the information in the User-Agent header parameter to string.