Class TerminalInput
- All Implemented Interfaces:
UpstreamHandler
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
A frame's payload is data is a probe.
Every probe, and every refused data frame, is answered on STATUS_TOPIC to the sending session only, with
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
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionBinds the bus the answers are published on.static TerminalInputcreate(TerminalAccess access) Creates a handler.voidhandle(BusSession session, String topic, JsonMap payload) Handles oneterm.inputframe.
-
Field Details
-
TOPIC
The upstream topic carrying keystrokes.- See Also:
-
STATUS_TOPIC
The downstream topic carrying the per-session answers. Never retained.- See Also:
-
-
Method Details
-
create
Creates a handler.- Parameters:
access- Who may watch and who may type. Must not benull .- Returns:
- A new, unbound handler.
- Throws:
IllegalArgumentException- Ifaccessisnull .
-
bind
Binds the bus the answers are published on. May be called once.- Parameters:
bus- The bus whose policy holds this handler. Must not benull .- Returns:
- This object.
- Throws:
IllegalArgumentException- Ifbusisnull .IllegalStateException- If a bus is already bound.
-
handle
Handles oneterm.inputframe.- Specified by:
handlein interfaceUpstreamHandler- Parameters:
session- The sending session. Answers go to it only.topic- The topic,TOPIC.payload- The frame payload,{"id", "data"} .- Throws:
IllegalStateException- If no bus is bound.Exception- Whatever the sink'swritethrows; the bus answersbus:upstream-failed.
-