Project Wonder 5.0

er.extensions.appserver
Class ERXWOContext

java.lang.Object
  extended by com.webobjects.appserver.WOContext
      extended by er.extensions.appserver.ajax.ERXAjaxContext
          extended by er.extensions.appserver.ERXWOContext
All Implemented Interfaces:
com.webobjects.foundation.NSKeyValueCoding, com.webobjects.foundation.NSKeyValueCoding.ErrorHandling, com.webobjects.foundation.NSKeyValueCodingAdditions, ERXMutableUserInfoHolderInterface, java.lang.Cloneable

public class ERXWOContext
extends ERXAjaxContext
implements ERXMutableUserInfoHolderInterface

Replacement of WOContext. This subclass is installed when the frameworks loads.


Nested Class Summary
static class ERXWOContext.Observer
           
 
Nested classes/interfaces inherited from interface com.webobjects.foundation.NSKeyValueCodingAdditions
com.webobjects.foundation.NSKeyValueCodingAdditions.DefaultImplementation, com.webobjects.foundation.NSKeyValueCodingAdditions.Utility
 
Nested classes/interfaces inherited from interface com.webobjects.foundation.NSKeyValueCoding
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.Null, com.webobjects.foundation.NSKeyValueCoding.UnknownKeyException, com.webobjects.foundation.NSKeyValueCoding.ValueAccessor
 
Field Summary
static java.lang.String CONTEXT_DICTIONARY_KEY
           
static java.lang.String CONTEXT_KEY
           
 
Fields inherited from class com.webobjects.appserver.WOContext
_session
 
Fields inherited from interface com.webobjects.foundation.NSKeyValueCoding.ErrorHandling
_CLASS
 
Fields inherited from interface com.webobjects.foundation.NSKeyValueCodingAdditions
_CLASS, _KeyPathSeparatorChar, KeyPathSeparator
 
Fields inherited from interface com.webobjects.foundation.NSKeyValueCoding
NullValue
 
Constructor Summary
ERXWOContext(com.webobjects.appserver.WORequest worequest)
           
 
Method Summary
static com.webobjects.foundation.NSArray<com.webobjects.appserver.WOComponent> _componentPath(com.webobjects.appserver.WOContext context)
          Debugging help, returns the path to current component as WOComponent objects.
protected static com.webobjects.foundation.NSMutableDictionary _contextDictionary()
           
static java.lang.String _directActionURL(com.webobjects.appserver.WOContext context, java.lang.String actionName, com.webobjects.foundation.NSDictionary queryParams, boolean secure)
          Call this anywhere you would have called _directActionURL in 5.3 if you want to be 5.4 compatible.
 void _generateCompleteURLs()
           
 void _generateRelativeURLs()
           
 boolean _generatingCompleteResourceURLs()
          Returns whether or not resources generate complete URLs.
 boolean _generatingCompleteURLs()
           
static java.lang.String _htmlCloseHeadTag()
          Deprecated. replaced by ERXResponseRewriter
protected  java.lang.String _postprocessURL(java.lang.String url)
           
protected  void _preprocessURL()
          If er.extensions.ERXWOContext.forceRemoveApplicationNumber is true, then always remove the application number from the generated URLs.
 void _setCurrentComponent(com.webobjects.appserver.WOComponent wocomponent)
          Implemented so the the thread checks if it should get interrupted.
 void _setGenerateCompleteResourceURLs(boolean generateCompleteResourceURLs)
          Turn on complete resource URL generation.
 java.lang.String _urlWithRequestHandlerKey(java.lang.String requestHandlerKey, java.lang.String requestHandlerPath, java.lang.String queryString, boolean secure)
           
static void addResourceInHead(com.webobjects.appserver.WOContext context, com.webobjects.appserver.WOResponse response, java.lang.String framework, java.lang.String fileName, java.lang.String startTag, java.lang.String endTag)
          Deprecated. replaced by ERXResponseRewriter
