---
title: "Dispatcher API"
url: https://docs.zeroc.com/ice/3.8/runtime/dispatch/dispatcher-api
language: java
docs_index: https://docs.zeroc.com/llms.txt
---

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

# Dispatcher API

Programming language: Java. Other languages: [C++](https://docs.zeroc.com/ice/3.8/runtime/dispatch/dispatcher-api/cpp.md), [C#](https://docs.zeroc.com/ice/3.8/runtime/dispatch/dispatcher-api/csharp.md), [JavaScript](https://docs.zeroc.com/ice/3.8/runtime/dispatch/dispatcher-api/js.md), [Python](https://docs.zeroc.com/ice/3.8/runtime/dispatch/dispatcher-api/python.md), [Swift](https://docs.zeroc.com/ice/3.8/runtime/dispatch/dispatcher-api/swift.md).

A *dispatcher* accepts an incoming request and returns an outgoing response. Servants, [middleware](https://docs.zeroc.com/ice/3.8/runtime/dispatch/middleware/java.md) and the [dispatch pipeline](https://docs.zeroc.com/ice/3.8/runtime/dispatch/dispatch-pipeline.md) of an object adapter are dispatchers.

A dispatcher is a class that implements [`com.zeroc.Ice.Object`](https://code.zeroc.com/ice/3.8/api/java/com.zeroc.ice/com/zeroc/Ice/Object.html) and overrides its [`dispatch`](https://code.zeroc.com/ice/3.8/api/java/com.zeroc.ice/com/zeroc/Ice/Object.html#dispatch(com.zeroc.Ice.IncomingRequest)) method.

Your implementation of this method handles every request the dispatcher receives, including the requests for `ice_id`, `ice_ids`, `ice_isA` and `ice_ping`: you decide whether and how it handles these four operations. You don't need to override the methods that `Object` provides for them.

## Servants

A *servant* is a dispatcher that handles requests itself, rather than passing them to another dispatcher. A servant usually implements a skeleton that the Slice compiler generates for a Slice interface. The skeleton dispatches each request: it unmarshals the parameters, calls the method you implement for the operation, and marshals the return value and out parameters into the response. It also implements the operations of [Object](https://docs.zeroc.com/ice/3.8/slice/operations-on-object/java.md): `ice_id`, `ice_ids`, `ice_isA` and `ice_ping`.

A servant can also implement the dispatch method itself, without a generated skeleton: it reads the parameters from the request's input stream and writes its results to an output stream. [Input and Output Streams](https://docs.zeroc.com/ice/3.8/runtime/input-and-output-streams/java.md) shows how to read and write Slice types with these streams. You add such a servant to an object adapter like any other servant, in its [active servant map](https://docs.zeroc.com/ice/3.8/runtime/dispatch/active-servant-map/java.md) or as a [default servant](https://docs.zeroc.com/ice/3.8/runtime/dispatch/default-servants/java.md).
