---
title: "Request Contexts"
url: https://docs.zeroc.com/ice/3.8/runtime/invocation/request-contexts
docs_index: https://docs.zeroc.com/llms.txt
---

> For an index of every page, see [llms.txt](https://docs.zeroc.com/llms.txt).

# Request Contexts

Parts of this page are for some programming languages only, and name them. For one language's text alone, see [C++](https://docs.zeroc.com/ice/3.8/runtime/invocation/request-contexts/cpp.md), [C#](https://docs.zeroc.com/ice/3.8/runtime/invocation/request-contexts/csharp.md), [Java](https://docs.zeroc.com/ice/3.8/runtime/invocation/request-contexts/java.md), [JavaScript](https://docs.zeroc.com/ice/3.8/runtime/invocation/request-contexts/js.md), [MATLAB](https://docs.zeroc.com/ice/3.8/runtime/invocation/request-contexts/matlab.md), [PHP](https://docs.zeroc.com/ice/3.8/runtime/invocation/request-contexts/php.md), [Python](https://docs.zeroc.com/ice/3.8/runtime/invocation/request-contexts/python.md), [Ruby](https://docs.zeroc.com/ice/3.8/runtime/invocation/request-contexts/ruby.md), and [Swift](https://docs.zeroc.com/ice/3.8/runtime/invocation/request-contexts/swift.md).

A *request context* is a dictionary of string keys and values that Ice sends with an invocation. It lets a client send additional information with a request without adding a parameter to the operation. The implementation of the operation reads the context from the `ctx` field of its `Current` parameter.

> **C++, C#, Java, JavaScript, and Swift**
>
> A [middleware](https://docs.zeroc.com/ice/3.8/runtime/dispatch/middleware.md) is a typical consumer of request contexts: it sees every request the object adapter dispatches and reads the context through the `current` of the incoming request.

A client supplies a context in the following ways:

> **C++, C#, Java, JavaScript, MATLAB, Python, Ruby, and Swift**
>
> - An [explicit context](https://docs.zeroc.com/ice/3.8/runtime/invocation/request-contexts/explicit-request-contexts.md) applies to one invocation.
> - A [per-proxy context](https://docs.zeroc.com/ice/3.8/runtime/invocation/request-contexts/per-proxy-request-contexts.md) applies to the invocations made through a proxy.
> - An [implicit context](https://docs.zeroc.com/ice/3.8/runtime/invocation/request-contexts/implicit-request-contexts.md) applies to the invocations made through the proxies of a communicator.

> **PHP**
>
> - An [explicit context](https://docs.zeroc.com/ice/3.8/runtime/invocation/request-contexts/explicit-request-contexts/php.md) applies to one invocation.
> - A [per-proxy context](https://docs.zeroc.com/ice/3.8/runtime/invocation/request-contexts/per-proxy-request-contexts/php.md) applies to the invocations made through a proxy.

Context keys that begin with an underscore are reserved for Ice.

## Combining Request Contexts

An explicit context, even an empty one, replaces the other contexts: Ice sends only the explicit context with the invocation.

> **C++, C#, Java, JavaScript, MATLAB, Python, Ruby, and Swift**
>
> Without an explicit context, Ice sends the entries of both the per-proxy and the implicit contexts. When both contain the same key, Ice sends the value of the per-proxy context.