static void addResourceInHead(com.webobjects.appserver.WOContext context, com.webobjects.appserver.WOResponse response, java.lang.String framework, java.lang.String fileName, java.lang.String startTag, java.lang.String endTag, ERXResponseRewriter.TagMissingBehavior tagMissingBehavior)
          Deprecated. replaced by ERXResponseRewriter
static void addScriptCodeInHead(com.webobjects.appserver.WOContext context, com.webobjects.appserver.WOResponse response, java.lang.String script)
          Deprecated. replaced by ERXResponseRewriter
static void addScriptCodeInHead(com.webobjects.appserver.WOContext context, com.webobjects.appserver.WOResponse response, java.lang.String script, java.lang.String scriptName)
          Deprecated. replaced by ERXResponseRewriter
static void addScriptResourceInHead(com.webobjects.appserver.WOContext context, com.webobjects.appserver.WOResponse response, java.lang.String framework, java.lang.String fileName)
          Deprecated. replaced by ERXResponseRewriter
static void addStylesheetResourceInHead(com.webobjects.appserver.WOContext context, com.webobjects.appserver.WOResponse response, java.lang.String framework, java.lang.String fileName)
          Deprecated. replaced by ERXResponseRewriter
static java.lang.String ajaxActionUrl(com.webobjects.appserver.WOContext context)
          Workaround for missing componentActionUrl(String) in 5.3.
 java.lang.Object clone()
           
static com.webobjects.foundation.NSArray<java.lang.String> componentPath(com.webobjects.appserver.WOContext context)
          Debugging help, returns the path to current component as a list of component names.
static com.webobjects.foundation.NSMutableDictionary contextDictionary()
          Public constructor
static com.webobjects.appserver.WOContext currentContext()
           
static java.lang.String directActionUrl(com.webobjects.appserver.WOContext context, java.lang.String directActionName, java.lang.Boolean secure, boolean includeSessionID)
          Generates direct action URLs with support for various overrides.
static java.lang.String directActionUrl(com.webobjects.appserver.WOContext context, java.lang.String host, java.lang.Integer port, java.lang.String path, java.lang.String directActionName, com.webobjects.foundation.NSDictionary<java.lang.String,? extends java.lang.Object> queryParameters, java.lang.Boolean secure, boolean includeSessionID)
          Generates direct action URLs with support for various overrides.
static java.lang.String directActionUrl(com.webobjects.appserver.WOContext context, java.lang.String host, java.lang.Integer port, java.lang.String path, java.lang.String directActionName, java.lang.String key, java.lang.Object value, java.lang.Boolean secure, boolean includeSessionID)
          Generates direct action URLs with support for various overrides.
static java.lang.String directActionUrl(com.webobjects.appserver.WOContext context, java.lang.String directActionName, com.webobjects.foundation.NSDictionary<java.lang.String,? extends java.lang.Object> queryParameters, java.lang.Boolean secure, boolean includeSessionID)
          Generates direct action URLs with support for various overrides.
static java.lang.String directActionUrl(com.webobjects.appserver.WOContext context, java.lang.String directActionName, java.lang.String key, java.lang.String value, java.lang.Boolean secure, boolean includeSessionID)
          Generates direct action URLs with support for various overrides.
 java.lang.String directActionURLForActionNamed(java.lang.String actionName, com.webobjects.foundation.NSDictionary queryDict, boolean includeSessionID)
          Returns a complete URL for the specified action.
 com.webobjects.appserver.WOSession existingSession()
          Returns the existing session if any is given in the form values or url.
 boolean hasSession()
          Returns true if there is an existing session.
static void insertInResponseBeforeTag(com.webobjects.appserver.WOContext context, com.webobjects.appserver.WOResponse response, java.lang.String content, java.lang.String tag, ERXResponseRewriter.TagMissingBehavior tagMissingBehavior)
          Deprecated. replaced by ERXResponseRewriter
 com.webobjects.foundation.NSMutableDictionary mutableUserInfo()
          Returns the mutableUserInfo.
