Project Wonder 2.0

er.extensions
Class ERXBasicBrowser

java.lang.Object
  extended byer.extensions.ERXBrowser
      extended byer.extensions.ERXBasicBrowser
All Implemented Interfaces:
NSKeyValueCoding

public class ERXBasicBrowser
extends ERXBrowser

ERXBasicBrowser is a concrete subclass of ERXBrowser that defines browser object. A browser object represents the web browser that the current request-response cycle is dealing with. It holds the information retrieved from HTTP request's "user-agent" header, and such information includes web browser's name, version, Mozilla compatible version and platform (OS). Also, a browser object can answer boolean questions such as isIE(),isOmniWeb(), isVersion5()and isMozilla40Compatible(), and even more specific questions like isIFrameSupported()and willRenderNestedTablesFast().

ERXBasicBrowser is immutable and shared by different sessions and direct actions. The shared instances are managed by ERXBrowserFactorywhich is also responsible to parse "user-agent" header in a WORequestobject and to get an appropriate browser object.

You can extends ERXBasicBrowser or its abstract parent ERXBrowser to implement more specific questions for your application. One potencial example will be to have a question isSupportedBrowser that checks if the client is using one of the supported browsers for your application.

ERXSessionholds a browser object that represent the web browser for that session and browser()method returns the object.

To access ERXBasicBrowser's boolean questions from WOConditionals on a web component, set the key path like "session.brower.isNetscape" to their condition bindings.

ERXDirectActionalso holds a browser object for the current request. Use its browser()method to access the object from a session-less direct action. Some browser user-agents: IE 5.17 OS 9: user-agent = (Mozilla/4.0 (compatible; MSIE 5.17; Mac_PowerPC)); ua-os = (MacOS); ua-cpu = (PPC); IE 5.0 OS 9: user-agent = (Mozilla/4.0 (compatible; MSIE 5.0; Mac_PowerPC)); ua-os = (MacOS); ua-cpu = (PPC); FireFox OS X 10.3.3: user-agent = (Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.6) Gecko/20040206 Firefox/0.8); IE 5.2 MacOS X: user-agent = (Mozilla/4.0 (compatible; MSIE 5.23; Mac_PowerPC)); ua-os = (MacOS); ua-cpu = (PPC); Safari: user-agent = ("Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-us) AppleWebKit/124 (KHTML, like Gecko) Safari/125.1"); IE WIndows 6.02: user-agent = (Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0));


Nested Class Summary
 
Nested classes inherited from class com.webobjects.foundation.NSKeyValueCoding
NSKeyValueCoding._BooleanFieldBinding, NSKeyValueCoding._BooleanMethodBinding, NSKeyValueCoding._FieldBinding, NSKeyValueCoding._ForwardingBinding, NSKeyValueCoding._KeyBinding, NSKeyValueCoding._KeyBindingCreation, NSKeyValueCoding._MethodBinding, NSKeyValueCoding._NumberFieldBinding, NSKeyValueCoding._NumberMethodBinding, NSKeyValueCoding._ReflectionKeyBindingCreation, NSKeyValueCoding.DefaultImplementation, NSKeyValueCoding.ErrorHandling, NSKeyValueCoding.Null, NSKeyValueCoding.UnknownKeyException, NSKeyValueCoding.Utility, NSKeyValueCoding.ValueAccessor
 
Field Summary
static ERXLogger log
          logging support
 
Fields inherited from class er.extensions.ERXBrowser
ICAB, IE, LINUX, MACOS, MOZILLA, NETSCAPE, NO_GECKO, OMNIWEB, OPERA, POWER_PC, SAFARI, UNKNOWN_BROWSER, UNKNOWN_CPU, UNKNOWN_PLATFORM, UNKNOWN_VERSION, WINDOWS
 
Fields inherited from interface com.webobjects.foundation.NSKeyValueCoding
_CLASS, NullValue
 
Constructor Summary
ERXBasicBrowser(String browserName, String version, String mozillaVersion, String platform, NSDictionary userInfo)
           
 
Method Summary
 String browserName()
          Browser name string
 String cpu()
          CPU string
 String geckoRevision()
          Returns the gecko revision of the browser or ERXBrowser.NO_GECKO.
 boolean isICab()
          Browser is iCab?
 boolean isIE()
          Browser is Ineternet Explorer?
 boolean isIFrameSupported()
          Does the browser support IFrames?
 boolean isJavaScriptOnImageButtonSupported()
           
 boolean isLinux()
           
 boolean isMacOS()
           
 boolean isMozilla()
           
 boolean isMozilla40Compatible()
           
 boolean isMozilla45Compatible()
           
 boolean isMozilla50Compatible()
           
 boolean isNetscape()
          Browser is Netscape?
 boolean isNotNetscape()
          Browser is not Netscape?
 boolean isOmniWeb()
          Browser is OmniWeb?
 boolean isOpera()
          Browser is Opera?
 boolean isSafari()
          Browser is Safari?
 boolean isUnknownBrowser()
           
 boolean isUnknownPlatform()
           
 boolean isVersion2()
           
 boolean isVersion3()
           
 boolean isVersion4()
           
 boolean isVersion40()
           
 boolean isVersion41()
           
 boolean isVersion45()
           
 boolean isVersion5()
           
 boolean isVersion51()
           
 boolean isVersion6()
           
 boolean isVersion7()
           
 boolean isWindows()
           
 String mozillaVersion()
          MozillaVersion string
 String platform()
          Platform string
 NSDictionary userInfo()
          UserInfo dictionary
 String version()
          Version string
 boolean willRenderNestedTablesFast()
          Browser is not netscape or is a version 5 browser.
 
