Project Wonder 2.0

er.extensions
Class ERXBrowser

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

public abstract class ERXBrowser
extends Object
implements NSKeyValueCoding

ERXBrowser is an abstract class that defines browser object. A browser object represents the web browser that the current request-response loop 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.
ERXBrowser is immutable and shared by different sessions and direct actions. The shared instances are managed by ERXBrowserFactory which is also responsible to parse "user-agent" header in a WORequest object and to get an appropriate browser object.
One concrete browser, ERXBasicBrowser, is defined in the ERExtensions framework. It not only implements the basic questions defined by ERXBrowser, but also more specific questions like isIFrameSupported and willRenderNestedTablesFast.
You can extend ERXBrowser or its concrete subclass ERXBasicBrowser to implement more specific questions for your application. One good example will be to have a question isSupportedBrowser that checks if the client is using one of the supported browsers for your application.
ERXSession holds a browser object that represent the web browser for that session and browser method returns the object. To access ERXBrowser's boolean questions from WOConditionals on a web component, set the key path like "session.brower.isIFrameSupported" to their condition bindings.
ERXDirectAction also holds a browser object for the current request. Use its browser method to access the object from a session-less direct action.


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 String ICAB
           
static String IE
           
static String LINUX
           
static String MACOS
           
static String MOZILLA
           
static String NETSCAPE
           
static String NO_GECKO
           
static String OMNIWEB
           
static String OPERA
           
static String POWER_PC
           
static String SAFARI
           
static String UNKNOWN_BROWSER
           
static String UNKNOWN_CPU
           
static String UNKNOWN_PLATFORM
           
static String UNKNOWN_VERSION
           
static String WINDOWS
           
 
Fields inherited from interface com.webobjects.foundation.NSKeyValueCoding
_CLASS, NullValue
 
Constructor Summary
ERXBrowser()
           
 
Method Summary
abstract  String browserName()
          Browser name string
 String formValueEncoding()
          If using ERXRequest objects allows one to override on a per browser basis what form value encoding to use.
abstract  String geckoRevision()
          The revision of the gecko rendering engine. 1.0.2 and up support xslt.
abstract  boolean isICab()
          Browser is iCab?
abstract  boolean isIE()
          Browser is Ineternet Explorer?
abstract  boolean isLinux()
           
abstract  boolean isMacOS()
           
abstract  boolean isMozilla40Compatible()
           
abstract  boolean isMozilla45Compatible()
           
abstract  boolean isMozilla50Compatible()
           
abstract  boolean isNetscape()
          Browser is Netscape?
abstract  boolean isNotNetscape()
          Browser is not Netscape?
abstract  boolean isOmniWeb()
          Browser is OmniWeb?
abstract  boolean isOpera()
          Browser is Opera?
abstract  boolean isSafari()
          Browser is Safari?
abstract  boolean isUnknownBrowser()
           
abstract  boolean isUnknownPlatform()
           
abstract  boolean isVersion2()
           
abstract  boolean isVersion3()
           
abstract  boolean isVersion4()
           
abstract  boolean isVersion40()
           
abstract  boolean isVersion41()
           
abstract  boolean isVersion45()
           
abstract  boolean isVersion5()
           
abstract  boolean isVersion51()
           
abstract  boolean isVersion6()
           
abstract  boolean isVersion7()
           
abstract  boolean isWindows()
           
 ERXMessageEncoding messageEncodingForLanguage(String language)
          Gets the message encoding for a given language.
 ERXMessageEncoding messageEncodingForLanguages(NSArray languages)
          Gets the message encoding for a given array of languages.
 ERXMessageEncoding messageEncodingForRequest(WORequest request)
          Gets the message encoding for a given request.
abstract  String mozillaVersion()
          MozillaVersion string
abstract  String platform()
          Platform string
 void takeValueForKey(Object value, String key)
           
 String toString()
           
abstract  NSDictionary userInfo()
          UserInfo dictionary
 Object valueForKey(String key)
           
abstract  String version()
          Version string
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UNKNOWN_BROWSER

public static final String UNKNOWN_BROWSER
See Also:
Constant Field Values

ICAB

public static final String ICAB
See Also:
Constant Field Values

IE

public static final String IE
See Also:
Constant Field Values

NETSCAPE

public static final String NETSCAPE
See Also:
Constant Field Values

OMNIWEB

public static final String OMNIWEB
See Also:
Constant Field Values

OPERA

public static final String OPERA
See Also:
Constant Field Values

SAFARI

public static final String SAFARI
See Also:
Constant Field Values

MOZILLA

public static final String MOZILLA
See Also:
Constant Field Values