static com.webobjects.appserver.WOContext newContext()
          Creates a WOContext using a dummy WORequest.
 java.lang.String safeElementID()
           
static java.lang.String safeIdentifierName(com.webobjects.appserver.WOContext context, boolean willCache)
          Returns a safe identifier for the current component.
static void setCurrentContext(java.lang.Object object)
           
 void setMutableUserInfo(com.webobjects.foundation.NSMutableDictionary userInfo)
          Set the mutableUserInfo
static java.lang.String stripSessionIDFromURL(java.lang.String url)
          Removes Session ID (wosid) query key/value pair from the given URL string.
static java.lang.String toSafeElementID(java.lang.String elementID)
          Deprecated. for ERXStringUtilities.safeIdentifierName(String)
 com.webobjects.foundation.NSDictionary userInfo()
           
 
Methods inherited from class er.extensions.appserver.ajax.ERXAjaxContext
_wasFormSubmitted, wasFormSubmitted
 
Methods inherited from class com.webobjects.appserver.WOContext
_componentActionURL, _componentName, _directActionURL, _incrementContextID, _isMultipleSubmitForm, _languages, _pageChanged, _pageComponent, _pageElement, _putAwakeComponentsToSleep, _refuseThisRequest, _requestContextID, _requestSessionID, _session, _set_refuseThisRequest, _setActionInvoked, _setComponentName, _setFormSubmitted, _setIsMultipleSubmitForm, _setPageChanged, _setPageComponent, _setPageElement, _setRequest, _setRequestContextID, _setRequestSessionID, _setResponse, _setSenderID, _setSession, _setTempComponentDefinition, _setUserInfo, _synchronizeForDistribution, _takeAwakeComponent, _tempComponentDefinition, _url, _urlForResourceNamed, _userInfo, _wasActionInvoked, appendElementIDComponent, appendZeroElementIDComponent, canAccessFieldsDirectly, completeURLWithRequestHandlerKey, component, componentActionURL, contextID, contextWithRequest, deleteAllElementIDComponents, deleteLastElementIDComponent, directActionURLForActionNamed, elementID, handleQueryWithUnboundKey, handleTakeValueForUnboundKey, incrementLastElementIDComponent, isInForm, page, request, response, senderID, session, setInForm, takeValueForKey, takeValueForKeyPath, toString, unableToSetNullForKey, urlWithRequestHandlerKey, valueForKey, valueForKeyPath
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CONTEXT_KEY

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

CONTEXT_DICTIONARY_KEY

public static final java.lang.String CONTEXT_DICTIONARY_KEY
See Also:
Constant Field Values
Constructor Detail

ERXWOContext

public ERXWOContext(com.webobjects.appserver.WORequest worequest)
Method Detail

existingSession

public com.webobjects.appserver.WOSession existingSession()
Returns the existing session if any is given in the form values or url.


hasSession

public boolean hasSession()
Returns true if there is an existing session.

Overrides:
hasSession in class com.webobjects.appserver.WOContext

contextDictionary

public static com.webobjects.foundation.NSMutableDictionary contextDictionary()
Public constructor


currentContext

public static com.webobjects.appserver.WOContext currentContext()

setCurrentContext

public static void setCurrentContext(java.lang.Object object)

_contextDictionary

protected static com.webobjects.foundation.NSMutableDictionary _contextDictionary()

_setCurrentComponent

public void _setCurrentComponent(com.webobjects.appserver.WOComponent wocomponent)
Implemented so the the thread checks if it should get interrupted.

Overrides:
_setCurrentComponent in class com.webobjects.appserver.WOContext
Parameters:
wocomponent -

clone

public java.lang.Object clone()
Overrides:
clone in class com.webobjects.appserver.WOContext

_setGenerateCompleteResourceURLs

public void _setGenerateCompleteResourceURLs(boolean generateCompleteResourceURLs)
Turn on complete resource URL generation.

