Ice.ImplicitContext

final class Ice.ImplicitContext(impl: ImplicitContext)

Bases: object

An interface to associate implicit contexts with communicators.

When you make a remote invocation without an explicit context parameter, Ice uses the per-proxy context (if any) combined with the ImplicitContext associated with the communicator.

Ice provides several implementations of ImplicitContext. The implementation used depends on the value of the Ice.ImplicitContext property.

None (default)

No implicit context at all.

PerThread

The implementation maintains a context per thread.

Shared

The implementation maintains a single context shared by all threads.

ImplicitContext also provides a number of operations to create, update, or retrieve an entry in the underlying context without first retrieving a copy of the entire context.

Parameters:

impl (ImplicitContext)

containsKey(key: str) bool

Check if this key has an associated value in the underlying context.

Parameters:

key (str) – The key to check.

Returns:

True if the key has an associated value, False otherwise.

Return type:

bool

get(key: str) str

Get the value associated with the given key in the underlying context.

Returns an empty string if no value is associated with the key. Use containsKey to distinguish between an empty-string value and no value at all.

Parameters:

key (str) – The key to retrieve the value for.

Returns:

The value associated with the key, or an empty string if no value is associated with the key.

Return type:

str

getContext() dict[str, str]

Get a copy of the underlying context.

Returns:

A copy of the underlying context.

Return type:

dict

put(key: str, value: str) str | None

Create or update a key/value entry in the underlying context.

Parameters:
  • key (str) – The key to create or update.

  • value (str) – The value to associate with the key.

Returns:

The previous value associated with the key, if any, otherwise None.

Return type:

str | None

remove(key: str) str | None

Remove the entry for the given key in the underlying context.

Parameters:

key (str) – The key to remove.

Returns:

The value associated with the key, if any, otherwise None.

Return type:

str | None

setContext(newContext: dict[str, str])

Set the underlying context.

Parameters:

newContext (dict) – The new context to set.