diff options
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/slice/Ice/ObjectAdapter.ice | 40 | ||||
-rw-r--r-- | cpp/src/Ice/Direct.cpp | 16 | ||||
-rw-r--r-- | cpp/src/Ice/Incoming.cpp | 16 |
3 files changed, 53 insertions, 19 deletions
diff --git a/cpp/slice/Ice/ObjectAdapter.ice b/cpp/slice/Ice/ObjectAdapter.ice index 499b97921d0..5b8ef22679b 100644 --- a/cpp/slice/Ice/ObjectAdapter.ice +++ b/cpp/slice/Ice/ObjectAdapter.ice @@ -154,14 +154,38 @@ local interface ObjectAdapter * * Add a Servant Locator to this Object Adapter. If a locator has * already been installed for the given prefix, the current - * locator for this prefix is replaced by the new one. If a - * non-empty prefix is specified, the locator will only be called - * for Ice Objects with an identity that starts with - * "<replaceable>prefix</replaceable><literal>#</literal>". If an - * empty prefix is given, the Ice Object identity can be - * completely free-form, except that it cannot contain a - * "<literal>#</literal>". Only one locator for an empty prefix - * can be installed with one single Object Adapter. + * locator for this prefix is replaced by the new one. To dispatch + * operation calls on Servants, the Object Adapter tries to find a + * Servant for a given Ice Object identity in the following order: + * + * <orderedlist> + * + * <listitem><para>The Object Adapter tries to find a Servant for + * the identity in the Active Servant Map.</para></listitem> + * + * <listitem><para>If no Servant has been found in the Active + * Servant Map, and the identity has the format + * "<replaceable>prefix</replaceable><literal>#</literal>", the + * Object Adapter tries to find a locator for this prefix. If a + * locator is found, the Object Adapter tries to find a Servant + * using this locator.</para></listitem> + * + * <listitem><para>If no Servant has been found by any of the + * preceding steps, the Object Adapter tries to find a locator + * with an empty prefix, regardless of the format of the identity, + * i.e., even if the identity contains a + * '<literal>#</literal>'. If a locator is found, the Object + * Adapter tries to find a Servant using this + * locator</para></listitem> + * + * <listitem><para>If no Servant has been found with any of the + * preceding steps, the Object Adapter gives up and the caller + * will receive an [ObjectNotExistException].</para></listitem> + * + * </orderedlist> + * + * <note><para>Only one locator for an empty prefix can be + * installed.</para></note> * * @param locator The locator to add. * diff --git a/cpp/src/Ice/Direct.cpp b/cpp/src/Ice/Direct.cpp index c8a40bf63eb..d1efbf2cb69 100644 --- a/cpp/src/Ice/Direct.cpp +++ b/cpp/src/Ice/Direct.cpp @@ -23,22 +23,26 @@ IceInternal::Direct::Direct(const ObjectAdapterPtr& adapter, const ReferencePtr& _reference(ref), _operation(operation) { - _servant = _adapter->identityToServant(_reference->identity); - try { + _servant = _adapter->identityToServant(_reference->identity); + if (!_servant) { string::size_type pos = _reference->identity.find('#'); if (pos != string::npos) { _locator = _adapter->findServantLocator(_reference->identity.substr(0, pos)); + if (_locator) + { + _servant = _locator->locate(_adapter, _reference->identity, _operation, _cookie); + } } - else - { - _locator = _adapter->findServantLocator(""); - } + } + if (!_servant) + { + _locator = _adapter->findServantLocator(""); if (_locator) { _servant = _locator->locate(_adapter, _reference->identity, _operation, _cookie); diff --git a/cpp/src/Ice/Incoming.cpp b/cpp/src/Ice/Incoming.cpp index f9a74512494..828948cc817 100644 --- a/cpp/src/Ice/Incoming.cpp +++ b/cpp/src/Ice/Incoming.cpp @@ -39,24 +39,30 @@ IceInternal::Incoming::invoke(Stream& is) Stream::Container::size_type statusPos = _os.b.size(); - ObjectPtr servant = _adapter->identityToServant(identity); + ObjectPtr servant; ServantLocatorPtr locator; LocalObjectPtr cookie; try { + servant = _adapter->identityToServant(identity); + if (!servant) { string::size_type pos = identity.find('#'); if (pos != string::npos) { locator = _adapter->findServantLocator(identity.substr(0, pos)); + if (locator) + { + servant = locator->locate(_adapter, identity, operation, cookie); + } } - else - { - locator = _adapter->findServantLocator(""); - } + } + if (!servant) + { + locator = _adapter->findServantLocator(""); if (locator) { servant = locator->locate(_adapter, identity, operation, cookie); |