Parameters:
generateCompleteResourceURLs - if true, resources will generate complete URLs.

_generatingCompleteResourceURLs

public boolean _generatingCompleteResourceURLs()
Returns whether or not resources generate complete URLs.

Returns:
whether or not resources generate complete URLs

_generateCompleteURLs

public void _generateCompleteURLs()
Overrides:
_generateCompleteURLs in class com.webobjects.appserver.WOContext

_generateRelativeURLs

public void _generateRelativeURLs()
Overrides:
_generateRelativeURLs in class com.webobjects.appserver.WOContext

_generatingCompleteURLs

public boolean _generatingCompleteURLs()

newContext

public static com.webobjects.appserver.WOContext newContext()
Creates a WOContext using a dummy WORequest.

Returns:
the new WOContext

mutableUserInfo

public com.webobjects.foundation.NSMutableDictionary mutableUserInfo()
Description copied from interface: ERXMutableUserInfoHolderInterface
Returns the mutableUserInfo.

Specified by:
mutableUserInfo in interface ERXMutableUserInfoHolderInterface

setMutableUserInfo

public void setMutableUserInfo(com.webobjects.foundation.NSMutableDictionary userInfo)
Description copied from interface: ERXMutableUserInfoHolderInterface
Set the mutableUserInfo

Specified by:
setMutableUserInfo in interface ERXMutableUserInfoHolderInterface

userInfo

public com.webobjects.foundation.NSDictionary userInfo()

_preprocessURL

protected void _preprocessURL()
If er.extensions.ERXWOContext.forceRemoveApplicationNumber is true, then always remove the application number from the generated URLs. You have to be aware of how your app is written to know if this is something you can do without causing problems. For instance, you MUST be using cookies, and you must not use WOImages with data bindings -- anything that requires a per-instance cache has the potential to fail when this is enabled (if you have more than one instance of your app deployed).


_postprocessURL

protected java.lang.String _postprocessURL(java.lang.String url)

_urlWithRequestHandlerKey

public java.lang.String _urlWithRequestHandlerKey(java.lang.String requestHandlerKey,
                                                  java.lang.String requestHandlerPath,
                                                  java.lang.String queryString,
                                                  boolean secure)
Overrides:
_urlWithRequestHandlerKey in class com.webobjects.appserver.WOContext

directActionURLForActionNamed

public java.lang.String directActionURLForActionNamed(java.lang.String actionName,
                                                      com.webobjects.foundation.NSDictionary queryDict,
                                                      boolean includeSessionID)
Returns a complete URL for the specified action. Works like WOContext.directActionURLForActionNamed(java.lang.String, com.webobjects.foundation.NSDictionary) but has one extra parameter to specify whether or not to include the current Session ID (wosid) in the URL. Convenient if you embed the link for the direct action into an email message and don't want to keep the Session ID in it.

actionName can be either an action -- "ActionName" -- or an action on a class -- "ActionClass/ActionName". You can also specify queryDict to be an NSDictionary which contains form values as key/value pairs. includeSessionID indicates if you want to include the Session ID (wosid) in the URL.

Parameters:
actionName - String action name
queryDict - NSDictionary containing query key/value pairs
includeSessionID - true: to include the Session ID (if has one),
false: not to include the Session ID
Returns:
a String containing the URL for the specified action
See Also:
WODirectAction

stripSessionIDFromURL

public static java.lang.String stripSessionIDFromURL(java.lang.String url)
Removes Session ID (wosid) query key/value pair from the given URL string.

Parameters:
url - String URL
Returns:
a String with the Session ID removed

componentPath

public static com.webobjects.foundation.NSArray<java.lang.String> componentPath(com.webobjects.appserver.WOContext context)
Debugging help, returns the path to current component as a list of component names.

Parameters:
context - the current context
Returns:
an array of component names

_componentPath

public static com.webobjects.foundation.NSArray<com.webobjects.appserver.WOComponent> _componentPath(com.webobjects.appserver.WOContext context)
Debugging help, returns the path to current component as WOComponent objects.

