Ice.ServantLocator¶
- class Ice.ServantLocator¶
Bases:
ABCAn application-provided class that an object adapter uses to locate servants.
Notes
For simple cases, you should consider using a default servant instead (see
ObjectAdapter.addDefaultServant()).- abstractmethod locate(current: Current) tuple[Object | None, object | None]¶
Asks this servant locator to find and return a servant.
Notes
The caller (the object adapter) does not insert the returned servant into its Active Servant Map. This must be done by the servant locator implementation, if this is desired.
The implementation can raise any exception, including
UserException. The Ice runtime will marshal this exception in the response.If you call
locate()from your own code, you must also callfinished()when you have finished using the servant, provided thatlocate()did not returnNone.- Parameters:
current (Current) – Information about the incoming request for which a servant is required.
- Returns:
- A tuple containing the following:
- retvalObject or None
The located servant, or
Noneif no suitable servant was found.
- cookieobject | None
A “cookie” that will be passed to
finished().
- Return type:
- abstractmethod finished(current: Current, servant: Object, cookie: object | None)¶
Notifies this servant locator that the dispatch on the servant returned by
locate()is complete. The object adapter calls this function only whenlocate()didn’t returnNone.Notes
The implementation can raise any exception, including
UserException. The Ice runtime will marshal this exception in the response. If both the dispatch andfinished()raise an exception, the exception raised byfinished()prevails and is marshaled back to the client.