Class TerminalInput

java.lang.Object
org.apache.juneau.terminal.bus.TerminalInput
All Implemented Interfaces:
UpstreamHandler

public final class TerminalInput extends Object implements UpstreamHandler
The term.input upstream handler: hands keystrokes from a browser terminal card to a TerminalSink.

Wiring. The handler answers through the bus, but the bus is built from the policy that holds the handler, so the bus is bound afterwards, once:

TerminalInput input = TerminalInput.create(access); ServerBus bus = ServerBus.create(BusPolicy.create() .upstream(TerminalInput.TOPIC, input) .downstream(TerminalInput.STATUS_TOPIC, false) .build()); input.bind(bus);

A frame's payload is {"id": <terminal id>, "data": <string>}; an empty data is a probe. Every probe, and every refused data frame, is answered on STATUS_TOPIC to the sending session only, with {"id", "state"}, where the state is live, denied, closed, busy or bad. An accepted data frame gets no answer. The id is echoed only when it is a valid terminal id; otherwise the answer has no id key.

Typing needs both TerminalAccess.canWatch(TerminalCaller, String) and a present TerminalAccess.inputSink(TerminalCaller, String). The bus's maxUpstreamPerSecond policy (20 by default) bounds the frame rate per session, which is why the client batches keystrokes.

Each accepted non-empty write is audited at INFO on the juneau.terminal.input logger as principal=<name or -> terminal=<id> bytes=<n> keys=<list>, where the list names the control keys present (for example keys=^C,ESC,CR), comma-separated, in order of first appearance, at most 8. The typed content is never logged. Refusals log at FINE with the state only.