UNKNOWN_VERSION

public static final String UNKNOWN_VERSION
See Also:
Constant Field Values

UNKNOWN_PLATFORM

public static final String UNKNOWN_PLATFORM
See Also:
Constant Field Values

MACOS

public static final String MACOS
See Also:
Constant Field Values

WINDOWS

public static final String WINDOWS
See Also:
Constant Field Values

LINUX

public static final String LINUX
See Also:
Constant Field Values

POWER_PC

public static final String POWER_PC
See Also:
Constant Field Values

UNKNOWN_CPU

public static final String UNKNOWN_CPU
See Also:
Constant Field Values

NO_GECKO

public static final String NO_GECKO
See Also:
Constant Field Values
Constructor Detail

ERXBrowser

public ERXBrowser()
Method Detail

browserName

public abstract String browserName()
Browser name string

Returns:
what type of browser

version

public abstract String version()
Version string

Returns:
what version of browser

mozillaVersion

public abstract String mozillaVersion()
MozillaVersion string

Returns:
what Mozilla version equivement to the browser's version

geckoRevision

public abstract String geckoRevision()
The revision of the gecko rendering engine. 1.0.2 and up support xslt.

Returns:
what gecko revision equivement to the browser's version

platform

public abstract String platform()
Platform string

Returns:
what platform that the browser is running on

userInfo

public abstract NSDictionary userInfo()
UserInfo dictionary

Returns:
what type of browser

isUnknownBrowser

public abstract boolean isUnknownBrowser()

isICab

public abstract boolean isICab()
Browser is iCab?

Returns:
true if browser is iCab.

isIE

public abstract boolean isIE()
Browser is Ineternet Explorer?

Returns:
true if browser is IE.

isNetscape

public abstract boolean isNetscape()
Browser is Netscape?

Returns:
true if browser is Netscape.

isNotNetscape

public abstract boolean isNotNetscape()
Browser is not Netscape?

Returns:
true if browser is not Netscape.

isOmniWeb

public abstract boolean isOmniWeb()
Browser is OmniWeb?

Returns:
true if browser is OmniWeb.

isOpera

public abstract boolean isOpera()
Browser is Opera?

Returns:
true if browser is Opera.

isSafari

public abstract boolean isSafari()
Browser is Safari?

Returns:
true if browser is Safari.

isMozilla50Compatible

public abstract boolean isMozilla50Compatible()

isMozilla45Compatible

public abstract boolean isMozilla45Compatible()

isMozilla40Compatible

public abstract boolean isMozilla40Compatible()

isVersion7

public abstract boolean isVersion7()

isVersion6

public abstract boolean isVersion6()

isVersion5

public abstract boolean isVersion5()

isVersion51

public abstract boolean isVersion51()

isVersion45

public abstract boolean isVersion45()

isVersion41

public abstract boolean isVersion41()

isVersion40

public abstract boolean isVersion40()

isVersion4

public abstract boolean isVersion4()

isVersion3

public abstract boolean isVersion3()

isVersion2

public abstract boolean isVersion2()

isUnknownPlatform

public abstract boolean isUnknownPlatform()

isMacOS

public abstract boolean isMacOS()

isWindows

public abstract boolean isWindows()

isLinux

public abstract boolean isLinux()

messageEncodingForRequest

public ERXMessageEncoding messageEncodingForRequest(WORequest request)
Gets the message encoding for a given request. Default implementation gets the message encoding for all of the browserLanguages off of the request.

Parameters:
request - to get the message encoding for
Returns:
message encoding

messageEncodingForLanguages

public ERXMessageEncoding messageEncodingForLanguages(NSArray languages)
Gets the message encoding for a given array of languages.

Parameters:
languages - array to get the correct encoding for
Returns:
message encoding

messageEncodingForLanguage

public ERXMessageEncoding messageEncodingForLanguage(String language)
Gets the message encoding for a given language.

Parameters:
language - to get the encoding for
Returns:
message encoding

formValueEncoding

public String formValueEncoding()
If using ERXRequest objects allows one to override on a per browser basis what form value encoding to use. Default implementation defaults to null Note that you will need to enable the property: er.extensions.ERXRequest.BrowserFormValueEncodingOverrideEnabled=true in order for the actual over ride to happen.

Returns:
form value encoding to use for this particular user-agent.

valueForKey

public Object valueForKey(String key)
Specified by:
valueForKey in interface NSKeyValueCoding

takeValueForKey

public void takeValueForKey(Object value,
                            String key)
Specified by:
takeValueForKey in interface NSKeyValueCoding

toString

public String toString()

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

Copyright © 2002 – 2004 Project Wonder.