public class ERXModernizr extends ERXStatelessComponent
ERXModernizr uses the Modernizr library to detect what javascript
capabilities a client browser has and then posts those values back
to the server to store them on the session. To use it, just drop it
in your page wrapper. For storage, this component relies on the
ERXSession.objectStore()
. At the moment the modernizr data
is stored on the session, a notification is fired using the session
as the notification object. This is to permit logging of modernizr data
for later analysis. It also permits you to copy the modernizer data
elsewhere if the session's objectStore is not appropriate for your
needs.
It is recommended that in your ERXSession subclass, you set
_javaScriptEnabled == Boolean.FALSE;
in the constructor.
By default, it will be set to true when ERXSession.javaScriptEnabled()
is called. This component will set the value to true whenever the
modernizr data updates as a result of an ajax call... thus ensuring
no false positives.
As a convenience, this component defines two properties for naming the framework and filename for the modernizer script. This is to allow the min.js for deployment while the full js can be used in development. The component bindings are used as a default value should you prefer to use bindings instead of properties.
Name | Description |
---|---|
filename | filename |
framework | framework |
Name | Description |
---|---|
er.extensions.components.ERXModernizr.modernizrFileName | (default is read from "filename" binding) |
er.extensions.components.ERXModernizr.modernizrFrameworkName | (default is read from "framework" binding) |
com.webobjects.appserver.WOComponent._EventLoggingEnabler, com.webobjects.appserver.WOComponent.Event
com.webobjects.foundation.NSKeyValueCodingAdditions.DefaultImplementation, com.webobjects.foundation.NSKeyValueCodingAdditions.Utility
com.webobjects.foundation.NSKeyValueCoding._BooleanFieldBinding, com.webobjects.foundation.NSKeyValueCoding._BooleanMethodBinding, com.webobjects.foundation.NSKeyValueCoding._FieldBinding, com.webobjects.foundation.NSKeyValueCoding._ForwardingBinding, com.webobjects.foundation.NSKeyValueCoding._KeyBinding, com.webobjects.foundation.NSKeyValueCoding._KeyBindingCreation, com.webobjects.foundation.NSKeyValueCoding._MethodBinding, com.webobjects.foundation.NSKeyValueCoding._NumberFieldBinding, com.webobjects.foundation.NSKeyValueCoding._NumberMethodBinding, com.webobjects.foundation.NSKeyValueCoding._ReflectionKeyBindingCreation, com.webobjects.foundation.NSKeyValueCoding.ErrorHandling, com.webobjects.foundation.NSKeyValueCoding.MapImplementation, com.webobjects.foundation.NSKeyValueCoding.Null<T>, com.webobjects.foundation.NSKeyValueCoding.UnknownKeyException, com.webobjects.foundation.NSKeyValueCoding.ValueAccessor
com.webobjects.foundation.NSValidation._MethodBinding, com.webobjects.foundation.NSValidation._ValidationBinding, com.webobjects.foundation.NSValidation.DefaultImplementation, com.webobjects.foundation.NSValidation.Utility, com.webobjects.foundation.NSValidation.ValidationException
Modifier and Type | Field and Description |
---|---|
static String |
FILE_NAME_PROPERTY |
static String |
FRAMEWORK_NAME_PROPERTY |
static String |
MODERNIZR_KEY |
static String |
MODERNIZR_UPDATED_NOTIFICATION |
_dynamicBindings
_Extension, _IsEventLoggingEnabled, _keyAssociations
Constructor and Description |
---|
ERXModernizr(com.webobjects.appserver.WOContext context) |
Modifier and Type | Method and Description |
---|---|
String |
filename()
The filename for the modernizr javascript file.
|
String |
formValuePrefix() |
String |
framework()
The name of the framework where the modernizr javascript file is
found.
|
protected void |
postNotification(ERXSession session)
Called to post a notification whenever modernizr data is stored
on the session's object store.
|
String |
postURL()
The ajax request URL for this component.
|
boolean |
shouldPostData()
Returns true if the component should include a script to post modernizr
data back to the server.
|
void |
takeValuesFromRequest(com.webobjects.appserver.WORequest request,
com.webobjects.appserver.WOContext context)
Overridden to capture the modernizr data being sent from the client.
|
isStateless, reset
appendToResponse, invokeAction, resetCachedBindingsInStatefulComponent, synchronizesVariablesWithBindings
_awakeInContext, _checkAccess, _frameworkName, _includeCSSResources, _includeJavascriptResources, additionalCSSFiles, additionalJavascriptFiles, arrayValueForBinding, arrayValueForBinding, booleanValueForBinding, booleanValueForBinding, booleanValueForBinding, browser, checkAccess, clickToOpenEnabled, componentName, defaultCSSPath, defaultJavascriptPath, dynamicBindings, floatValueForBinding, intValueForBinding, isPageAccessAllowed, localizer, objectValueForBinding, objectValueForBinding, pageWithName, postAppendToResponse, preAppendToResponse, primaryCSSFile, primaryJavascriptFile, shouldCheckAccess, stringValueForBinding, stringValueForBinding, useDefaultComponentCSS, useDefaultComponentJavascript
__valueForBinding, _associationWithName, _childTemplate, _cleanUpStatelessComponent, _componentDefinition, _componentUnroll, _isPage, _setContext, _setIsPage, _setParent, _setSubcomponent, _sleepInContext, _subcomponentForElementWithID, _templateNameForClass, _unroll, application, awake, baseURL, bindingKeys, canAccessFieldsDirectly, canGetValueForBinding, canSetValueForBinding, clone, context, debugString, descriptionForResponse, ensureAwakeInContext, frameworkName, generateResponse, handleQueryWithUnboundKey, handleTakeValueForUnboundKey, hasBinding, hasSession, isCachingEnabled, isEventLoggingEnabled, logString, name, pageWithName, parent, path, pathURL, performParentAction, pullValuesFromParent, pushValuesToParent, session, set_componentUnroll, set_unroll, setCachingEnabled, setValueForBinding, setVariableValueForName, sleep, takeValueForKey, takeValueForKeyPath, template, templateWithHTMLString, templateWithHTMLString, templateWithHTMLString, templateWithName, toString, unableToSetNullForKey, validateTakeValueForKeyPath, validateValueForKey, validationFailedWithException, valueForBinding, valueForBooleanBinding, valueForIntegerBinding, valueForKey, valueForKeyPath, valueForNSArrayBindings, valueForNSDictionaryBindings, valueForNumberBinding, valueForStringBinding, variableValueForName, variableWithName
public static final String FRAMEWORK_NAME_PROPERTY
public static final String FILE_NAME_PROPERTY
public static final String MODERNIZR_KEY
public static final String MODERNIZR_UPDATED_NOTIFICATION
public String filename()
Name | Description |
---|---|
er.extensions.components.ERXModernizr.modernizrFileName | er.extensions.components.ERXModernizr.modernizrFileName |
public String framework()
Name | Description |
---|---|
er.extensions.components.ERXModernizr.modernizrFrameworkName | er.extensions.components.ERXModernizr.modernizrFrameworkName |
public String postURL()
public String formValuePrefix()
public boolean shouldPostData()
public void takeValuesFromRequest(com.webobjects.appserver.WORequest request, com.webobjects.appserver.WOContext context)
takeValuesFromRequest
in class ERXNonSynchronizingComponent
request
- from which the values will be takencontext
- of the requestprotected void postNotification(ERXSession session)
session
- Copyright © 2002 – 2020 Project Wonder.