MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / handle

Method handle

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

Source from the content-addressed store, hash-verified

349 }
350
351 private void handle(CharSequence data) {
352 // Parse the incoming message once, here, into a Map. A response then passes its "result"
353 // value to the command's mapper and an event passes its "params" Map to the event's mapper;
354 // neither re-parses the message text.
355 String asString = String.valueOf(data);
356 LOG.log(getDebugLogLevel(), "<- {0}", asString);
357
358 Map<String, Object> raw = JSON.toType(asString, MAP_TYPE);
359 if (raw.get("id") instanceof Number
360 && (raw.get("result") != null || raw.get("error") != null)) {
361 handleResponse(raw);
362 } else if (raw.get("method") instanceof String && raw.get("params") instanceof Map) {
363 handleEventResponse(raw);
364 } else {
365 LOG.warning(() -> "Unhandled type BiDi response type: " + data);
366 }
367 }
368
369 private void handleResponse(Map<String, Object> rawDataMap) {
370 Consumer<Either<Throwable, @Nullable Object>> 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