Parameters:
context - the current context
Returns:
an array of components

_htmlCloseHeadTag

public static java.lang.String _htmlCloseHeadTag()
Deprecated. replaced by ERXResponseRewriter


insertInResponseBeforeTag

public static void insertInResponseBeforeTag(com.webobjects.appserver.WOContext context,
                                             com.webobjects.appserver.WOResponse response,
                                             java.lang.String content,
                                             java.lang.String tag,
                                             ERXResponseRewriter.TagMissingBehavior tagMissingBehavior)
Deprecated. replaced by ERXResponseRewriter


addScriptResourceInHead

public static void addScriptResourceInHead(com.webobjects.appserver.WOContext context,
                                           com.webobjects.appserver.WOResponse response,
                                           java.lang.String framework,
                                           java.lang.String fileName)
Deprecated. replaced by ERXResponseRewriter


addStylesheetResourceInHead

public static void addStylesheetResourceInHead(com.webobjects.appserver.WOContext context,
                                               com.webobjects.appserver.WOResponse response,
                                               java.lang.String framework,
                                               java.lang.String fileName)
Deprecated. replaced by ERXResponseRewriter


addScriptCodeInHead

public static void addScriptCodeInHead(com.webobjects.appserver.WOContext context,
                                       com.webobjects.appserver.WOResponse response,
                                       java.lang.String script)
Deprecated. replaced by ERXResponseRewriter


addScriptCodeInHead

public static void addScriptCodeInHead(com.webobjects.appserver.WOContext context,
                                       com.webobjects.appserver.WOResponse response,
                                       java.lang.String script,
                                       java.lang.String scriptName)
Deprecated. replaced by ERXResponseRewriter


addResourceInHead

public static void addResourceInHead(com.webobjects.appserver.WOContext context,
                                     com.webobjects.appserver.WOResponse response,
                                     java.lang.String framework,
                                     java.lang.String fileName,
                                     java.lang.String startTag,
                                     java.lang.String endTag)
Deprecated. replaced by ERXResponseRewriter


addResourceInHead

public static void addResourceInHead(com.webobjects.appserver.WOContext context,
                                     com.webobjects.appserver.WOResponse response,
                                     java.lang.String framework,
                                     java.lang.String fileName,
                                     java.lang.String startTag,
                                     java.lang.String endTag,
                                     ERXResponseRewriter.TagMissingBehavior tagMissingBehavior)
Deprecated. replaced by ERXResponseRewriter


safeIdentifierName

public static java.lang.String safeIdentifierName(com.webobjects.appserver.WOContext context,
                                                  boolean willCache)
Returns a safe identifier for the current component. If willCache is true, your component should cache the identifier name so that it does not change. In this case, your component will be given an incrementing counter value that is unique on the current page. If willCache is false (because you cannot cache the value), the identifier returned will be based on the context.elementID(). While unique on the page at any point in time, be aware that structural changes to the page can cause the elementID of your component to change.

Parameters:
context - the WOContext
willCache - if true, you should cache the resulting value in your component
Returns:
a safe identifier name

toSafeElementID

public static java.lang.String toSafeElementID(java.lang.String elementID)
Deprecated. for ERXStringUtilities.safeIdentifierName(String)

Returns a javascript-safe version of the given element ID.

Parameters:
elementID - the element ID
Returns:
a javascript-safe version (i.e. "_1_2_3_10")
See Also:
ERXStringUtilities#safeIdentifierName(String, String, char)

_directActionURL

public static java.lang.String _directActionURL(com.webobjects.appserver.WOContext context,
                                                java.lang.String actionName,
                                                com.webobjects.foundation.NSDictionary queryParams,
                                                boolean secure)
Call this anywhere you would have called _directActionURL in 5.3 if you want to be 5.4 compatible.