Methods inherited from class er.extensions.ERXBrowser
formValueEncoding, messageEncodingForLanguage, messageEncodingForLanguages, messageEncodingForRequest, takeValueForKey, toString, valueForKey
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

log

public static final ERXLogger log
logging support

Constructor Detail

ERXBasicBrowser

public ERXBasicBrowser(String browserName,
                       String version,
                       String mozillaVersion,
                       String platform,
                       NSDictionary userInfo)
Method Detail

browserName

public String browserName()
Description copied from class: ERXBrowser
Browser name string

Specified by:
browserName in class ERXBrowser
Returns:
what type of browser

version

public String version()
Description copied from class: ERXBrowser
Version string

Specified by:
version in class ERXBrowser
Returns:
what version of browser

mozillaVersion

public String mozillaVersion()
Description copied from class: ERXBrowser
MozillaVersion string

Specified by:
mozillaVersion in class ERXBrowser
Returns:
what Mozilla version equivement to the browser's version

platform

public String platform()
Description copied from class: ERXBrowser
Platform string

Specified by:
platform in class ERXBrowser
Returns:
what platform that the browser is running on

cpu

public String cpu()
CPU string

Returns:
what processor that the browser is running on

userInfo

public NSDictionary userInfo()
Description copied from class: ERXBrowser
UserInfo dictionary

Specified by:
userInfo in class ERXBrowser
Returns:
what type of browser

isUnknownBrowser

public boolean isUnknownBrowser()
Specified by:
isUnknownBrowser in class ERXBrowser

isICab

public boolean isICab()
Description copied from class: ERXBrowser
Browser is iCab?

Specified by:
isICab in class ERXBrowser
Returns:
true if browser is iCab.

isIE

public boolean isIE()
Description copied from class: ERXBrowser
Browser is Ineternet Explorer?

Specified by:
isIE in class ERXBrowser
Returns:
true if browser is IE.

isNetscape

public boolean isNetscape()
Description copied from class: ERXBrowser
Browser is Netscape?

Specified by:
isNetscape in class ERXBrowser
Returns:
true if browser is Netscape.

isNotNetscape

public boolean isNotNetscape()
Description copied from class: ERXBrowser
Browser is not Netscape?

Specified by:
isNotNetscape in class ERXBrowser
Returns:
true if browser is not Netscape.

isOmniWeb

public boolean isOmniWeb()
Description copied from class: ERXBrowser
Browser is OmniWeb?

Specified by:
isOmniWeb in class ERXBrowser
Returns:
true if browser is OmniWeb.

isOpera

public boolean isOpera()
Description copied from class: ERXBrowser
Browser is Opera?

Specified by:
isOpera in class ERXBrowser
Returns:
true if browser is Opera.

isSafari

public boolean isSafari()
Description copied from class: ERXBrowser
Browser is Safari?

Specified by:
isSafari in class ERXBrowser
Returns:
true if browser is Safari.

isMozilla

public boolean isMozilla()

isMozilla50Compatible

public boolean isMozilla50Compatible()
Specified by:
isMozilla50Compatible in class ERXBrowser

isMozilla45Compatible

public boolean isMozilla45Compatible()
Specified by:
isMozilla45Compatible in class ERXBrowser

isMozilla40Compatible

public boolean isMozilla40Compatible()
Specified by:
isMozilla40Compatible in class ERXBrowser

isVersion7

public boolean isVersion7()
Specified by:
isVersion7 in class ERXBrowser

isVersion6

public boolean isVersion6()
Specified by:
isVersion6 in class ERXBrowser

isVersion5

public boolean isVersion5()
Specified by:
isVersion5 in class ERXBrowser

isVersion51

public boolean isVersion51()
Specified by:
isVersion51 in class ERXBrowser

isVersion45

public boolean isVersion45()
Specified by:
isVersion45 in class ERXBrowser

isVersion41

public boolean isVersion41()
Specified by:
isVersion41 in class ERXBrowser

isVersion40

public boolean isVersion40()
Specified by:
isVersion40 in class ERXBrowser

isVersion4

public boolean isVersion4()
Specified by:
isVersion4 in class ERXBrowser

isVersion3

public boolean isVersion3()
Specified by:
isVersion3 in class ERXBrowser

isVersion2

public boolean isVersion2()
Specified by:
isVersion2 in class ERXBrowser

isUnknownPlatform

public boolean isUnknownPlatform()
Specified by:
isUnknownPlatform in class ERXBrowser

isMacOS

public boolean isMacOS()
Specified by:
isMacOS in class ERXBrowser

isWindows

public boolean isWindows()
Specified by:
isWindows in class ERXBrowser

isLinux

public boolean isLinux()
Specified by:
isLinux in class ERXBrowser

geckoRevision

public String geckoRevision()
Returns the gecko revision of the browser or ERXBrowser.NO_GECKO.

Specified by:
geckoRevision in class ERXBrowser
Returns:
the gecko revision of the browser or ERXBrowser.NO_GECKO.

isIFrameSupported

public boolean isIFrameSupported()
Does the browser support IFrames?

Returns:
true if the browser is IE.

willRenderNestedTablesFast

public boolean willRenderNestedTablesFast()
Browser is not netscape or is a version 5 browser.

Returns:
true if this browser can handle nested tables

isJavaScriptOnImageButtonSupported

public boolean isJavaScriptOnImageButtonSupported()

Last updated: Do, Dez 9, 2004 • 12:46 PM CET

Copyright © 2002 – 2004 Project Wonder.