MCPcopy Index your code
hub / github.com/SeleniumHQ/selenium / handle

Method handle

java/src/org/openqa/selenium/bidi/Connection.java:288–305  ·  view source on GitHub ↗
(CharSequence data)

Source from the content-addressed store, hash-verified

286 }
287
288 private void handle(CharSequence data) {
289 // It's kind of gross to decode the data twice, but this lets us get started on something
290 // that feels nice to users.
291 // TODO: decode once, and once only
292
293 String asString = String.valueOf(data);
294 LOG.log(getDebugLogLevel(), "<- {0}", asString);
295
296 Map<String, Object> raw = JSON.toType(asString, MAP_TYPE);
297 if (raw.get("id") instanceof Number
298 && (raw.get("result") != null || raw.get("error") != null)) {
299 handleResponse(asString, raw);
300 } else if (raw.get("method") instanceof String && raw.get("params") instanceof Map) {
301 handleEventResponse(raw);
302 } else {
303 LOG.warning(() -> "Unhandled type BiDi response type: " + data);
304 }
305 }
306
307 private void handleResponse(String rawDataString, Map<String, Object> rawDataMap) {
308 Consumer<Either<Throwable, JsonInput>> consumer =

Callers

nothing calls this directly

Calls 7

handleResponseMethod · 0.95
handleEventResponseMethod · 0.95
getDebugLogLevelMethod · 0.80
toTypeMethod · 0.80
warningMethod · 0.80
logMethod · 0.65
getMethod · 0.65

Tested by

no test coverage detected