Parameters:
context - the WOContext to operate on
actionName - the name of the direct action to lookup
queryParams - the query parameters to use
secure - whether or not the URL should be HTTPS
Returns:
the URL to the given direct action

directActionUrl

public static java.lang.String directActionUrl(com.webobjects.appserver.WOContext context,
                                               java.lang.String directActionName,
                                               java.lang.Boolean secure,
                                               boolean includeSessionID)
Generates direct action URLs with support for various overrides.

Parameters:
context - the context to generate the URL within
directActionName - the direct action name
secure - true = https, false = http, null = same as request
includeSessionID - if false, removes wosid from query parameters
Returns:
the constructed direct action URL

directActionUrl

public static java.lang.String directActionUrl(com.webobjects.appserver.WOContext context,
                                               java.lang.String directActionName,
                                               java.lang.String key,
                                               java.lang.String value,
                                               java.lang.Boolean secure,
                                               boolean includeSessionID)
Generates direct action URLs with support for various overrides.

Parameters:
context - the context to generate the URL within
directActionName - the direct action name
key - the query parameter key to add (or null to skip)
value - the query parameter value to add (or null to skip)
secure - true = https, false = http, null = same as request
includeSessionID - if false, removes wosid from query parameters
Returns:
the constructed direct action URL

directActionUrl

public static java.lang.String directActionUrl(com.webobjects.appserver.WOContext context,
                                               java.lang.String directActionName,
                                               com.webobjects.foundation.NSDictionary<java.lang.String,? extends java.lang.Object> queryParameters,
                                               java.lang.Boolean secure,
                                               boolean includeSessionID)
Generates direct action URLs with support for various overrides.

Parameters:
context - the context to generate the URL within
directActionName - the direct action name
queryParameters - the query parameters to append (or null)
secure - true = https, false = http, null = same as request
includeSessionID - if false, removes wosid from query parameters
Returns:
the constructed direct action URL

directActionUrl

public static java.lang.String directActionUrl(com.webobjects.appserver.WOContext context,
                                               java.lang.String host,
                                               java.lang.Integer port,
                                               java.lang.String path,
                                               java.lang.String directActionName,
                                               java.lang.String key,
                                               java.lang.Object value,
                                               java.lang.Boolean secure,
                                               boolean includeSessionID)
Generates direct action URLs with support for various overrides.

Parameters:
context - the context to generate the URL within
host - the host name for the URL (or null for default)
port - the port number of the URL (or null for default)
path - the custom path prefix (or null for none)
directActionName - the direct action name
key - the query parameter key to add (or null to skip)
value - the query parameter value to add (or null to skip)
secure - true = https, false = http, null = same as request
includeSessionID - if false, removes wosid from query parameters
Returns:
the constructed direct action URL

directActionUrl

public static java.lang.String directActionUrl(com.webobjects.appserver.WOContext context,
                                               java.lang.String host,
                                               java.lang.Integer port,
                                               java.lang.String path,
                                               java.lang.String directActionName,
                                               com.webobjects.foundation.NSDictionary<java.lang.String,? extends java.lang.Object> queryParameters,
                                               java.lang.Boolean secure,
                                               boolean includeSessionID)
Generates direct action URLs with support for various overrides.

Parameters:
context - the context to generate the URL within
host - the host name for the URL (or null for default)
port - the port number of the URL (or null for default)
path - the custom path prefix (or null for none)
directActionName - the direct action name
queryParameters - the query parameters to append (or null)
secure - true = https, false = http, null = same as request
includeSessionID - if false, removes wosid from query parameters
Returns:
the constructed direct action URL

safeElementID

public java.lang.String safeElementID()

ajaxActionUrl

public static java.lang.String ajaxActionUrl(com.webobjects.appserver.WOContext context)
Workaround for missing componentActionUrl(String) in 5.3.

Parameters:
context -
Returns:
ajax action url

Last updated: Tue, Feb 21, 2017 • 05:45 PM CET

Copyright © 2002 – 2007 Project Wonder.