001package Torello.Browser; 002 003import java.util.*; 004import javax.json.*; 005import javax.json.stream.*; 006import java.io.*; 007 008import java.lang.reflect.Method; 009import java.lang.reflect.Parameter; 010import java.util.function.Function; 011 012import Torello.Java.Additional.*; 013import Torello.Java.JSON.*; 014 015import static Torello.Java.JSON.JFlag.*; 016 017import Torello.Java.StrCmpr; 018import Torello.JavaDoc.StaticFunctional; 019import Torello.JavaDoc.JDHeaderBackgroundImg; 020import Torello.JavaDoc.Excuse; 021 022/** 023 * <SPAN CLASS=COPIEDJDK><B>Network domain allows tracking network activities of the page. It exposes information about http, 024 * file, data and other requests and responses, their headers, bodies, timing, etc.</B></SPAN> 025 * 026 * <EMBED CLASS='external-html' DATA-FILE-ID=CODE_GEN_NOTE> 027 */ 028@StaticFunctional(Excused={"counter"}, Excuses={Excuse.CONFIGURATION}) 029@JDHeaderBackgroundImg(EmbedTagFileID="WOOD_PLANK_NOTE") 030public class Network 031{ 032 // ******************************************************************************************** 033 // ******************************************************************************************** 034 // Class Header Stuff 035 // ******************************************************************************************** 036 // ******************************************************************************************** 037 038 039 // No Pubic Constructors 040 private Network () { } 041 042 // These two Vector's are used by all the "Methods" exported by this class. java.lang.reflect 043 // is used to generate the JSON String's. It saves thousands of lines of Auto-Generated Code. 044 private static final Map<String, Vector<String>> parameterNames = new HashMap<>(); 045 private static final Map<String, Vector<Class<?>>> parameterTypes = new HashMap<>(); 046 047 // Some Methods do not take any parameters - for instance all the "enable()" and "disable()" 048 // I simply could not get ride of RAW-TYPES and UNCHECKED warnings... so there are now, 049 // offically, two empty-vectors. One for String's, and the other for Classes. 050 051 private static final Vector<String> EMPTY_VEC_STR = new Vector<>(); 052 private static final Vector<Class<?>> EMPTY_VEC_CLASS = new Vector<>(); 053 054 static 055 { 056 for (Method m : Network.class.getMethods()) 057 { 058 // This doesn't work! The parameter names are all "arg0" ... "argN" 059 // It works for java.lang.reflect.Field, BUT NOT java.lang.reflect.Parameter! 060 // 061 // Vector<String> parameterNamesList = new Vector<>(); -- NOPE! 062 063 Vector<Class<?>> parameterTypesList = new Vector<>(); 064 065 for (Parameter p : m.getParameters()) parameterTypesList.add(p.getType()); 066 067 parameterTypes.put( 068 m.getName(), 069 (parameterTypesList.size() > 0) ? parameterTypesList : EMPTY_VEC_CLASS 070 ); 071 } 072 } 073 074 static 075 { 076 Vector<String> v = null; 077 078 v = new Vector<String>(1); 079 parameterNames.put("setAcceptedEncodings", v); 080 Collections.addAll(v, new String[] 081 { "encodings", }); 082 083 parameterNames.put("clearAcceptedEncodingsOverride", EMPTY_VEC_STR); 084 085 parameterNames.put("canClearBrowserCache", EMPTY_VEC_STR); 086 087 parameterNames.put("canClearBrowserCookies", EMPTY_VEC_STR); 088 089 parameterNames.put("canEmulateNetworkConditions", EMPTY_VEC_STR); 090 091 parameterNames.put("clearBrowserCache", EMPTY_VEC_STR); 092 093 parameterNames.put("clearBrowserCookies", EMPTY_VEC_STR); 094 095 v = new Vector<String>(8); 096 parameterNames.put("continueInterceptedRequest", v); 097 Collections.addAll(v, new String[] 098 { "interceptionId", "errorReason", "rawResponse", "url", "method", "postData", "headers", "authChallengeResponse", }); 099 100 v = new Vector<String>(4); 101 parameterNames.put("deleteCookies", v); 102 Collections.addAll(v, new String[] 103 { "name", "url", "domain", "path", }); 104 105 parameterNames.put("disable", EMPTY_VEC_STR); 106 107 v = new Vector<String>(5); 108 parameterNames.put("emulateNetworkConditions", v); 109 Collections.addAll(v, new String[] 110 { "offline", "latency", "downloadThroughput", "uploadThroughput", "connectionType", }); 111 112 v = new Vector<String>(3); 113 parameterNames.put("enable", v); 114 Collections.addAll(v, new String[] 115 { "maxTotalBufferSize", "maxResourceBufferSize", "maxPostDataSize", }); 116 117 parameterNames.put("getAllCookies", EMPTY_VEC_STR); 118 119 v = new Vector<String>(1); 120 parameterNames.put("getCertificate", v); 121 Collections.addAll(v, new String[] 122 { "origin", }); 123 124 v = new Vector<String>(1); 125 parameterNames.put("getCookies", v); 126 Collections.addAll(v, new String[] 127 { "urls", }); 128 129 v = new Vector<String>(1); 130 parameterNames.put("getResponseBody", v); 131 Collections.addAll(v, new String[] 132 { "requestId", }); 133 134 v = new Vector<String>(1); 135 parameterNames.put("getRequestPostData", v); 136 Collections.addAll(v, new String[] 137 { "requestId", }); 138 139 v = new Vector<String>(1); 140 parameterNames.put("getResponseBodyForInterception", v); 141 Collections.addAll(v, new String[] 142 { "interceptionId", }); 143 144 v = new Vector<String>(1); 145 parameterNames.put("takeResponseBodyForInterceptionAsStream", v); 146 Collections.addAll(v, new String[] 147 { "interceptionId", }); 148 149 v = new Vector<String>(1); 150 parameterNames.put("replayXHR", v); 151 Collections.addAll(v, new String[] 152 { "requestId", }); 153 154 v = new Vector<String>(4); 155 parameterNames.put("searchInResponseBody", v); 156 Collections.addAll(v, new String[] 157 { "requestId", "query", "caseSensitive", "isRegex", }); 158 159 v = new Vector<String>(1); 160 parameterNames.put("setBlockedURLs", v); 161 Collections.addAll(v, new String[] 162 { "urls", }); 163 164 v = new Vector<String>(1); 165 parameterNames.put("setBypassServiceWorker", v); 166 Collections.addAll(v, new String[] 167 { "bypass", }); 168 169 v = new Vector<String>(1); 170 parameterNames.put("setCacheDisabled", v); 171 Collections.addAll(v, new String[] 172 { "cacheDisabled", }); 173 174 v = new Vector<String>(13); 175 parameterNames.put("setCookie", v); 176 Collections.addAll(v, new String[] 177 { "name", "value", "url", "domain", "path", "secure", "httpOnly", "sameSite", "expires", "priority", "sameParty", "sourceScheme", "sourcePort", }); 178 179 v = new Vector<String>(1); 180 parameterNames.put("setCookies", v); 181 Collections.addAll(v, new String[] 182 { "cookies", }); 183 184 v = new Vector<String>(1); 185 parameterNames.put("setExtraHTTPHeaders", v); 186 Collections.addAll(v, new String[] 187 { "headers", }); 188 189 v = new Vector<String>(1); 190 parameterNames.put("setAttachDebugStack", v); 191 Collections.addAll(v, new String[] 192 { "enabled", }); 193 194 v = new Vector<String>(1); 195 parameterNames.put("setRequestInterception", v); 196 Collections.addAll(v, new String[] 197 { "patterns", }); 198 199 v = new Vector<String>(4); 200 parameterNames.put("setUserAgentOverride", v); 201 Collections.addAll(v, new String[] 202 { "userAgent", "acceptLanguage", "platform", "userAgentMetadata", }); 203 204 v = new Vector<String>(1); 205 parameterNames.put("getSecurityIsolationStatus", v); 206 Collections.addAll(v, new String[] 207 { "frameId", }); 208 209 v = new Vector<String>(1); 210 parameterNames.put("enableReportingApi", v); 211 Collections.addAll(v, new String[] 212 { "enable", }); 213 214 v = new Vector<String>(3); 215 parameterNames.put("loadNetworkResource", v); 216 Collections.addAll(v, new String[] 217 { "frameId", "url", "options", }); 218 } 219 220 221 // ******************************************************************************************** 222 // ******************************************************************************************** 223 // Types - Static Inner Classes 224 // ******************************************************************************************** 225 // ******************************************************************************************** 226 227 // public static class LoaderId => String 228 229 // public static class RequestId => String 230 231 // public static class InterceptionId => String 232 233 // public static class TimeSinceEpoch => Number 234 235 // public static class MonotonicTime => Number 236 237 // public static class Headers => JsonObject 238 239 // public static class ReportId => String 240 241 /** Resource type as it was perceived by the rendering engine. */ 242 public static final String[] ResourceType = 243 { 244 "Document", "Stylesheet", "Image", "Media", "Font", "Script", "TextTrack", "XHR", "Fetch", 245 "EventSource", "WebSocket", "Manifest", "SignedExchange", "Ping", "CSPViolationReport", 246 "Preflight", "Other", 247 }; 248 249 /** Network level fetch failure reason. */ 250 public static final String[] ErrorReason = 251 { 252 "Failed", "Aborted", "TimedOut", "AccessDenied", "ConnectionClosed", "ConnectionReset", 253 "ConnectionRefused", "ConnectionAborted", "ConnectionFailed", "NameNotResolved", 254 "InternetDisconnected", "AddressUnreachable", "BlockedByClient", "BlockedByResponse", 255 }; 256 257 /** The underlying connection technology that the browser is supposedly using. */ 258 public static final String[] ConnectionType = 259 { 260 "none", "cellular2g", "cellular3g", "cellular4g", "bluetooth", "ethernet", "wifi", "wimax", 261 "other", 262 }; 263 264 /** 265 * Represents the cookie's 'SameSite' status: 266 * https://tools.ietf.org/html/draft-west-first-party-cookies 267 */ 268 public static final String[] CookieSameSite = 269 { "Strict", "Lax", "None", }; 270 271 /** 272 * Represents the cookie's 'Priority' status: 273 * https://tools.ietf.org/html/draft-west-cookie-priority-00 274 * <BR /> 275 * <BR /><B>EXPERIMENTAL</B> 276 */ 277 public static final String[] CookiePriority = 278 { "Low", "Medium", "High", }; 279 280 /** 281 * Represents the source scheme of the origin that originally set the cookie. 282 * A value of "Unset" allows protocol clients to emulate legacy cookie scope for the scheme. 283 * This is a temporary ability and it will be removed in the future. 284 * <BR /> 285 * <BR /><B>EXPERIMENTAL</B> 286 */ 287 public static final String[] CookieSourceScheme = 288 { "Unset", "NonSecure", "Secure", }; 289 290 /** Loading priority of a resource request. */ 291 public static final String[] ResourcePriority = 292 { "VeryLow", "Low", "Medium", "High", "VeryHigh", }; 293 294 /** Whether the request complied with Certificate Transparency policy. */ 295 public static final String[] CertificateTransparencyCompliance = 296 { "unknown", "not-compliant", "compliant", }; 297 298 /** The reason why request was blocked. */ 299 public static final String[] BlockedReason = 300 { 301 "other", "csp", "mixed-content", "origin", "inspector", "subresource-filter", 302 "content-type", "coep-frame-resource-needs-coep-header", 303 "coop-sandboxed-iframe-cannot-navigate-to-coop-page", "corp-not-same-origin", 304 "corp-not-same-origin-after-defaulted-to-same-origin-by-coep", "corp-not-same-site", 305 }; 306 307 /** The reason why request was blocked. */ 308 public static final String[] CorsError = 309 { 310 "DisallowedByMode", "InvalidResponse", "WildcardOriginNotAllowed", 311 "MissingAllowOriginHeader", "MultipleAllowOriginValues", "InvalidAllowOriginValue", 312 "AllowOriginMismatch", "InvalidAllowCredentials", "CorsDisabledScheme", 313 "PreflightInvalidStatus", "PreflightDisallowedRedirect", 314 "PreflightWildcardOriginNotAllowed", "PreflightMissingAllowOriginHeader", 315 "PreflightMultipleAllowOriginValues", "PreflightInvalidAllowOriginValue", 316 "PreflightAllowOriginMismatch", "PreflightInvalidAllowCredentials", 317 "PreflightMissingAllowExternal", "PreflightInvalidAllowExternal", 318 "InvalidAllowMethodsPreflightResponse", "InvalidAllowHeadersPreflightResponse", 319 "MethodDisallowedByPreflightResponse", "HeaderDisallowedByPreflightResponse", 320 "RedirectContainsCredentials", "InsecurePrivateNetwork", "InvalidPrivateNetworkAccess", 321 "UnexpectedPrivateNetworkAccess", "NoCorsRedirectModeNotFollow", 322 }; 323 324 /** Source of serviceworker response. */ 325 public static final String[] ServiceWorkerResponseSource = 326 { "cache-storage", "http-cache", "fallback-code", "network", }; 327 328 /** 329 * <CODE>[No Description Provided by Google]</CODE> 330 * <BR /> 331 * <BR /><B>EXPERIMENTAL</B> 332 */ 333 public static final String[] TrustTokenOperationType = 334 { "Issuance", "Redemption", "Signing", }; 335 336 /** 337 * Types of reasons why a cookie may not be stored from a response. 338 * <BR /> 339 * <BR /><B>EXPERIMENTAL</B> 340 */ 341 public static final String[] SetCookieBlockedReason = 342 { 343 "SecureOnly", "SameSiteStrict", "SameSiteLax", "SameSiteUnspecifiedTreatedAsLax", 344 "SameSiteNoneInsecure", "UserPreferences", "SyntaxError", "SchemeNotSupported", 345 "OverwriteSecure", "InvalidDomain", "InvalidPrefix", "UnknownError", 346 "SchemefulSameSiteStrict", "SchemefulSameSiteLax", 347 "SchemefulSameSiteUnspecifiedTreatedAsLax", "SamePartyFromCrossPartyContext", 348 "SamePartyConflictsWithOtherAttributes", "NameValuePairExceedsMaxSize", 349 }; 350 351 /** 352 * Types of reasons why a cookie may not be sent with a request. 353 * <BR /> 354 * <BR /><B>EXPERIMENTAL</B> 355 */ 356 public static final String[] CookieBlockedReason = 357 { 358 "SecureOnly", "NotOnPath", "DomainMismatch", "SameSiteStrict", "SameSiteLax", 359 "SameSiteUnspecifiedTreatedAsLax", "SameSiteNoneInsecure", "UserPreferences", 360 "UnknownError", "SchemefulSameSiteStrict", "SchemefulSameSiteLax", 361 "SchemefulSameSiteUnspecifiedTreatedAsLax", "SamePartyFromCrossPartyContext", 362 "NameValuePairExceedsMaxSize", 363 }; 364 365 /** 366 * Stages of the interception to begin intercepting. Request will intercept before the request is 367 * sent. Response will intercept after the response is received. 368 * <BR /> 369 * <BR /><B>EXPERIMENTAL</B> 370 */ 371 public static final String[] InterceptionStage = 372 { "Request", "HeadersReceived", }; 373 374 /** 375 * Field type for a signed exchange related error. 376 * <BR /> 377 * <BR /><B>EXPERIMENTAL</B> 378 */ 379 public static final String[] SignedExchangeErrorField = 380 { 381 "signatureSig", "signatureIntegrity", "signatureCertUrl", "signatureCertSha256", 382 "signatureValidityUrl", "signatureTimestamps", 383 }; 384 385 /** 386 * List of content encodings supported by the backend. 387 * <BR /> 388 * <BR /><B>EXPERIMENTAL</B> 389 */ 390 public static final String[] ContentEncoding = 391 { "deflate", "gzip", "br", }; 392 393 /** 394 * <CODE>[No Description Provided by Google]</CODE> 395 * <BR /> 396 * <BR /><B>EXPERIMENTAL</B> 397 */ 398 public static final String[] PrivateNetworkRequestPolicy = 399 { 400 "Allow", "BlockFromInsecureToMorePrivate", "WarnFromInsecureToMorePrivate", 401 "PreflightBlock", "PreflightWarn", 402 }; 403 404 /** 405 * <CODE>[No Description Provided by Google]</CODE> 406 * <BR /> 407 * <BR /><B>EXPERIMENTAL</B> 408 */ 409 public static final String[] IPAddressSpace = 410 { "Local", "Private", "Public", "Unknown", }; 411 412 /** 413 * <CODE>[No Description Provided by Google]</CODE> 414 * <BR /> 415 * <BR /><B>EXPERIMENTAL</B> 416 */ 417 public static final String[] CrossOriginOpenerPolicyValue = 418 { "SameOrigin", "SameOriginAllowPopups", "UnsafeNone", "SameOriginPlusCoep", }; 419 420 /** 421 * <CODE>[No Description Provided by Google]</CODE> 422 * <BR /> 423 * <BR /><B>EXPERIMENTAL</B> 424 */ 425 public static final String[] CrossOriginEmbedderPolicyValue = 426 { "None", "Credentialless", "RequireCorp", }; 427 428 /** 429 * The status of a Reporting API report. 430 * <BR /> 431 * <BR /><B>EXPERIMENTAL</B> 432 */ 433 public static final String[] ReportStatus = 434 { "Queued", "Pending", "MarkedForRemoval", "Success", }; 435 436 /** Timing information for the request. */ 437 public static class ResourceTiming 438 extends BaseType 439 implements java.io.Serializable 440 { 441 /** For Object Serialization. java.io.Serializable */ 442 protected static final long serialVersionUID = 1; 443 444 public boolean[] optionals() 445 { return new boolean[] { false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, }; } 446 447 /** 448 * Timing's requestTime is a baseline in seconds, while the other numbers are ticks in 449 * milliseconds relatively to this requestTime. 450 */ 451 public final Number requestTime; 452 453 /** Started resolving proxy. */ 454 public final Number proxyStart; 455 456 /** Finished resolving proxy. */ 457 public final Number proxyEnd; 458 459 /** Started DNS address resolve. */ 460 public final Number dnsStart; 461 462 /** Finished DNS address resolve. */ 463 public final Number dnsEnd; 464 465 /** Started connecting to the remote host. */ 466 public final Number connectStart; 467 468 /** Connected to the remote host. */ 469 public final Number connectEnd; 470 471 /** Started SSL handshake. */ 472 public final Number sslStart; 473 474 /** Finished SSL handshake. */ 475 public final Number sslEnd; 476 477 /** 478 * Started running ServiceWorker. 479 * <BR /> 480 * <BR /><B>EXPERIMENTAL</B> 481 */ 482 public final Number workerStart; 483 484 /** 485 * Finished Starting ServiceWorker. 486 * <BR /> 487 * <BR /><B>EXPERIMENTAL</B> 488 */ 489 public final Number workerReady; 490 491 /** 492 * Started fetch event. 493 * <BR /> 494 * <BR /><B>EXPERIMENTAL</B> 495 */ 496 public final Number workerFetchStart; 497 498 /** 499 * Settled fetch event respondWith promise. 500 * <BR /> 501 * <BR /><B>EXPERIMENTAL</B> 502 */ 503 public final Number workerRespondWithSettled; 504 505 /** Started sending request. */ 506 public final Number sendStart; 507 508 /** Finished sending request. */ 509 public final Number sendEnd; 510 511 /** 512 * Time the server started pushing request. 513 * <BR /> 514 * <BR /><B>EXPERIMENTAL</B> 515 */ 516 public final Number pushStart; 517 518 /** 519 * Time the server finished pushing request. 520 * <BR /> 521 * <BR /><B>EXPERIMENTAL</B> 522 */ 523 public final Number pushEnd; 524 525 /** Finished receiving response headers. */ 526 public final Number receiveHeadersEnd; 527 528 /** 529 * Constructor 530 * 531 * @param requestTime 532 * Timing's requestTime is a baseline in seconds, while the other numbers are ticks in 533 * milliseconds relatively to this requestTime. 534 * 535 * @param proxyStart Started resolving proxy. 536 * 537 * @param proxyEnd Finished resolving proxy. 538 * 539 * @param dnsStart Started DNS address resolve. 540 * 541 * @param dnsEnd Finished DNS address resolve. 542 * 543 * @param connectStart Started connecting to the remote host. 544 * 545 * @param connectEnd Connected to the remote host. 546 * 547 * @param sslStart Started SSL handshake. 548 * 549 * @param sslEnd Finished SSL handshake. 550 * 551 * @param workerStart Started running ServiceWorker. 552 * <BR /><B>EXPERIMENTAL</B> 553 * 554 * @param workerReady Finished Starting ServiceWorker. 555 * <BR /><B>EXPERIMENTAL</B> 556 * 557 * @param workerFetchStart Started fetch event. 558 * <BR /><B>EXPERIMENTAL</B> 559 * 560 * @param workerRespondWithSettled Settled fetch event respondWith promise. 561 * <BR /><B>EXPERIMENTAL</B> 562 * 563 * @param sendStart Started sending request. 564 * 565 * @param sendEnd Finished sending request. 566 * 567 * @param pushStart Time the server started pushing request. 568 * <BR /><B>EXPERIMENTAL</B> 569 * 570 * @param pushEnd Time the server finished pushing request. 571 * <BR /><B>EXPERIMENTAL</B> 572 * 573 * @param receiveHeadersEnd Finished receiving response headers. 574 */ 575 public ResourceTiming( 576 Number requestTime, Number proxyStart, Number proxyEnd, Number dnsStart, 577 Number dnsEnd, Number connectStart, Number connectEnd, Number sslStart, 578 Number sslEnd, Number workerStart, Number workerReady, Number workerFetchStart, 579 Number workerRespondWithSettled, Number sendStart, Number sendEnd, Number pushStart, 580 Number pushEnd, Number receiveHeadersEnd 581 ) 582 { 583 // Exception-Check(s) to ensure that if any parameters which are not declared as 584 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 585 586 if (requestTime == null) THROWS.throwNPE("requestTime"); 587 if (proxyStart == null) THROWS.throwNPE("proxyStart"); 588 if (proxyEnd == null) THROWS.throwNPE("proxyEnd"); 589 if (dnsStart == null) THROWS.throwNPE("dnsStart"); 590 if (dnsEnd == null) THROWS.throwNPE("dnsEnd"); 591 if (connectStart == null) THROWS.throwNPE("connectStart"); 592 if (connectEnd == null) THROWS.throwNPE("connectEnd"); 593 if (sslStart == null) THROWS.throwNPE("sslStart"); 594 if (sslEnd == null) THROWS.throwNPE("sslEnd"); 595 if (workerStart == null) THROWS.throwNPE("workerStart"); 596 if (workerReady == null) THROWS.throwNPE("workerReady"); 597 if (workerFetchStart == null) THROWS.throwNPE("workerFetchStart"); 598 if (workerRespondWithSettled == null) THROWS.throwNPE("workerRespondWithSettled"); 599 if (sendStart == null) THROWS.throwNPE("sendStart"); 600 if (sendEnd == null) THROWS.throwNPE("sendEnd"); 601 if (pushStart == null) THROWS.throwNPE("pushStart"); 602 if (pushEnd == null) THROWS.throwNPE("pushEnd"); 603 if (receiveHeadersEnd == null) THROWS.throwNPE("receiveHeadersEnd"); 604 605 this.requestTime = requestTime; 606 this.proxyStart = proxyStart; 607 this.proxyEnd = proxyEnd; 608 this.dnsStart = dnsStart; 609 this.dnsEnd = dnsEnd; 610 this.connectStart = connectStart; 611 this.connectEnd = connectEnd; 612 this.sslStart = sslStart; 613 this.sslEnd = sslEnd; 614 this.workerStart = workerStart; 615 this.workerReady = workerReady; 616 this.workerFetchStart = workerFetchStart; 617 this.workerRespondWithSettled = workerRespondWithSettled; 618 this.sendStart = sendStart; 619 this.sendEnd = sendEnd; 620 this.pushStart = pushStart; 621 this.pushEnd = pushEnd; 622 this.receiveHeadersEnd = receiveHeadersEnd; 623 } 624 625 /** 626 * JSON Object Constructor 627 * @param jo A Json-Object having data about an instance of {@code 'ResourceTiming'}. 628 */ 629 public ResourceTiming (JsonObject jo) 630 { 631 this.requestTime = ReadNumberJSON.get(jo, "requestTime", false, true); 632 this.proxyStart = ReadNumberJSON.get(jo, "proxyStart", false, true); 633 this.proxyEnd = ReadNumberJSON.get(jo, "proxyEnd", false, true); 634 this.dnsStart = ReadNumberJSON.get(jo, "dnsStart", false, true); 635 this.dnsEnd = ReadNumberJSON.get(jo, "dnsEnd", false, true); 636 this.connectStart = ReadNumberJSON.get(jo, "connectStart", false, true); 637 this.connectEnd = ReadNumberJSON.get(jo, "connectEnd", false, true); 638 this.sslStart = ReadNumberJSON.get(jo, "sslStart", false, true); 639 this.sslEnd = ReadNumberJSON.get(jo, "sslEnd", false, true); 640 this.workerStart = ReadNumberJSON.get(jo, "workerStart", false, true); 641 this.workerReady = ReadNumberJSON.get(jo, "workerReady", false, true); 642 this.workerFetchStart = ReadNumberJSON.get(jo, "workerFetchStart", false, true); 643 this.workerRespondWithSettled = ReadNumberJSON.get(jo, "workerRespondWithSettled", false, true); 644 this.sendStart = ReadNumberJSON.get(jo, "sendStart", false, true); 645 this.sendEnd = ReadNumberJSON.get(jo, "sendEnd", false, true); 646 this.pushStart = ReadNumberJSON.get(jo, "pushStart", false, true); 647 this.pushEnd = ReadNumberJSON.get(jo, "pushEnd", false, true); 648 this.receiveHeadersEnd = ReadNumberJSON.get(jo, "receiveHeadersEnd", false, true); 649 } 650 651 652 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 653 public boolean equals(Object other) 654 { 655 if (this == other) return true; 656 if (other == null) return false; 657 if (other.getClass() != this.getClass()) return false; 658 659 ResourceTiming o = (ResourceTiming) other; 660 661 return 662 Objects.equals(this.requestTime, o.requestTime) 663 && Objects.equals(this.proxyStart, o.proxyStart) 664 && Objects.equals(this.proxyEnd, o.proxyEnd) 665 && Objects.equals(this.dnsStart, o.dnsStart) 666 && Objects.equals(this.dnsEnd, o.dnsEnd) 667 && Objects.equals(this.connectStart, o.connectStart) 668 && Objects.equals(this.connectEnd, o.connectEnd) 669 && Objects.equals(this.sslStart, o.sslStart) 670 && Objects.equals(this.sslEnd, o.sslEnd) 671 && Objects.equals(this.workerStart, o.workerStart) 672 && Objects.equals(this.workerReady, o.workerReady) 673 && Objects.equals(this.workerFetchStart, o.workerFetchStart) 674 && Objects.equals(this.workerRespondWithSettled, o.workerRespondWithSettled) 675 && Objects.equals(this.sendStart, o.sendStart) 676 && Objects.equals(this.sendEnd, o.sendEnd) 677 && Objects.equals(this.pushStart, o.pushStart) 678 && Objects.equals(this.pushEnd, o.pushEnd) 679 && Objects.equals(this.receiveHeadersEnd, o.receiveHeadersEnd); 680 } 681 682 /** Generates a Hash-Code for {@code 'this'} instance */ 683 public int hashCode() 684 { 685 return 686 Objects.hashCode(this.requestTime) 687 + Objects.hashCode(this.proxyStart) 688 + Objects.hashCode(this.proxyEnd) 689 + Objects.hashCode(this.dnsStart) 690 + Objects.hashCode(this.dnsEnd) 691 + Objects.hashCode(this.connectStart) 692 + Objects.hashCode(this.connectEnd) 693 + Objects.hashCode(this.sslStart) 694 + Objects.hashCode(this.sslEnd) 695 + Objects.hashCode(this.workerStart) 696 + Objects.hashCode(this.workerReady) 697 + Objects.hashCode(this.workerFetchStart) 698 + Objects.hashCode(this.workerRespondWithSettled) 699 + Objects.hashCode(this.sendStart) 700 + Objects.hashCode(this.sendEnd) 701 + Objects.hashCode(this.pushStart) 702 + Objects.hashCode(this.pushEnd) 703 + Objects.hashCode(this.receiveHeadersEnd); 704 } 705 } 706 707 /** Post data entry for HTTP request */ 708 public static class PostDataEntry 709 extends BaseType 710 implements java.io.Serializable 711 { 712 /** For Object Serialization. java.io.Serializable */ 713 protected static final long serialVersionUID = 1; 714 715 public boolean[] optionals() 716 { return new boolean[] { true, }; } 717 718 /** 719 * <CODE>[No Description Provided by Google]</CODE> 720 * <BR /> 721 * <BR /><B>OPTIONAL</B> 722 */ 723 public final String bytes; 724 725 /** 726 * Constructor 727 * 728 * @param bytes - 729 * <BR /><B>OPTIONAL</B> 730 */ 731 public PostDataEntry(String bytes) 732 { 733 this.bytes = bytes; 734 } 735 736 /** 737 * JSON Object Constructor 738 * @param jo A Json-Object having data about an instance of {@code 'PostDataEntry'}. 739 */ 740 public PostDataEntry (JsonObject jo) 741 { 742 this.bytes = ReadJSON.getString(jo, "bytes", true, false); 743 } 744 745 746 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 747 public boolean equals(Object other) 748 { 749 if (this == other) return true; 750 if (other == null) return false; 751 if (other.getClass() != this.getClass()) return false; 752 753 PostDataEntry o = (PostDataEntry) other; 754 755 return 756 Objects.equals(this.bytes, o.bytes); 757 } 758 759 /** Generates a Hash-Code for {@code 'this'} instance */ 760 public int hashCode() 761 { 762 return 763 Objects.hashCode(this.bytes); 764 } 765 } 766 767 /** HTTP request data. */ 768 public static class Request 769 extends BaseType 770 implements java.io.Serializable 771 { 772 /** For Object Serialization. java.io.Serializable */ 773 protected static final long serialVersionUID = 1; 774 775 public boolean[] optionals() 776 { return new boolean[] { false, true, false, false, true, true, true, true, false, false, true, true, true, }; } 777 778 /** Request URL (without fragment). */ 779 public final String url; 780 781 /** 782 * Fragment of the requested URL starting with hash, if present. 783 * <BR /> 784 * <BR /><B>OPTIONAL</B> 785 */ 786 public final String urlFragment; 787 788 /** HTTP request method. */ 789 public final String method; 790 791 /** HTTP request headers. */ 792 public final JsonObject headers; 793 794 /** 795 * HTTP POST request data. 796 * <BR /> 797 * <BR /><B>OPTIONAL</B> 798 */ 799 public final String postData; 800 801 /** 802 * True when the request has POST data. Note that postData might still be omitted when this flag is true when the data is too long. 803 * <BR /> 804 * <BR /><B>OPTIONAL</B> 805 */ 806 public final Boolean hasPostData; 807 808 /** 809 * Request body elements. This will be converted from base64 to binary 810 * <BR /> 811 * <BR /><B>OPTIONAL</B> 812 * <BR /><B>EXPERIMENTAL</B> 813 */ 814 public final Network.PostDataEntry[] postDataEntries; 815 816 /** 817 * The mixed content type of the request. 818 * <BR /> 819 * <BR /><B>OPTIONAL</B> 820 */ 821 public final String mixedContentType; 822 823 /** Priority of the resource request at the time request is sent. */ 824 public final String initialPriority; 825 826 /** The referrer policy of the request, as defined in https://www.w3.org/TR/referrer-policy/ */ 827 public final String referrerPolicy; 828 829 /** 830 * Whether is loaded via link preload. 831 * <BR /> 832 * <BR /><B>OPTIONAL</B> 833 */ 834 public final Boolean isLinkPreload; 835 836 /** 837 * Set for requests when the TrustToken API is used. Contains the parameters 838 * passed by the developer (e.g. via "fetch") as understood by the backend. 839 * <BR /> 840 * <BR /><B>OPTIONAL</B> 841 * <BR /><B>EXPERIMENTAL</B> 842 */ 843 public final Network.TrustTokenParams trustTokenParams; 844 845 /** 846 * True if this resource request is considered to be the 'same site' as the 847 * request correspondinfg to the main frame. 848 * <BR /> 849 * <BR /><B>OPTIONAL</B> 850 * <BR /><B>EXPERIMENTAL</B> 851 */ 852 public final Boolean isSameSite; 853 854 /** 855 * Constructor 856 * 857 * @param url Request URL (without fragment). 858 * 859 * @param urlFragment Fragment of the requested URL starting with hash, if present. 860 * <BR /><B>OPTIONAL</B> 861 * 862 * @param method HTTP request method. 863 * 864 * @param headers HTTP request headers. 865 * 866 * @param postData HTTP POST request data. 867 * <BR /><B>OPTIONAL</B> 868 * 869 * @param hasPostData True when the request has POST data. Note that postData might still be omitted when this flag is true when the data is too long. 870 * <BR /><B>OPTIONAL</B> 871 * 872 * @param postDataEntries Request body elements. This will be converted from base64 to binary 873 * <BR /><B>OPTIONAL</B> 874 * <BR /><B>EXPERIMENTAL</B> 875 * 876 * @param mixedContentType The mixed content type of the request. 877 * <BR /><B>OPTIONAL</B> 878 * 879 * @param initialPriority Priority of the resource request at the time request is sent. 880 * 881 * @param referrerPolicy The referrer policy of the request, as defined in https://www.w3.org/TR/referrer-policy/ 882 * <BR />Acceptable Values: ["unsafe-url", "no-referrer-when-downgrade", "no-referrer", "origin", "origin-when-cross-origin", "same-origin", "strict-origin", "strict-origin-when-cross-origin"] 883 * 884 * @param isLinkPreload Whether is loaded via link preload. 885 * <BR /><B>OPTIONAL</B> 886 * 887 * @param trustTokenParams 888 * Set for requests when the TrustToken API is used. Contains the parameters 889 * passed by the developer (e.g. via "fetch") as understood by the backend. 890 * <BR /><B>OPTIONAL</B> 891 * <BR /><B>EXPERIMENTAL</B> 892 * 893 * @param isSameSite 894 * True if this resource request is considered to be the 'same site' as the 895 * request correspondinfg to the main frame. 896 * <BR /><B>OPTIONAL</B> 897 * <BR /><B>EXPERIMENTAL</B> 898 */ 899 public Request( 900 String url, String urlFragment, String method, JsonObject headers, String postData, 901 Boolean hasPostData, Network.PostDataEntry[] postDataEntries, 902 String mixedContentType, String initialPriority, String referrerPolicy, 903 Boolean isLinkPreload, Network.TrustTokenParams trustTokenParams, Boolean isSameSite 904 ) 905 { 906 // Exception-Check(s) to ensure that if any parameters which are not declared as 907 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 908 909 if (url == null) THROWS.throwNPE("url"); 910 if (method == null) THROWS.throwNPE("method"); 911 if (headers == null) THROWS.throwNPE("headers"); 912 if (initialPriority == null) THROWS.throwNPE("initialPriority"); 913 if (referrerPolicy == null) THROWS.throwNPE("referrerPolicy"); 914 915 // Exception-Check(s) to ensure that if any parameters which must adhere to a 916 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 917 918 THROWS.checkIAE("mixedContentType", mixedContentType, "Security.MixedContentType", Security.MixedContentType); 919 THROWS.checkIAE("initialPriority", initialPriority, "Network.ResourcePriority", Network.ResourcePriority); 920 THROWS.checkIAE( 921 "referrerPolicy", referrerPolicy, 922 "unsafe-url", "no-referrer-when-downgrade", "no-referrer", "origin", "origin-when-cross-origin", "same-origin", "strict-origin", "strict-origin-when-cross-origin" 923 ); 924 925 this.url = url; 926 this.urlFragment = urlFragment; 927 this.method = method; 928 this.headers = headers; 929 this.postData = postData; 930 this.hasPostData = hasPostData; 931 this.postDataEntries = postDataEntries; 932 this.mixedContentType = mixedContentType; 933 this.initialPriority = initialPriority; 934 this.referrerPolicy = referrerPolicy; 935 this.isLinkPreload = isLinkPreload; 936 this.trustTokenParams = trustTokenParams; 937 this.isSameSite = isSameSite; 938 } 939 940 /** 941 * JSON Object Constructor 942 * @param jo A Json-Object having data about an instance of {@code 'Request'}. 943 */ 944 public Request (JsonObject jo) 945 { 946 this.url = ReadJSON.getString(jo, "url", false, true); 947 this.urlFragment = ReadJSON.getString(jo, "urlFragment", true, false); 948 this.method = ReadJSON.getString(jo, "method", false, true); 949 this.headers = jo.getJsonObject("headers"); 950 this.postData = ReadJSON.getString(jo, "postData", true, false); 951 this.hasPostData = ReadBoxedJSON.getBoolean(jo, "hasPostData", true); 952 this.postDataEntries = (jo.getJsonArray("postDataEntries") == null) 953 ? null 954 : RJArrIntoStream.objArr(jo.getJsonArray("postDataEntries"), null, 0, Network.PostDataEntry.class).toArray(Network.PostDataEntry[]::new); 955 956 this.mixedContentType = ReadJSON.getString(jo, "mixedContentType", true, false); 957 this.initialPriority = ReadJSON.getString(jo, "initialPriority", false, true); 958 this.referrerPolicy = ReadJSON.getString(jo, "referrerPolicy", false, true); 959 this.isLinkPreload = ReadBoxedJSON.getBoolean(jo, "isLinkPreload", true); 960 this.trustTokenParams = ReadJSON.getObject(jo, "trustTokenParams", Network.TrustTokenParams.class, true, false); 961 this.isSameSite = ReadBoxedJSON.getBoolean(jo, "isSameSite", true); 962 } 963 964 965 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 966 public boolean equals(Object other) 967 { 968 if (this == other) return true; 969 if (other == null) return false; 970 if (other.getClass() != this.getClass()) return false; 971 972 Request o = (Request) other; 973 974 return 975 Objects.equals(this.url, o.url) 976 && Objects.equals(this.urlFragment, o.urlFragment) 977 && Objects.equals(this.method, o.method) 978 && Objects.equals(this.headers, o.headers) 979 && Objects.equals(this.postData, o.postData) 980 && Objects.equals(this.hasPostData, o.hasPostData) 981 && Arrays.deepEquals(this.postDataEntries, o.postDataEntries) 982 && Objects.equals(this.mixedContentType, o.mixedContentType) 983 && Objects.equals(this.initialPriority, o.initialPriority) 984 && Objects.equals(this.referrerPolicy, o.referrerPolicy) 985 && Objects.equals(this.isLinkPreload, o.isLinkPreload) 986 && Objects.equals(this.trustTokenParams, o.trustTokenParams) 987 && Objects.equals(this.isSameSite, o.isSameSite); 988 } 989 990 /** Generates a Hash-Code for {@code 'this'} instance */ 991 public int hashCode() 992 { 993 return 994 Objects.hashCode(this.url) 995 + Objects.hashCode(this.urlFragment) 996 + Objects.hashCode(this.method) 997 + this.headers.hashCode() 998 + Objects.hashCode(this.postData) 999 + Objects.hashCode(this.hasPostData) 1000 + Arrays.deepHashCode(this.postDataEntries) 1001 + Objects.hashCode(this.mixedContentType) 1002 + Objects.hashCode(this.initialPriority) 1003 + Objects.hashCode(this.referrerPolicy) 1004 + Objects.hashCode(this.isLinkPreload) 1005 + this.trustTokenParams.hashCode() 1006 + Objects.hashCode(this.isSameSite); 1007 } 1008 } 1009 1010 /** Details of a signed certificate timestamp (SCT). */ 1011 public static class SignedCertificateTimestamp 1012 extends BaseType 1013 implements java.io.Serializable 1014 { 1015 /** For Object Serialization. java.io.Serializable */ 1016 protected static final long serialVersionUID = 1; 1017 1018 public boolean[] optionals() 1019 { return new boolean[] { false, false, false, false, false, false, false, false, }; } 1020 1021 /** Validation status. */ 1022 public final String status; 1023 1024 /** Origin. */ 1025 public final String origin; 1026 1027 /** Log name / description. */ 1028 public final String logDescription; 1029 1030 /** Log ID. */ 1031 public final String logId; 1032 1033 /** Issuance date. */ 1034 public final Number timestamp; 1035 1036 /** Hash algorithm. */ 1037 public final String hashAlgorithm; 1038 1039 /** Signature algorithm. */ 1040 public final String signatureAlgorithm; 1041 1042 /** Signature data. */ 1043 public final String signatureData; 1044 1045 /** 1046 * Constructor 1047 * 1048 * @param status Validation status. 1049 * 1050 * @param origin Origin. 1051 * 1052 * @param logDescription Log name / description. 1053 * 1054 * @param logId Log ID. 1055 * 1056 * @param timestamp Issuance date. 1057 * 1058 * @param hashAlgorithm Hash algorithm. 1059 * 1060 * @param signatureAlgorithm Signature algorithm. 1061 * 1062 * @param signatureData Signature data. 1063 */ 1064 public SignedCertificateTimestamp( 1065 String status, String origin, String logDescription, String logId, Number timestamp, 1066 String hashAlgorithm, String signatureAlgorithm, String signatureData 1067 ) 1068 { 1069 // Exception-Check(s) to ensure that if any parameters which are not declared as 1070 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1071 1072 if (status == null) THROWS.throwNPE("status"); 1073 if (origin == null) THROWS.throwNPE("origin"); 1074 if (logDescription == null) THROWS.throwNPE("logDescription"); 1075 if (logId == null) THROWS.throwNPE("logId"); 1076 if (timestamp == null) THROWS.throwNPE("timestamp"); 1077 if (hashAlgorithm == null) THROWS.throwNPE("hashAlgorithm"); 1078 if (signatureAlgorithm == null) THROWS.throwNPE("signatureAlgorithm"); 1079 if (signatureData == null) THROWS.throwNPE("signatureData"); 1080 1081 this.status = status; 1082 this.origin = origin; 1083 this.logDescription = logDescription; 1084 this.logId = logId; 1085 this.timestamp = timestamp; 1086 this.hashAlgorithm = hashAlgorithm; 1087 this.signatureAlgorithm = signatureAlgorithm; 1088 this.signatureData = signatureData; 1089 } 1090 1091 /** 1092 * JSON Object Constructor 1093 * @param jo A Json-Object having data about an instance of {@code 'SignedCertificateTimestamp'}. 1094 */ 1095 public SignedCertificateTimestamp (JsonObject jo) 1096 { 1097 this.status = ReadJSON.getString(jo, "status", false, true); 1098 this.origin = ReadJSON.getString(jo, "origin", false, true); 1099 this.logDescription = ReadJSON.getString(jo, "logDescription", false, true); 1100 this.logId = ReadJSON.getString(jo, "logId", false, true); 1101 this.timestamp = ReadNumberJSON.get(jo, "timestamp", false, true); 1102 this.hashAlgorithm = ReadJSON.getString(jo, "hashAlgorithm", false, true); 1103 this.signatureAlgorithm = ReadJSON.getString(jo, "signatureAlgorithm", false, true); 1104 this.signatureData = ReadJSON.getString(jo, "signatureData", false, true); 1105 } 1106 1107 1108 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 1109 public boolean equals(Object other) 1110 { 1111 if (this == other) return true; 1112 if (other == null) return false; 1113 if (other.getClass() != this.getClass()) return false; 1114 1115 SignedCertificateTimestamp o = (SignedCertificateTimestamp) other; 1116 1117 return 1118 Objects.equals(this.status, o.status) 1119 && Objects.equals(this.origin, o.origin) 1120 && Objects.equals(this.logDescription, o.logDescription) 1121 && Objects.equals(this.logId, o.logId) 1122 && Objects.equals(this.timestamp, o.timestamp) 1123 && Objects.equals(this.hashAlgorithm, o.hashAlgorithm) 1124 && Objects.equals(this.signatureAlgorithm, o.signatureAlgorithm) 1125 && Objects.equals(this.signatureData, o.signatureData); 1126 } 1127 1128 /** Generates a Hash-Code for {@code 'this'} instance */ 1129 public int hashCode() 1130 { 1131 return 1132 Objects.hashCode(this.status) 1133 + Objects.hashCode(this.origin) 1134 + Objects.hashCode(this.logDescription) 1135 + Objects.hashCode(this.logId) 1136 + Objects.hashCode(this.timestamp) 1137 + Objects.hashCode(this.hashAlgorithm) 1138 + Objects.hashCode(this.signatureAlgorithm) 1139 + Objects.hashCode(this.signatureData); 1140 } 1141 } 1142 1143 /** Security details about a request. */ 1144 public static class SecurityDetails 1145 extends BaseType 1146 implements java.io.Serializable 1147 { 1148 /** For Object Serialization. java.io.Serializable */ 1149 protected static final long serialVersionUID = 1; 1150 1151 public boolean[] optionals() 1152 { return new boolean[] { false, false, true, false, true, false, false, false, false, false, false, false, false, }; } 1153 1154 /** Protocol name (e.g. "TLS 1.2" or "QUIC"). */ 1155 public final String protocol; 1156 1157 /** Key Exchange used by the connection, or the empty string if not applicable. */ 1158 public final String keyExchange; 1159 1160 /** 1161 * (EC)DH group used by the connection, if applicable. 1162 * <BR /> 1163 * <BR /><B>OPTIONAL</B> 1164 */ 1165 public final String keyExchangeGroup; 1166 1167 /** Cipher name. */ 1168 public final String cipher; 1169 1170 /** 1171 * TLS MAC. Note that AEAD ciphers do not have separate MACs. 1172 * <BR /> 1173 * <BR /><B>OPTIONAL</B> 1174 */ 1175 public final String mac; 1176 1177 /** Certificate ID value. */ 1178 public final int certificateId; 1179 1180 /** Certificate subject name. */ 1181 public final String subjectName; 1182 1183 /** Subject Alternative Name (SAN) DNS names and IP addresses. */ 1184 public final String[] sanList; 1185 1186 /** Name of the issuing CA. */ 1187 public final String issuer; 1188 1189 /** Certificate valid from date. */ 1190 public final Number validFrom; 1191 1192 /** Certificate valid to (expiration) date */ 1193 public final Number validTo; 1194 1195 /** List of signed certificate timestamps (SCTs). */ 1196 public final Network.SignedCertificateTimestamp[] signedCertificateTimestampList; 1197 1198 /** Whether the request complied with Certificate Transparency policy */ 1199 public final String certificateTransparencyCompliance; 1200 1201 /** 1202 * Constructor 1203 * 1204 * @param protocol Protocol name (e.g. "TLS 1.2" or "QUIC"). 1205 * 1206 * @param keyExchange Key Exchange used by the connection, or the empty string if not applicable. 1207 * 1208 * @param keyExchangeGroup (EC)DH group used by the connection, if applicable. 1209 * <BR /><B>OPTIONAL</B> 1210 * 1211 * @param cipher Cipher name. 1212 * 1213 * @param mac TLS MAC. Note that AEAD ciphers do not have separate MACs. 1214 * <BR /><B>OPTIONAL</B> 1215 * 1216 * @param certificateId Certificate ID value. 1217 * 1218 * @param subjectName Certificate subject name. 1219 * 1220 * @param sanList Subject Alternative Name (SAN) DNS names and IP addresses. 1221 * 1222 * @param issuer Name of the issuing CA. 1223 * 1224 * @param validFrom Certificate valid from date. 1225 * 1226 * @param validTo Certificate valid to (expiration) date 1227 * 1228 * @param signedCertificateTimestampList List of signed certificate timestamps (SCTs). 1229 * 1230 * @param certificateTransparencyCompliance Whether the request complied with Certificate Transparency policy 1231 */ 1232 public SecurityDetails( 1233 String protocol, String keyExchange, String keyExchangeGroup, String cipher, 1234 String mac, int certificateId, String subjectName, String[] sanList, String issuer, 1235 Number validFrom, Number validTo, 1236 Network.SignedCertificateTimestamp[] signedCertificateTimestampList, 1237 String certificateTransparencyCompliance 1238 ) 1239 { 1240 // Exception-Check(s) to ensure that if any parameters which are not declared as 1241 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1242 1243 if (protocol == null) THROWS.throwNPE("protocol"); 1244 if (keyExchange == null) THROWS.throwNPE("keyExchange"); 1245 if (cipher == null) THROWS.throwNPE("cipher"); 1246 if (subjectName == null) THROWS.throwNPE("subjectName"); 1247 if (sanList == null) THROWS.throwNPE("sanList"); 1248 if (issuer == null) THROWS.throwNPE("issuer"); 1249 if (validFrom == null) THROWS.throwNPE("validFrom"); 1250 if (validTo == null) THROWS.throwNPE("validTo"); 1251 if (signedCertificateTimestampList == null) THROWS.throwNPE("signedCertificateTimestampList"); 1252 if (certificateTransparencyCompliance == null) THROWS.throwNPE("certificateTransparencyCompliance"); 1253 1254 // Exception-Check(s) to ensure that if any parameters which must adhere to a 1255 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 1256 1257 THROWS.checkIAE("certificateTransparencyCompliance", certificateTransparencyCompliance, "Network.CertificateTransparencyCompliance", Network.CertificateTransparencyCompliance); 1258 1259 this.protocol = protocol; 1260 this.keyExchange = keyExchange; 1261 this.keyExchangeGroup = keyExchangeGroup; 1262 this.cipher = cipher; 1263 this.mac = mac; 1264 this.certificateId = certificateId; 1265 this.subjectName = subjectName; 1266 this.sanList = sanList; 1267 this.issuer = issuer; 1268 this.validFrom = validFrom; 1269 this.validTo = validTo; 1270 this.signedCertificateTimestampList = signedCertificateTimestampList; 1271 this.certificateTransparencyCompliance = certificateTransparencyCompliance; 1272 } 1273 1274 /** 1275 * JSON Object Constructor 1276 * @param jo A Json-Object having data about an instance of {@code 'SecurityDetails'}. 1277 */ 1278 public SecurityDetails (JsonObject jo) 1279 { 1280 this.protocol = ReadJSON.getString(jo, "protocol", false, true); 1281 this.keyExchange = ReadJSON.getString(jo, "keyExchange", false, true); 1282 this.keyExchangeGroup = ReadJSON.getString(jo, "keyExchangeGroup", true, false); 1283 this.cipher = ReadJSON.getString(jo, "cipher", false, true); 1284 this.mac = ReadJSON.getString(jo, "mac", true, false); 1285 this.certificateId = ReadPrimJSON.getInt(jo, "certificateId"); 1286 this.subjectName = ReadJSON.getString(jo, "subjectName", false, true); 1287 this.sanList = (jo.getJsonArray("sanList") == null) 1288 ? null 1289 : RJArrIntoStream.strArr(jo.getJsonArray("sanList"), null, 0).toArray(String[]::new); 1290 1291 this.issuer = ReadJSON.getString(jo, "issuer", false, true); 1292 this.validFrom = ReadNumberJSON.get(jo, "validFrom", false, true); 1293 this.validTo = ReadNumberJSON.get(jo, "validTo", false, true); 1294 this.signedCertificateTimestampList = (jo.getJsonArray("signedCertificateTimestampList") == null) 1295 ? null 1296 : RJArrIntoStream.objArr(jo.getJsonArray("signedCertificateTimestampList"), null, 0, Network.SignedCertificateTimestamp.class).toArray(Network.SignedCertificateTimestamp[]::new); 1297 1298 this.certificateTransparencyCompliance = ReadJSON.getString(jo, "certificateTransparencyCompliance", false, true); 1299 } 1300 1301 1302 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 1303 public boolean equals(Object other) 1304 { 1305 if (this == other) return true; 1306 if (other == null) return false; 1307 if (other.getClass() != this.getClass()) return false; 1308 1309 SecurityDetails o = (SecurityDetails) other; 1310 1311 return 1312 Objects.equals(this.protocol, o.protocol) 1313 && Objects.equals(this.keyExchange, o.keyExchange) 1314 && Objects.equals(this.keyExchangeGroup, o.keyExchangeGroup) 1315 && Objects.equals(this.cipher, o.cipher) 1316 && Objects.equals(this.mac, o.mac) 1317 && Objects.equals(this.certificateId, o.certificateId) 1318 && Objects.equals(this.subjectName, o.subjectName) 1319 && Arrays.deepEquals(this.sanList, o.sanList) 1320 && Objects.equals(this.issuer, o.issuer) 1321 && Objects.equals(this.validFrom, o.validFrom) 1322 && Objects.equals(this.validTo, o.validTo) 1323 && Arrays.deepEquals(this.signedCertificateTimestampList, o.signedCertificateTimestampList) 1324 && Objects.equals(this.certificateTransparencyCompliance, o.certificateTransparencyCompliance); 1325 } 1326 1327 /** Generates a Hash-Code for {@code 'this'} instance */ 1328 public int hashCode() 1329 { 1330 return 1331 Objects.hashCode(this.protocol) 1332 + Objects.hashCode(this.keyExchange) 1333 + Objects.hashCode(this.keyExchangeGroup) 1334 + Objects.hashCode(this.cipher) 1335 + Objects.hashCode(this.mac) 1336 + this.certificateId 1337 + Objects.hashCode(this.subjectName) 1338 + Arrays.deepHashCode(this.sanList) 1339 + Objects.hashCode(this.issuer) 1340 + Objects.hashCode(this.validFrom) 1341 + Objects.hashCode(this.validTo) 1342 + Arrays.deepHashCode(this.signedCertificateTimestampList) 1343 + Objects.hashCode(this.certificateTransparencyCompliance); 1344 } 1345 } 1346 1347 /** <CODE>[No Description Provided by Google]</CODE> */ 1348 public static class CorsErrorStatus 1349 extends BaseType 1350 implements java.io.Serializable 1351 { 1352 /** For Object Serialization. java.io.Serializable */ 1353 protected static final long serialVersionUID = 1; 1354 1355 public boolean[] optionals() 1356 { return new boolean[] { false, false, }; } 1357 1358 /** <CODE>[No Description Provided by Google]</CODE> */ 1359 public final String corsError; 1360 1361 /** <CODE>[No Description Provided by Google]</CODE> */ 1362 public final String failedParameter; 1363 1364 /** 1365 * Constructor 1366 * 1367 * @param corsError - 1368 * 1369 * @param failedParameter - 1370 */ 1371 public CorsErrorStatus(String corsError, String failedParameter) 1372 { 1373 // Exception-Check(s) to ensure that if any parameters which are not declared as 1374 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1375 1376 if (corsError == null) THROWS.throwNPE("corsError"); 1377 if (failedParameter == null) THROWS.throwNPE("failedParameter"); 1378 1379 // Exception-Check(s) to ensure that if any parameters which must adhere to a 1380 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 1381 1382 THROWS.checkIAE("corsError", corsError, "Network.CorsError", Network.CorsError); 1383 1384 this.corsError = corsError; 1385 this.failedParameter = failedParameter; 1386 } 1387 1388 /** 1389 * JSON Object Constructor 1390 * @param jo A Json-Object having data about an instance of {@code 'CorsErrorStatus'}. 1391 */ 1392 public CorsErrorStatus (JsonObject jo) 1393 { 1394 this.corsError = ReadJSON.getString(jo, "corsError", false, true); 1395 this.failedParameter = ReadJSON.getString(jo, "failedParameter", false, true); 1396 } 1397 1398 1399 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 1400 public boolean equals(Object other) 1401 { 1402 if (this == other) return true; 1403 if (other == null) return false; 1404 if (other.getClass() != this.getClass()) return false; 1405 1406 CorsErrorStatus o = (CorsErrorStatus) other; 1407 1408 return 1409 Objects.equals(this.corsError, o.corsError) 1410 && Objects.equals(this.failedParameter, o.failedParameter); 1411 } 1412 1413 /** Generates a Hash-Code for {@code 'this'} instance */ 1414 public int hashCode() 1415 { 1416 return 1417 Objects.hashCode(this.corsError) 1418 + Objects.hashCode(this.failedParameter); 1419 } 1420 } 1421 1422 /** 1423 * Determines what type of Trust Token operation is executed and 1424 * depending on the type, some additional parameters. The values 1425 * are specified in third_party/blink/renderer/core/fetch/trust_token.idl. 1426 * <BR /> 1427 * <BR /><B>EXPERIMENTAL</B> 1428 */ 1429 public static class TrustTokenParams 1430 extends BaseType 1431 implements java.io.Serializable 1432 { 1433 /** For Object Serialization. java.io.Serializable */ 1434 protected static final long serialVersionUID = 1; 1435 1436 public boolean[] optionals() 1437 { return new boolean[] { false, false, true, }; } 1438 1439 /** <CODE>[No Description Provided by Google]</CODE> */ 1440 public final String type; 1441 1442 /** 1443 * Only set for "token-redemption" type and determine whether 1444 * to request a fresh SRR or use a still valid cached SRR. 1445 */ 1446 public final String refreshPolicy; 1447 1448 /** 1449 * Origins of issuers from whom to request tokens or redemption 1450 * records. 1451 * <BR /> 1452 * <BR /><B>OPTIONAL</B> 1453 */ 1454 public final String[] issuers; 1455 1456 /** 1457 * Constructor 1458 * 1459 * @param type - 1460 * 1461 * @param refreshPolicy 1462 * Only set for "token-redemption" type and determine whether 1463 * to request a fresh SRR or use a still valid cached SRR. 1464 * <BR />Acceptable Values: ["UseCached", "Refresh"] 1465 * 1466 * @param issuers 1467 * Origins of issuers from whom to request tokens or redemption 1468 * records. 1469 * <BR /><B>OPTIONAL</B> 1470 */ 1471 public TrustTokenParams(String type, String refreshPolicy, String[] issuers) 1472 { 1473 // Exception-Check(s) to ensure that if any parameters which are not declared as 1474 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1475 1476 if (type == null) THROWS.throwNPE("type"); 1477 if (refreshPolicy == null) THROWS.throwNPE("refreshPolicy"); 1478 1479 // Exception-Check(s) to ensure that if any parameters which must adhere to a 1480 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 1481 1482 THROWS.checkIAE("type", type, "Network.TrustTokenOperationType", Network.TrustTokenOperationType); 1483 THROWS.checkIAE( 1484 "refreshPolicy", refreshPolicy, 1485 "UseCached", "Refresh" 1486 ); 1487 1488 this.type = type; 1489 this.refreshPolicy = refreshPolicy; 1490 this.issuers = issuers; 1491 } 1492 1493 /** 1494 * JSON Object Constructor 1495 * @param jo A Json-Object having data about an instance of {@code 'TrustTokenParams'}. 1496 */ 1497 public TrustTokenParams (JsonObject jo) 1498 { 1499 this.type = ReadJSON.getString(jo, "type", false, true); 1500 this.refreshPolicy = ReadJSON.getString(jo, "refreshPolicy", false, true); 1501 this.issuers = (jo.getJsonArray("issuers") == null) 1502 ? null 1503 : RJArrIntoStream.strArr(jo.getJsonArray("issuers"), null, 0).toArray(String[]::new); 1504 1505 } 1506 1507 1508 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 1509 public boolean equals(Object other) 1510 { 1511 if (this == other) return true; 1512 if (other == null) return false; 1513 if (other.getClass() != this.getClass()) return false; 1514 1515 TrustTokenParams o = (TrustTokenParams) other; 1516 1517 return 1518 Objects.equals(this.type, o.type) 1519 && Objects.equals(this.refreshPolicy, o.refreshPolicy) 1520 && Arrays.deepEquals(this.issuers, o.issuers); 1521 } 1522 1523 /** Generates a Hash-Code for {@code 'this'} instance */ 1524 public int hashCode() 1525 { 1526 return 1527 Objects.hashCode(this.type) 1528 + Objects.hashCode(this.refreshPolicy) 1529 + Arrays.deepHashCode(this.issuers); 1530 } 1531 } 1532 1533 /** HTTP response data. */ 1534 public static class Response 1535 extends BaseType 1536 implements java.io.Serializable 1537 { 1538 /** For Object Serialization. java.io.Serializable */ 1539 protected static final long serialVersionUID = 1; 1540 1541 public boolean[] optionals() 1542 { return new boolean[] { false, false, false, false, true, false, true, true, false, false, true, true, true, true, true, false, true, true, true, true, true, false, true, }; } 1543 1544 /** Response URL. This URL can be different from CachedResource.url in case of redirect. */ 1545 public final String url; 1546 1547 /** HTTP response status code. */ 1548 public final int status; 1549 1550 /** HTTP response status text. */ 1551 public final String statusText; 1552 1553 /** HTTP response headers. */ 1554 public final JsonObject headers; 1555 1556 /** 1557 * HTTP response headers text. This has been replaced by the headers in Network.responseReceivedExtraInfo. 1558 * <BR /> 1559 * <BR /><B>OPTIONAL</B> 1560 * <BR /><B>DEPRECATED</B> 1561 */ 1562 public final String headersText; 1563 1564 /** Resource mimeType as determined by the browser. */ 1565 public final String mimeType; 1566 1567 /** 1568 * Refined HTTP request headers that were actually transmitted over the network. 1569 * <BR /> 1570 * <BR /><B>OPTIONAL</B> 1571 */ 1572 public final JsonObject requestHeaders; 1573 1574 /** 1575 * HTTP request headers text. This has been replaced by the headers in Network.requestWillBeSentExtraInfo. 1576 * <BR /> 1577 * <BR /><B>OPTIONAL</B> 1578 * <BR /><B>DEPRECATED</B> 1579 */ 1580 public final String requestHeadersText; 1581 1582 /** Specifies whether physical connection was actually reused for this request. */ 1583 public final boolean connectionReused; 1584 1585 /** Physical connection id that was actually used for this request. */ 1586 public final Number connectionId; 1587 1588 /** 1589 * Remote IP address. 1590 * <BR /> 1591 * <BR /><B>OPTIONAL</B> 1592 */ 1593 public final String remoteIPAddress; 1594 1595 /** 1596 * Remote port. 1597 * <BR /> 1598 * <BR /><B>OPTIONAL</B> 1599 */ 1600 public final Integer remotePort; 1601 1602 /** 1603 * Specifies that the request was served from the disk cache. 1604 * <BR /> 1605 * <BR /><B>OPTIONAL</B> 1606 */ 1607 public final Boolean fromDiskCache; 1608 1609 /** 1610 * Specifies that the request was served from the ServiceWorker. 1611 * <BR /> 1612 * <BR /><B>OPTIONAL</B> 1613 */ 1614 public final Boolean fromServiceWorker; 1615 1616 /** 1617 * Specifies that the request was served from the prefetch cache. 1618 * <BR /> 1619 * <BR /><B>OPTIONAL</B> 1620 */ 1621 public final Boolean fromPrefetchCache; 1622 1623 /** Total number of bytes received for this request so far. */ 1624 public final Number encodedDataLength; 1625 1626 /** 1627 * Timing information for the given request. 1628 * <BR /> 1629 * <BR /><B>OPTIONAL</B> 1630 */ 1631 public final Network.ResourceTiming timing; 1632 1633 /** 1634 * Response source of response from ServiceWorker. 1635 * <BR /> 1636 * <BR /><B>OPTIONAL</B> 1637 */ 1638 public final String serviceWorkerResponseSource; 1639 1640 /** 1641 * The time at which the returned response was generated. 1642 * <BR /> 1643 * <BR /><B>OPTIONAL</B> 1644 */ 1645 public final Number responseTime; 1646 1647 /** 1648 * Cache Storage Cache Name. 1649 * <BR /> 1650 * <BR /><B>OPTIONAL</B> 1651 */ 1652 public final String cacheStorageCacheName; 1653 1654 /** 1655 * Protocol used to fetch this request. 1656 * <BR /> 1657 * <BR /><B>OPTIONAL</B> 1658 */ 1659 public final String protocol; 1660 1661 /** Security state of the request resource. */ 1662 public final String securityState; 1663 1664 /** 1665 * Security details for the request. 1666 * <BR /> 1667 * <BR /><B>OPTIONAL</B> 1668 */ 1669 public final Network.SecurityDetails securityDetails; 1670 1671 /** 1672 * Constructor 1673 * 1674 * @param url Response URL. This URL can be different from CachedResource.url in case of redirect. 1675 * 1676 * @param status HTTP response status code. 1677 * 1678 * @param statusText HTTP response status text. 1679 * 1680 * @param headers HTTP response headers. 1681 * 1682 * @param headersText HTTP response headers text. This has been replaced by the headers in Network.responseReceivedExtraInfo. 1683 * <BR /><B>OPTIONAL</B> 1684 * <BR /><B>DEPRECATED</B> 1685 * 1686 * @param mimeType Resource mimeType as determined by the browser. 1687 * 1688 * @param requestHeaders Refined HTTP request headers that were actually transmitted over the network. 1689 * <BR /><B>OPTIONAL</B> 1690 * 1691 * @param requestHeadersText HTTP request headers text. This has been replaced by the headers in Network.requestWillBeSentExtraInfo. 1692 * <BR /><B>OPTIONAL</B> 1693 * <BR /><B>DEPRECATED</B> 1694 * 1695 * @param connectionReused Specifies whether physical connection was actually reused for this request. 1696 * 1697 * @param connectionId Physical connection id that was actually used for this request. 1698 * 1699 * @param remoteIPAddress Remote IP address. 1700 * <BR /><B>OPTIONAL</B> 1701 * 1702 * @param remotePort Remote port. 1703 * <BR /><B>OPTIONAL</B> 1704 * 1705 * @param fromDiskCache Specifies that the request was served from the disk cache. 1706 * <BR /><B>OPTIONAL</B> 1707 * 1708 * @param fromServiceWorker Specifies that the request was served from the ServiceWorker. 1709 * <BR /><B>OPTIONAL</B> 1710 * 1711 * @param fromPrefetchCache Specifies that the request was served from the prefetch cache. 1712 * <BR /><B>OPTIONAL</B> 1713 * 1714 * @param encodedDataLength Total number of bytes received for this request so far. 1715 * 1716 * @param timing Timing information for the given request. 1717 * <BR /><B>OPTIONAL</B> 1718 * 1719 * @param serviceWorkerResponseSource Response source of response from ServiceWorker. 1720 * <BR /><B>OPTIONAL</B> 1721 * 1722 * @param responseTime The time at which the returned response was generated. 1723 * <BR /><B>OPTIONAL</B> 1724 * 1725 * @param cacheStorageCacheName Cache Storage Cache Name. 1726 * <BR /><B>OPTIONAL</B> 1727 * 1728 * @param protocol Protocol used to fetch this request. 1729 * <BR /><B>OPTIONAL</B> 1730 * 1731 * @param securityState Security state of the request resource. 1732 * 1733 * @param securityDetails Security details for the request. 1734 * <BR /><B>OPTIONAL</B> 1735 */ 1736 public Response( 1737 String url, int status, String statusText, JsonObject headers, String headersText, 1738 String mimeType, JsonObject requestHeaders, String requestHeadersText, 1739 boolean connectionReused, Number connectionId, String remoteIPAddress, 1740 Integer remotePort, Boolean fromDiskCache, Boolean fromServiceWorker, 1741 Boolean fromPrefetchCache, Number encodedDataLength, Network.ResourceTiming timing, 1742 String serviceWorkerResponseSource, Number responseTime, 1743 String cacheStorageCacheName, String protocol, String securityState, 1744 Network.SecurityDetails securityDetails 1745 ) 1746 { 1747 // Exception-Check(s) to ensure that if any parameters which are not declared as 1748 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1749 1750 if (url == null) THROWS.throwNPE("url"); 1751 if (statusText == null) THROWS.throwNPE("statusText"); 1752 if (headers == null) THROWS.throwNPE("headers"); 1753 if (mimeType == null) THROWS.throwNPE("mimeType"); 1754 if (connectionId == null) THROWS.throwNPE("connectionId"); 1755 if (encodedDataLength == null) THROWS.throwNPE("encodedDataLength"); 1756 if (securityState == null) THROWS.throwNPE("securityState"); 1757 1758 // Exception-Check(s) to ensure that if any parameters which must adhere to a 1759 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 1760 1761 THROWS.checkIAE("serviceWorkerResponseSource", serviceWorkerResponseSource, "Network.ServiceWorkerResponseSource", Network.ServiceWorkerResponseSource); 1762 THROWS.checkIAE("securityState", securityState, "Security.SecurityState", Security.SecurityState); 1763 1764 this.url = url; 1765 this.status = status; 1766 this.statusText = statusText; 1767 this.headers = headers; 1768 this.headersText = headersText; 1769 this.mimeType = mimeType; 1770 this.requestHeaders = requestHeaders; 1771 this.requestHeadersText = requestHeadersText; 1772 this.connectionReused = connectionReused; 1773 this.connectionId = connectionId; 1774 this.remoteIPAddress = remoteIPAddress; 1775 this.remotePort = remotePort; 1776 this.fromDiskCache = fromDiskCache; 1777 this.fromServiceWorker = fromServiceWorker; 1778 this.fromPrefetchCache = fromPrefetchCache; 1779 this.encodedDataLength = encodedDataLength; 1780 this.timing = timing; 1781 this.serviceWorkerResponseSource = serviceWorkerResponseSource; 1782 this.responseTime = responseTime; 1783 this.cacheStorageCacheName = cacheStorageCacheName; 1784 this.protocol = protocol; 1785 this.securityState = securityState; 1786 this.securityDetails = securityDetails; 1787 } 1788 1789 /** 1790 * JSON Object Constructor 1791 * @param jo A Json-Object having data about an instance of {@code 'Response'}. 1792 */ 1793 public Response (JsonObject jo) 1794 { 1795 this.url = ReadJSON.getString(jo, "url", false, true); 1796 this.status = ReadPrimJSON.getInt(jo, "status"); 1797 this.statusText = ReadJSON.getString(jo, "statusText", false, true); 1798 this.headers = jo.getJsonObject("headers"); 1799 this.headersText = ReadJSON.getString(jo, "headersText", true, false); 1800 this.mimeType = ReadJSON.getString(jo, "mimeType", false, true); 1801 this.requestHeaders = jo.getJsonObject("requestHeaders"); 1802 this.requestHeadersText = ReadJSON.getString(jo, "requestHeadersText", true, false); 1803 this.connectionReused = ReadPrimJSON.getBoolean(jo, "connectionReused"); 1804 this.connectionId = ReadNumberJSON.get(jo, "connectionId", false, true); 1805 this.remoteIPAddress = ReadJSON.getString(jo, "remoteIPAddress", true, false); 1806 this.remotePort = ReadBoxedJSON.getInteger(jo, "remotePort", true); 1807 this.fromDiskCache = ReadBoxedJSON.getBoolean(jo, "fromDiskCache", true); 1808 this.fromServiceWorker = ReadBoxedJSON.getBoolean(jo, "fromServiceWorker", true); 1809 this.fromPrefetchCache = ReadBoxedJSON.getBoolean(jo, "fromPrefetchCache", true); 1810 this.encodedDataLength = ReadNumberJSON.get(jo, "encodedDataLength", false, true); 1811 this.timing = ReadJSON.getObject(jo, "timing", Network.ResourceTiming.class, true, false); 1812 this.serviceWorkerResponseSource = ReadJSON.getString(jo, "serviceWorkerResponseSource", true, false); 1813 this.responseTime = ReadNumberJSON.get(jo, "responseTime", true, false); 1814 this.cacheStorageCacheName = ReadJSON.getString(jo, "cacheStorageCacheName", true, false); 1815 this.protocol = ReadJSON.getString(jo, "protocol", true, false); 1816 this.securityState = ReadJSON.getString(jo, "securityState", false, true); 1817 this.securityDetails = ReadJSON.getObject(jo, "securityDetails", Network.SecurityDetails.class, true, false); 1818 } 1819 1820 1821 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 1822 public boolean equals(Object other) 1823 { 1824 if (this == other) return true; 1825 if (other == null) return false; 1826 if (other.getClass() != this.getClass()) return false; 1827 1828 Response o = (Response) other; 1829 1830 return 1831 Objects.equals(this.url, o.url) 1832 && (this.status == o.status) 1833 && Objects.equals(this.statusText, o.statusText) 1834 && Objects.equals(this.headers, o.headers) 1835 && Objects.equals(this.headersText, o.headersText) 1836 && Objects.equals(this.mimeType, o.mimeType) 1837 && Objects.equals(this.requestHeaders, o.requestHeaders) 1838 && Objects.equals(this.requestHeadersText, o.requestHeadersText) 1839 && (this.connectionReused == o.connectionReused) 1840 && Objects.equals(this.connectionId, o.connectionId) 1841 && Objects.equals(this.remoteIPAddress, o.remoteIPAddress) 1842 && Objects.equals(this.remotePort, o.remotePort) 1843 && Objects.equals(this.fromDiskCache, o.fromDiskCache) 1844 && Objects.equals(this.fromServiceWorker, o.fromServiceWorker) 1845 && Objects.equals(this.fromPrefetchCache, o.fromPrefetchCache) 1846 && Objects.equals(this.encodedDataLength, o.encodedDataLength) 1847 && Objects.equals(this.timing, o.timing) 1848 && Objects.equals(this.serviceWorkerResponseSource, o.serviceWorkerResponseSource) 1849 && Objects.equals(this.responseTime, o.responseTime) 1850 && Objects.equals(this.cacheStorageCacheName, o.cacheStorageCacheName) 1851 && Objects.equals(this.protocol, o.protocol) 1852 && Objects.equals(this.securityState, o.securityState) 1853 && Objects.equals(this.securityDetails, o.securityDetails); 1854 } 1855 1856 /** Generates a Hash-Code for {@code 'this'} instance */ 1857 public int hashCode() 1858 { 1859 return 1860 Objects.hashCode(this.url) 1861 + this.status 1862 + Objects.hashCode(this.statusText) 1863 + this.headers.hashCode() 1864 + Objects.hashCode(this.headersText) 1865 + Objects.hashCode(this.mimeType) 1866 + this.requestHeaders.hashCode() 1867 + Objects.hashCode(this.requestHeadersText) 1868 + (this.connectionReused ? 1 : 0) 1869 + Objects.hashCode(this.connectionId) 1870 + Objects.hashCode(this.remoteIPAddress) 1871 + Objects.hashCode(this.remotePort) 1872 + Objects.hashCode(this.fromDiskCache) 1873 + Objects.hashCode(this.fromServiceWorker) 1874 + Objects.hashCode(this.fromPrefetchCache) 1875 + Objects.hashCode(this.encodedDataLength) 1876 + this.timing.hashCode() 1877 + Objects.hashCode(this.serviceWorkerResponseSource) 1878 + Objects.hashCode(this.responseTime) 1879 + Objects.hashCode(this.cacheStorageCacheName) 1880 + Objects.hashCode(this.protocol) 1881 + Objects.hashCode(this.securityState) 1882 + this.securityDetails.hashCode(); 1883 } 1884 } 1885 1886 /** WebSocket request data. */ 1887 public static class WebSocketRequest 1888 extends BaseType 1889 implements java.io.Serializable 1890 { 1891 /** For Object Serialization. java.io.Serializable */ 1892 protected static final long serialVersionUID = 1; 1893 1894 public boolean[] optionals() 1895 { return new boolean[] { false, }; } 1896 1897 /** HTTP request headers. */ 1898 public final JsonObject headers; 1899 1900 /** 1901 * Constructor 1902 * 1903 * @param headers HTTP request headers. 1904 */ 1905 public WebSocketRequest(JsonObject headers) 1906 { 1907 // Exception-Check(s) to ensure that if any parameters which are not declared as 1908 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1909 1910 if (headers == null) THROWS.throwNPE("headers"); 1911 1912 this.headers = headers; 1913 } 1914 1915 1916 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 1917 public boolean equals(Object other) 1918 { 1919 if (this == other) return true; 1920 if (other == null) return false; 1921 if (other.getClass() != this.getClass()) return false; 1922 1923 WebSocketRequest o = (WebSocketRequest) other; 1924 1925 return 1926 Objects.equals(this.headers, o.headers); 1927 } 1928 1929 /** Generates a Hash-Code for {@code 'this'} instance */ 1930 public int hashCode() 1931 { 1932 return 1933 this.headers.hashCode(); 1934 } 1935 } 1936 1937 /** WebSocket response data. */ 1938 public static class WebSocketResponse 1939 extends BaseType 1940 implements java.io.Serializable 1941 { 1942 /** For Object Serialization. java.io.Serializable */ 1943 protected static final long serialVersionUID = 1; 1944 1945 public boolean[] optionals() 1946 { return new boolean[] { false, false, false, true, true, true, }; } 1947 1948 /** HTTP response status code. */ 1949 public final int status; 1950 1951 /** HTTP response status text. */ 1952 public final String statusText; 1953 1954 /** HTTP response headers. */ 1955 public final JsonObject headers; 1956 1957 /** 1958 * HTTP response headers text. 1959 * <BR /> 1960 * <BR /><B>OPTIONAL</B> 1961 */ 1962 public final String headersText; 1963 1964 /** 1965 * HTTP request headers. 1966 * <BR /> 1967 * <BR /><B>OPTIONAL</B> 1968 */ 1969 public final JsonObject requestHeaders; 1970 1971 /** 1972 * HTTP request headers text. 1973 * <BR /> 1974 * <BR /><B>OPTIONAL</B> 1975 */ 1976 public final String requestHeadersText; 1977 1978 /** 1979 * Constructor 1980 * 1981 * @param status HTTP response status code. 1982 * 1983 * @param statusText HTTP response status text. 1984 * 1985 * @param headers HTTP response headers. 1986 * 1987 * @param headersText HTTP response headers text. 1988 * <BR /><B>OPTIONAL</B> 1989 * 1990 * @param requestHeaders HTTP request headers. 1991 * <BR /><B>OPTIONAL</B> 1992 * 1993 * @param requestHeadersText HTTP request headers text. 1994 * <BR /><B>OPTIONAL</B> 1995 */ 1996 public WebSocketResponse( 1997 int status, String statusText, JsonObject headers, String headersText, 1998 JsonObject requestHeaders, String requestHeadersText 1999 ) 2000 { 2001 // Exception-Check(s) to ensure that if any parameters which are not declared as 2002 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 2003 2004 if (statusText == null) THROWS.throwNPE("statusText"); 2005 if (headers == null) THROWS.throwNPE("headers"); 2006 2007 this.status = status; 2008 this.statusText = statusText; 2009 this.headers = headers; 2010 this.headersText = headersText; 2011 this.requestHeaders = requestHeaders; 2012 this.requestHeadersText = requestHeadersText; 2013 } 2014 2015 /** 2016 * JSON Object Constructor 2017 * @param jo A Json-Object having data about an instance of {@code 'WebSocketResponse'}. 2018 */ 2019 public WebSocketResponse (JsonObject jo) 2020 { 2021 this.status = ReadPrimJSON.getInt(jo, "status"); 2022 this.statusText = ReadJSON.getString(jo, "statusText", false, true); 2023 this.headers = jo.getJsonObject("headers"); 2024 this.headersText = ReadJSON.getString(jo, "headersText", true, false); 2025 this.requestHeaders = jo.getJsonObject("requestHeaders"); 2026 this.requestHeadersText = ReadJSON.getString(jo, "requestHeadersText", true, false); 2027 } 2028 2029 2030 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 2031 public boolean equals(Object other) 2032 { 2033 if (this == other) return true; 2034 if (other == null) return false; 2035 if (other.getClass() != this.getClass()) return false; 2036 2037 WebSocketResponse o = (WebSocketResponse) other; 2038 2039 return 2040 (this.status == o.status) 2041 && Objects.equals(this.statusText, o.statusText) 2042 && Objects.equals(this.headers, o.headers) 2043 && Objects.equals(this.headersText, o.headersText) 2044 && Objects.equals(this.requestHeaders, o.requestHeaders) 2045 && Objects.equals(this.requestHeadersText, o.requestHeadersText); 2046 } 2047 2048 /** Generates a Hash-Code for {@code 'this'} instance */ 2049 public int hashCode() 2050 { 2051 return 2052 this.status 2053 + Objects.hashCode(this.statusText) 2054 + this.headers.hashCode() 2055 + Objects.hashCode(this.headersText) 2056 + this.requestHeaders.hashCode() 2057 + Objects.hashCode(this.requestHeadersText); 2058 } 2059 } 2060 2061 /** WebSocket message data. This represents an entire WebSocket message, not just a fragmented frame as the name suggests. */ 2062 public static class WebSocketFrame 2063 extends BaseType 2064 implements java.io.Serializable 2065 { 2066 /** For Object Serialization. java.io.Serializable */ 2067 protected static final long serialVersionUID = 1; 2068 2069 public boolean[] optionals() 2070 { return new boolean[] { false, false, false, }; } 2071 2072 /** WebSocket message opcode. */ 2073 public final Number opcode; 2074 2075 /** WebSocket message mask. */ 2076 public final boolean mask; 2077 2078 /** 2079 * WebSocket message payload data. 2080 * If the opcode is 1, this is a text message and payloadData is a UTF-8 string. 2081 * If the opcode isn't 1, then payloadData is a base64 encoded string representing binary data. 2082 */ 2083 public final String payloadData; 2084 2085 /** 2086 * Constructor 2087 * 2088 * @param opcode WebSocket message opcode. 2089 * 2090 * @param mask WebSocket message mask. 2091 * 2092 * @param payloadData 2093 * WebSocket message payload data. 2094 * If the opcode is 1, this is a text message and payloadData is a UTF-8 string. 2095 * If the opcode isn't 1, then payloadData is a base64 encoded string representing binary data. 2096 */ 2097 public WebSocketFrame(Number opcode, boolean mask, String payloadData) 2098 { 2099 // Exception-Check(s) to ensure that if any parameters which are not declared as 2100 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 2101 2102 if (opcode == null) THROWS.throwNPE("opcode"); 2103 if (payloadData == null) THROWS.throwNPE("payloadData"); 2104 2105 this.opcode = opcode; 2106 this.mask = mask; 2107 this.payloadData = payloadData; 2108 } 2109 2110 /** 2111 * JSON Object Constructor 2112 * @param jo A Json-Object having data about an instance of {@code 'WebSocketFrame'}. 2113 */ 2114 public WebSocketFrame (JsonObject jo) 2115 { 2116 this.opcode = ReadNumberJSON.get(jo, "opcode", false, true); 2117 this.mask = ReadPrimJSON.getBoolean(jo, "mask"); 2118 this.payloadData = ReadJSON.getString(jo, "payloadData", false, true); 2119 } 2120 2121 2122 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 2123 public boolean equals(Object other) 2124 { 2125 if (this == other) return true; 2126 if (other == null) return false; 2127 if (other.getClass() != this.getClass()) return false; 2128 2129 WebSocketFrame o = (WebSocketFrame) other; 2130 2131 return 2132 Objects.equals(this.opcode, o.opcode) 2133 && (this.mask == o.mask) 2134 && Objects.equals(this.payloadData, o.payloadData); 2135 } 2136 2137 /** Generates a Hash-Code for {@code 'this'} instance */ 2138 public int hashCode() 2139 { 2140 return 2141 Objects.hashCode(this.opcode) 2142 + (this.mask ? 1 : 0) 2143 + Objects.hashCode(this.payloadData); 2144 } 2145 } 2146 2147 /** Information about the cached resource. */ 2148 public static class CachedResource 2149 extends BaseType 2150 implements java.io.Serializable 2151 { 2152 /** For Object Serialization. java.io.Serializable */ 2153 protected static final long serialVersionUID = 1; 2154 2155 public boolean[] optionals() 2156 { return new boolean[] { false, false, true, false, }; } 2157 2158 /** Resource URL. This is the url of the original network request. */ 2159 public final String url; 2160 2161 /** Type of this resource. */ 2162 public final String type; 2163 2164 /** 2165 * Cached response data. 2166 * <BR /> 2167 * <BR /><B>OPTIONAL</B> 2168 */ 2169 public final Network.Response response; 2170 2171 /** Cached response body size. */ 2172 public final Number bodySize; 2173 2174 /** 2175 * Constructor 2176 * 2177 * @param url Resource URL. This is the url of the original network request. 2178 * 2179 * @param type Type of this resource. 2180 * 2181 * @param response Cached response data. 2182 * <BR /><B>OPTIONAL</B> 2183 * 2184 * @param bodySize Cached response body size. 2185 */ 2186 public CachedResource 2187 (String url, String type, Network.Response response, Number bodySize) 2188 { 2189 // Exception-Check(s) to ensure that if any parameters which are not declared as 2190 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 2191 2192 if (url == null) THROWS.throwNPE("url"); 2193 if (type == null) THROWS.throwNPE("type"); 2194 if (bodySize == null) THROWS.throwNPE("bodySize"); 2195 2196 // Exception-Check(s) to ensure that if any parameters which must adhere to a 2197 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 2198 2199 THROWS.checkIAE("type", type, "Network.ResourceType", Network.ResourceType); 2200 2201 this.url = url; 2202 this.type = type; 2203 this.response = response; 2204 this.bodySize = bodySize; 2205 } 2206 2207 /** 2208 * JSON Object Constructor 2209 * @param jo A Json-Object having data about an instance of {@code 'CachedResource'}. 2210 */ 2211 public CachedResource (JsonObject jo) 2212 { 2213 this.url = ReadJSON.getString(jo, "url", false, true); 2214 this.type = ReadJSON.getString(jo, "type", false, true); 2215 this.response = ReadJSON.getObject(jo, "response", Network.Response.class, true, false); 2216 this.bodySize = ReadNumberJSON.get(jo, "bodySize", false, true); 2217 } 2218 2219 2220 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 2221 public boolean equals(Object other) 2222 { 2223 if (this == other) return true; 2224 if (other == null) return false; 2225 if (other.getClass() != this.getClass()) return false; 2226 2227 CachedResource o = (CachedResource) other; 2228 2229 return 2230 Objects.equals(this.url, o.url) 2231 && Objects.equals(this.type, o.type) 2232 && Objects.equals(this.response, o.response) 2233 && Objects.equals(this.bodySize, o.bodySize); 2234 } 2235 2236 /** Generates a Hash-Code for {@code 'this'} instance */ 2237 public int hashCode() 2238 { 2239 return 2240 Objects.hashCode(this.url) 2241 + Objects.hashCode(this.type) 2242 + this.response.hashCode() 2243 + Objects.hashCode(this.bodySize); 2244 } 2245 } 2246 2247 /** Information about the request initiator. */ 2248 public static class Initiator 2249 extends BaseType 2250 implements java.io.Serializable 2251 { 2252 /** For Object Serialization. java.io.Serializable */ 2253 protected static final long serialVersionUID = 1; 2254 2255 public boolean[] optionals() 2256 { return new boolean[] { false, true, true, true, true, true, }; } 2257 2258 /** Type of this initiator. */ 2259 public final String type; 2260 2261 /** 2262 * Initiator JavaScript stack trace, set for Script only. 2263 * <BR /> 2264 * <BR /><B>OPTIONAL</B> 2265 */ 2266 public final RunTime.StackTrace stack; 2267 2268 /** 2269 * Initiator URL, set for Parser type or for Script type (when script is importing module) or for SignedExchange type. 2270 * <BR /> 2271 * <BR /><B>OPTIONAL</B> 2272 */ 2273 public final String url; 2274 2275 /** 2276 * Initiator line number, set for Parser type or for Script type (when script is importing 2277 * module) (0-based). 2278 * <BR /> 2279 * <BR /><B>OPTIONAL</B> 2280 */ 2281 public final Number lineNumber; 2282 2283 /** 2284 * Initiator column number, set for Parser type or for Script type (when script is importing 2285 * module) (0-based). 2286 * <BR /> 2287 * <BR /><B>OPTIONAL</B> 2288 */ 2289 public final Number columnNumber; 2290 2291 /** 2292 * Set if another request triggered this request (e.g. preflight). 2293 * <BR /> 2294 * <BR /><B>OPTIONAL</B> 2295 */ 2296 public final String requestId; 2297 2298 /** 2299 * Constructor 2300 * 2301 * @param type Type of this initiator. 2302 * <BR />Acceptable Values: ["parser", "script", "preload", "SignedExchange", "preflight", "other"] 2303 * 2304 * @param stack Initiator JavaScript stack trace, set for Script only. 2305 * <BR /><B>OPTIONAL</B> 2306 * 2307 * @param url Initiator URL, set for Parser type or for Script type (when script is importing module) or for SignedExchange type. 2308 * <BR /><B>OPTIONAL</B> 2309 * 2310 * @param lineNumber 2311 * Initiator line number, set for Parser type or for Script type (when script is importing 2312 * module) (0-based). 2313 * <BR /><B>OPTIONAL</B> 2314 * 2315 * @param columnNumber 2316 * Initiator column number, set for Parser type or for Script type (when script is importing 2317 * module) (0-based). 2318 * <BR /><B>OPTIONAL</B> 2319 * 2320 * @param requestId Set if another request triggered this request (e.g. preflight). 2321 * <BR /><B>OPTIONAL</B> 2322 */ 2323 public Initiator( 2324 String type, RunTime.StackTrace stack, String url, Number lineNumber, 2325 Number columnNumber, String requestId 2326 ) 2327 { 2328 // Exception-Check(s) to ensure that if any parameters which are not declared as 2329 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 2330 2331 if (type == null) THROWS.throwNPE("type"); 2332 2333 // Exception-Check(s) to ensure that if any parameters which must adhere to a 2334 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 2335 2336 THROWS.checkIAE( 2337 "type", type, 2338 "parser", "script", "preload", "SignedExchange", "preflight", "other" 2339 ); 2340 2341 this.type = type; 2342 this.stack = stack; 2343 this.url = url; 2344 this.lineNumber = lineNumber; 2345 this.columnNumber = columnNumber; 2346 this.requestId = requestId; 2347 } 2348 2349 /** 2350 * JSON Object Constructor 2351 * @param jo A Json-Object having data about an instance of {@code 'Initiator'}. 2352 */ 2353 public Initiator (JsonObject jo) 2354 { 2355 this.type = ReadJSON.getString(jo, "type", false, true); 2356 this.stack = ReadJSON.getObject(jo, "stack", RunTime.StackTrace.class, true, false); 2357 this.url = ReadJSON.getString(jo, "url", true, false); 2358 this.lineNumber = ReadNumberJSON.get(jo, "lineNumber", true, false); 2359 this.columnNumber = ReadNumberJSON.get(jo, "columnNumber", true, false); 2360 this.requestId = ReadJSON.getString(jo, "requestId", true, false); 2361 } 2362 2363 2364 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 2365 public boolean equals(Object other) 2366 { 2367 if (this == other) return true; 2368 if (other == null) return false; 2369 if (other.getClass() != this.getClass()) return false; 2370 2371 Initiator o = (Initiator) other; 2372 2373 return 2374 Objects.equals(this.type, o.type) 2375 && Objects.equals(this.stack, o.stack) 2376 && Objects.equals(this.url, o.url) 2377 && Objects.equals(this.lineNumber, o.lineNumber) 2378 && Objects.equals(this.columnNumber, o.columnNumber) 2379 && Objects.equals(this.requestId, o.requestId); 2380 } 2381 2382 /** Generates a Hash-Code for {@code 'this'} instance */ 2383 public int hashCode() 2384 { 2385 return 2386 Objects.hashCode(this.type) 2387 + this.stack.hashCode() 2388 + Objects.hashCode(this.url) 2389 + Objects.hashCode(this.lineNumber) 2390 + Objects.hashCode(this.columnNumber) 2391 + Objects.hashCode(this.requestId); 2392 } 2393 } 2394 2395 /** Cookie object */ 2396 public static class Cookie 2397 extends BaseType 2398 implements java.io.Serializable 2399 { 2400 /** For Object Serialization. java.io.Serializable */ 2401 protected static final long serialVersionUID = 1; 2402 2403 public boolean[] optionals() 2404 { return new boolean[] { false, false, false, false, false, false, false, false, false, true, false, false, false, false, }; } 2405 2406 /** Cookie name. */ 2407 public final String name; 2408 2409 /** Cookie value. */ 2410 public final String value; 2411 2412 /** Cookie domain. */ 2413 public final String domain; 2414 2415 /** Cookie path. */ 2416 public final String path; 2417 2418 /** Cookie expiration date as the number of seconds since the UNIX epoch. */ 2419 public final Number expires; 2420 2421 /** Cookie size. */ 2422 public final int size; 2423 2424 /** True if cookie is http-only. */ 2425 public final boolean httpOnly; 2426 2427 /** True if cookie is secure. */ 2428 public final boolean secure; 2429 2430 /** True in case of session cookie. */ 2431 public final boolean session; 2432 2433 /** 2434 * Cookie SameSite type. 2435 * <BR /> 2436 * <BR /><B>OPTIONAL</B> 2437 */ 2438 public final String sameSite; 2439 2440 /** 2441 * Cookie Priority 2442 * <BR /> 2443 * <BR /><B>EXPERIMENTAL</B> 2444 */ 2445 public final String priority; 2446 2447 /** 2448 * True if cookie is SameParty. 2449 * <BR /> 2450 * <BR /><B>EXPERIMENTAL</B> 2451 */ 2452 public final boolean sameParty; 2453 2454 /** 2455 * Cookie source scheme type. 2456 * <BR /> 2457 * <BR /><B>EXPERIMENTAL</B> 2458 */ 2459 public final String sourceScheme; 2460 2461 /** 2462 * Cookie source port. Valid values are {-1, [1, 65535]}, -1 indicates an unspecified port. 2463 * An unspecified port value allows protocol clients to emulate legacy cookie scope for the port. 2464 * This is a temporary ability and it will be removed in the future. 2465 * <BR /> 2466 * <BR /><B>EXPERIMENTAL</B> 2467 */ 2468 public final int sourcePort; 2469 2470 /** 2471 * Constructor 2472 * 2473 * @param name Cookie name. 2474 * 2475 * @param value Cookie value. 2476 * 2477 * @param domain Cookie domain. 2478 * 2479 * @param path Cookie path. 2480 * 2481 * @param expires Cookie expiration date as the number of seconds since the UNIX epoch. 2482 * 2483 * @param size Cookie size. 2484 * 2485 * @param httpOnly True if cookie is http-only. 2486 * 2487 * @param secure True if cookie is secure. 2488 * 2489 * @param session True in case of session cookie. 2490 * 2491 * @param sameSite Cookie SameSite type. 2492 * <BR /><B>OPTIONAL</B> 2493 * 2494 * @param priority Cookie Priority 2495 * <BR /><B>EXPERIMENTAL</B> 2496 * 2497 * @param sameParty True if cookie is SameParty. 2498 * <BR /><B>EXPERIMENTAL</B> 2499 * 2500 * @param sourceScheme Cookie source scheme type. 2501 * <BR /><B>EXPERIMENTAL</B> 2502 * 2503 * @param sourcePort 2504 * Cookie source port. Valid values are {-1, [1, 65535]}, -1 indicates an unspecified port. 2505 * An unspecified port value allows protocol clients to emulate legacy cookie scope for the port. 2506 * This is a temporary ability and it will be removed in the future. 2507 * <BR /><B>EXPERIMENTAL</B> 2508 */ 2509 public Cookie( 2510 String name, String value, String domain, String path, Number expires, int size, 2511 boolean httpOnly, boolean secure, boolean session, String sameSite, String priority, 2512 boolean sameParty, String sourceScheme, int sourcePort 2513 ) 2514 { 2515 // Exception-Check(s) to ensure that if any parameters which are not declared as 2516 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 2517 2518 if (name == null) THROWS.throwNPE("name"); 2519 if (value == null) THROWS.throwNPE("value"); 2520 if (domain == null) THROWS.throwNPE("domain"); 2521 if (path == null) THROWS.throwNPE("path"); 2522 if (expires == null) THROWS.throwNPE("expires"); 2523 if (priority == null) THROWS.throwNPE("priority"); 2524 if (sourceScheme == null) THROWS.throwNPE("sourceScheme"); 2525 2526 // Exception-Check(s) to ensure that if any parameters which must adhere to a 2527 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 2528 2529 THROWS.checkIAE("sameSite", sameSite, "Network.CookieSameSite", Network.CookieSameSite); 2530 THROWS.checkIAE("priority", priority, "Network.CookiePriority", Network.CookiePriority); 2531 THROWS.checkIAE("sourceScheme", sourceScheme, "Network.CookieSourceScheme", Network.CookieSourceScheme); 2532 2533 this.name = name; 2534 this.value = value; 2535 this.domain = domain; 2536 this.path = path; 2537 this.expires = expires; 2538 this.size = size; 2539 this.httpOnly = httpOnly; 2540 this.secure = secure; 2541 this.session = session; 2542 this.sameSite = sameSite; 2543 this.priority = priority; 2544 this.sameParty = sameParty; 2545 this.sourceScheme = sourceScheme; 2546 this.sourcePort = sourcePort; 2547 } 2548 2549 /** 2550 * JSON Object Constructor 2551 * @param jo A Json-Object having data about an instance of {@code 'Cookie'}. 2552 */ 2553 public Cookie (JsonObject jo) 2554 { 2555 this.name = ReadJSON.getString(jo, "name", false, true); 2556 this.value = ReadJSON.getString(jo, "value", false, true); 2557 this.domain = ReadJSON.getString(jo, "domain", false, true); 2558 this.path = ReadJSON.getString(jo, "path", false, true); 2559 this.expires = ReadNumberJSON.get(jo, "expires", false, true); 2560 this.size = ReadPrimJSON.getInt(jo, "size"); 2561 this.httpOnly = ReadPrimJSON.getBoolean(jo, "httpOnly"); 2562 this.secure = ReadPrimJSON.getBoolean(jo, "secure"); 2563 this.session = ReadPrimJSON.getBoolean(jo, "session"); 2564 this.sameSite = ReadJSON.getString(jo, "sameSite", true, false); 2565 this.priority = ReadJSON.getString(jo, "priority", false, true); 2566 this.sameParty = ReadPrimJSON.getBoolean(jo, "sameParty"); 2567 this.sourceScheme = ReadJSON.getString(jo, "sourceScheme", false, true); 2568 this.sourcePort = ReadPrimJSON.getInt(jo, "sourcePort"); 2569 } 2570 2571 2572 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 2573 public boolean equals(Object other) 2574 { 2575 if (this == other) return true; 2576 if (other == null) return false; 2577 if (other.getClass() != this.getClass()) return false; 2578 2579 Cookie o = (Cookie) other; 2580 2581 return 2582 Objects.equals(this.name, o.name) 2583 && Objects.equals(this.value, o.value) 2584 && Objects.equals(this.domain, o.domain) 2585 && Objects.equals(this.path, o.path) 2586 && Objects.equals(this.expires, o.expires) 2587 && (this.size == o.size) 2588 && (this.httpOnly == o.httpOnly) 2589 && (this.secure == o.secure) 2590 && (this.session == o.session) 2591 && Objects.equals(this.sameSite, o.sameSite) 2592 && Objects.equals(this.priority, o.priority) 2593 && (this.sameParty == o.sameParty) 2594 && Objects.equals(this.sourceScheme, o.sourceScheme) 2595 && (this.sourcePort == o.sourcePort); 2596 } 2597 2598 /** Generates a Hash-Code for {@code 'this'} instance */ 2599 public int hashCode() 2600 { 2601 return 2602 Objects.hashCode(this.name) 2603 + Objects.hashCode(this.value) 2604 + Objects.hashCode(this.domain) 2605 + Objects.hashCode(this.path) 2606 + Objects.hashCode(this.expires) 2607 + this.size 2608 + (this.httpOnly ? 1 : 0) 2609 + (this.secure ? 1 : 0) 2610 + (this.session ? 1 : 0) 2611 + Objects.hashCode(this.sameSite) 2612 + Objects.hashCode(this.priority) 2613 + (this.sameParty ? 1 : 0) 2614 + Objects.hashCode(this.sourceScheme) 2615 + this.sourcePort; 2616 } 2617 } 2618 2619 /** 2620 * A cookie which was not stored from a response with the corresponding reason. 2621 * <BR /> 2622 * <BR /><B>EXPERIMENTAL</B> 2623 */ 2624 public static class BlockedSetCookieWithReason 2625 extends BaseType 2626 implements java.io.Serializable 2627 { 2628 /** For Object Serialization. java.io.Serializable */ 2629 protected static final long serialVersionUID = 1; 2630 2631 public boolean[] optionals() 2632 { return new boolean[] { false, false, true, }; } 2633 2634 /** The reason(s) this cookie was blocked. */ 2635 public final String[] blockedReasons; 2636 2637 /** 2638 * The string representing this individual cookie as it would appear in the header. 2639 * This is not the entire "cookie" or "set-cookie" header which could have multiple cookies. 2640 */ 2641 public final String cookieLine; 2642 2643 /** 2644 * The cookie object which represents the cookie which was not stored. It is optional because 2645 * sometimes complete cookie information is not available, such as in the case of parsing 2646 * errors. 2647 * <BR /> 2648 * <BR /><B>OPTIONAL</B> 2649 */ 2650 public final Network.Cookie cookie; 2651 2652 /** 2653 * Constructor 2654 * 2655 * @param blockedReasons The reason(s) this cookie was blocked. 2656 * 2657 * @param cookieLine 2658 * The string representing this individual cookie as it would appear in the header. 2659 * This is not the entire "cookie" or "set-cookie" header which could have multiple cookies. 2660 * 2661 * @param cookie 2662 * The cookie object which represents the cookie which was not stored. It is optional because 2663 * sometimes complete cookie information is not available, such as in the case of parsing 2664 * errors. 2665 * <BR /><B>OPTIONAL</B> 2666 */ 2667 public BlockedSetCookieWithReason 2668 (String[] blockedReasons, String cookieLine, Network.Cookie cookie) 2669 { 2670 // Exception-Check(s) to ensure that if any parameters which are not declared as 2671 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 2672 2673 if (blockedReasons == null) THROWS.throwNPE("blockedReasons"); 2674 if (cookieLine == null) THROWS.throwNPE("cookieLine"); 2675 2676 this.blockedReasons = blockedReasons; 2677 this.cookieLine = cookieLine; 2678 this.cookie = cookie; 2679 } 2680 2681 /** 2682 * JSON Object Constructor 2683 * @param jo A Json-Object having data about an instance of {@code 'BlockedSetCookieWithReason'}. 2684 */ 2685 public BlockedSetCookieWithReason (JsonObject jo) 2686 { 2687 this.blockedReasons = (jo.getJsonArray("blockedReasons") == null) 2688 ? null 2689 : RJArrIntoStream.strArr(jo.getJsonArray("blockedReasons"), null, 0).toArray(String[]::new); 2690 2691 this.cookieLine = ReadJSON.getString(jo, "cookieLine", false, true); 2692 this.cookie = ReadJSON.getObject(jo, "cookie", Network.Cookie.class, true, false); 2693 } 2694 2695 2696 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 2697 public boolean equals(Object other) 2698 { 2699 if (this == other) return true; 2700 if (other == null) return false; 2701 if (other.getClass() != this.getClass()) return false; 2702 2703 BlockedSetCookieWithReason o = (BlockedSetCookieWithReason) other; 2704 2705 return 2706 Arrays.deepEquals(this.blockedReasons, o.blockedReasons) 2707 && Objects.equals(this.cookieLine, o.cookieLine) 2708 && Objects.equals(this.cookie, o.cookie); 2709 } 2710 2711 /** Generates a Hash-Code for {@code 'this'} instance */ 2712 public int hashCode() 2713 { 2714 return 2715 Arrays.deepHashCode(this.blockedReasons) 2716 + Objects.hashCode(this.cookieLine) 2717 + this.cookie.hashCode(); 2718 } 2719 } 2720 2721 /** 2722 * A cookie with was not sent with a request with the corresponding reason. 2723 * <BR /> 2724 * <BR /><B>EXPERIMENTAL</B> 2725 */ 2726 public static class BlockedCookieWithReason 2727 extends BaseType 2728 implements java.io.Serializable 2729 { 2730 /** For Object Serialization. java.io.Serializable */ 2731 protected static final long serialVersionUID = 1; 2732 2733 public boolean[] optionals() 2734 { return new boolean[] { false, false, }; } 2735 2736 /** The reason(s) the cookie was blocked. */ 2737 public final String[] blockedReasons; 2738 2739 /** The cookie object representing the cookie which was not sent. */ 2740 public final Network.Cookie cookie; 2741 2742 /** 2743 * Constructor 2744 * 2745 * @param blockedReasons The reason(s) the cookie was blocked. 2746 * 2747 * @param cookie The cookie object representing the cookie which was not sent. 2748 */ 2749 public BlockedCookieWithReason(String[] blockedReasons, Network.Cookie cookie) 2750 { 2751 // Exception-Check(s) to ensure that if any parameters which are not declared as 2752 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 2753 2754 if (blockedReasons == null) THROWS.throwNPE("blockedReasons"); 2755 if (cookie == null) THROWS.throwNPE("cookie"); 2756 2757 this.blockedReasons = blockedReasons; 2758 this.cookie = cookie; 2759 } 2760 2761 /** 2762 * JSON Object Constructor 2763 * @param jo A Json-Object having data about an instance of {@code 'BlockedCookieWithReason'}. 2764 */ 2765 public BlockedCookieWithReason (JsonObject jo) 2766 { 2767 this.blockedReasons = (jo.getJsonArray("blockedReasons") == null) 2768 ? null 2769 : RJArrIntoStream.strArr(jo.getJsonArray("blockedReasons"), null, 0).toArray(String[]::new); 2770 2771 this.cookie = ReadJSON.getObject(jo, "cookie", Network.Cookie.class, false, true); 2772 } 2773 2774 2775 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 2776 public boolean equals(Object other) 2777 { 2778 if (this == other) return true; 2779 if (other == null) return false; 2780 if (other.getClass() != this.getClass()) return false; 2781 2782 BlockedCookieWithReason o = (BlockedCookieWithReason) other; 2783 2784 return 2785 Arrays.deepEquals(this.blockedReasons, o.blockedReasons) 2786 && Objects.equals(this.cookie, o.cookie); 2787 } 2788 2789 /** Generates a Hash-Code for {@code 'this'} instance */ 2790 public int hashCode() 2791 { 2792 return 2793 Arrays.deepHashCode(this.blockedReasons) 2794 + this.cookie.hashCode(); 2795 } 2796 } 2797 2798 /** Cookie parameter object */ 2799 public static class CookieParam 2800 extends BaseType 2801 implements java.io.Serializable 2802 { 2803 /** For Object Serialization. java.io.Serializable */ 2804 protected static final long serialVersionUID = 1; 2805 2806 public boolean[] optionals() 2807 { return new boolean[] { false, false, true, true, true, true, true, true, true, true, true, true, true, }; } 2808 2809 /** Cookie name. */ 2810 public final String name; 2811 2812 /** Cookie value. */ 2813 public final String value; 2814 2815 /** 2816 * The request-URI to associate with the setting of the cookie. This value can affect the 2817 * default domain, path, source port, and source scheme values of the created cookie. 2818 * <BR /> 2819 * <BR /><B>OPTIONAL</B> 2820 */ 2821 public final String url; 2822 2823 /** 2824 * Cookie domain. 2825 * <BR /> 2826 * <BR /><B>OPTIONAL</B> 2827 */ 2828 public final String domain; 2829 2830 /** 2831 * Cookie path. 2832 * <BR /> 2833 * <BR /><B>OPTIONAL</B> 2834 */ 2835 public final String path; 2836 2837 /** 2838 * True if cookie is secure. 2839 * <BR /> 2840 * <BR /><B>OPTIONAL</B> 2841 */ 2842 public final Boolean secure; 2843 2844 /** 2845 * True if cookie is http-only. 2846 * <BR /> 2847 * <BR /><B>OPTIONAL</B> 2848 */ 2849 public final Boolean httpOnly; 2850 2851 /** 2852 * Cookie SameSite type. 2853 * <BR /> 2854 * <BR /><B>OPTIONAL</B> 2855 */ 2856 public final String sameSite; 2857 2858 /** 2859 * Cookie expiration date, session cookie if not set 2860 * <BR /> 2861 * <BR /><B>OPTIONAL</B> 2862 */ 2863 public final Number expires; 2864 2865 /** 2866 * Cookie Priority. 2867 * <BR /> 2868 * <BR /><B>OPTIONAL</B> 2869 * <BR /><B>EXPERIMENTAL</B> 2870 */ 2871 public final String priority; 2872 2873 /** 2874 * True if cookie is SameParty. 2875 * <BR /> 2876 * <BR /><B>OPTIONAL</B> 2877 * <BR /><B>EXPERIMENTAL</B> 2878 */ 2879 public final Boolean sameParty; 2880 2881 /** 2882 * Cookie source scheme type. 2883 * <BR /> 2884 * <BR /><B>OPTIONAL</B> 2885 * <BR /><B>EXPERIMENTAL</B> 2886 */ 2887 public final String sourceScheme; 2888 2889 /** 2890 * Cookie source port. Valid values are {-1, [1, 65535]}, -1 indicates an unspecified port. 2891 * An unspecified port value allows protocol clients to emulate legacy cookie scope for the port. 2892 * This is a temporary ability and it will be removed in the future. 2893 * <BR /> 2894 * <BR /><B>OPTIONAL</B> 2895 * <BR /><B>EXPERIMENTAL</B> 2896 */ 2897 public final Integer sourcePort; 2898 2899 /** 2900 * Constructor 2901 * 2902 * @param name Cookie name. 2903 * 2904 * @param value Cookie value. 2905 * 2906 * @param url 2907 * The request-URI to associate with the setting of the cookie. This value can affect the 2908 * default domain, path, source port, and source scheme values of the created cookie. 2909 * <BR /><B>OPTIONAL</B> 2910 * 2911 * @param domain Cookie domain. 2912 * <BR /><B>OPTIONAL</B> 2913 * 2914 * @param path Cookie path. 2915 * <BR /><B>OPTIONAL</B> 2916 * 2917 * @param secure True if cookie is secure. 2918 * <BR /><B>OPTIONAL</B> 2919 * 2920 * @param httpOnly True if cookie is http-only. 2921 * <BR /><B>OPTIONAL</B> 2922 * 2923 * @param sameSite Cookie SameSite type. 2924 * <BR /><B>OPTIONAL</B> 2925 * 2926 * @param expires Cookie expiration date, session cookie if not set 2927 * <BR /><B>OPTIONAL</B> 2928 * 2929 * @param priority Cookie Priority. 2930 * <BR /><B>OPTIONAL</B> 2931 * <BR /><B>EXPERIMENTAL</B> 2932 * 2933 * @param sameParty True if cookie is SameParty. 2934 * <BR /><B>OPTIONAL</B> 2935 * <BR /><B>EXPERIMENTAL</B> 2936 * 2937 * @param sourceScheme Cookie source scheme type. 2938 * <BR /><B>OPTIONAL</B> 2939 * <BR /><B>EXPERIMENTAL</B> 2940 * 2941 * @param sourcePort 2942 * Cookie source port. Valid values are {-1, [1, 65535]}, -1 indicates an unspecified port. 2943 * An unspecified port value allows protocol clients to emulate legacy cookie scope for the port. 2944 * This is a temporary ability and it will be removed in the future. 2945 * <BR /><B>OPTIONAL</B> 2946 * <BR /><B>EXPERIMENTAL</B> 2947 */ 2948 public CookieParam( 2949 String name, String value, String url, String domain, String path, Boolean secure, 2950 Boolean httpOnly, String sameSite, Number expires, String priority, 2951 Boolean sameParty, String sourceScheme, Integer sourcePort 2952 ) 2953 { 2954 // Exception-Check(s) to ensure that if any parameters which are not declared as 2955 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 2956 2957 if (name == null) THROWS.throwNPE("name"); 2958 if (value == null) THROWS.throwNPE("value"); 2959 2960 // Exception-Check(s) to ensure that if any parameters which must adhere to a 2961 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 2962 2963 THROWS.checkIAE("sameSite", sameSite, "Network.CookieSameSite", Network.CookieSameSite); 2964 THROWS.checkIAE("priority", priority, "Network.CookiePriority", Network.CookiePriority); 2965 THROWS.checkIAE("sourceScheme", sourceScheme, "Network.CookieSourceScheme", Network.CookieSourceScheme); 2966 2967 this.name = name; 2968 this.value = value; 2969 this.url = url; 2970 this.domain = domain; 2971 this.path = path; 2972 this.secure = secure; 2973 this.httpOnly = httpOnly; 2974 this.sameSite = sameSite; 2975 this.expires = expires; 2976 this.priority = priority; 2977 this.sameParty = sameParty; 2978 this.sourceScheme = sourceScheme; 2979 this.sourcePort = sourcePort; 2980 } 2981 2982 /** 2983 * JSON Object Constructor 2984 * @param jo A Json-Object having data about an instance of {@code 'CookieParam'}. 2985 */ 2986 public CookieParam (JsonObject jo) 2987 { 2988 this.name = ReadJSON.getString(jo, "name", false, true); 2989 this.value = ReadJSON.getString(jo, "value", false, true); 2990 this.url = ReadJSON.getString(jo, "url", true, false); 2991 this.domain = ReadJSON.getString(jo, "domain", true, false); 2992 this.path = ReadJSON.getString(jo, "path", true, false); 2993 this.secure = ReadBoxedJSON.getBoolean(jo, "secure", true); 2994 this.httpOnly = ReadBoxedJSON.getBoolean(jo, "httpOnly", true); 2995 this.sameSite = ReadJSON.getString(jo, "sameSite", true, false); 2996 this.expires = ReadNumberJSON.get(jo, "expires", true, false); 2997 this.priority = ReadJSON.getString(jo, "priority", true, false); 2998 this.sameParty = ReadBoxedJSON.getBoolean(jo, "sameParty", true); 2999 this.sourceScheme = ReadJSON.getString(jo, "sourceScheme", true, false); 3000 this.sourcePort = ReadBoxedJSON.getInteger(jo, "sourcePort", true); 3001 } 3002 3003 3004 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 3005 public boolean equals(Object other) 3006 { 3007 if (this == other) return true; 3008 if (other == null) return false; 3009 if (other.getClass() != this.getClass()) return false; 3010 3011 CookieParam o = (CookieParam) other; 3012 3013 return 3014 Objects.equals(this.name, o.name) 3015 && Objects.equals(this.value, o.value) 3016 && Objects.equals(this.url, o.url) 3017 && Objects.equals(this.domain, o.domain) 3018 && Objects.equals(this.path, o.path) 3019 && Objects.equals(this.secure, o.secure) 3020 && Objects.equals(this.httpOnly, o.httpOnly) 3021 && Objects.equals(this.sameSite, o.sameSite) 3022 && Objects.equals(this.expires, o.expires) 3023 && Objects.equals(this.priority, o.priority) 3024 && Objects.equals(this.sameParty, o.sameParty) 3025 && Objects.equals(this.sourceScheme, o.sourceScheme) 3026 && Objects.equals(this.sourcePort, o.sourcePort); 3027 } 3028 3029 /** Generates a Hash-Code for {@code 'this'} instance */ 3030 public int hashCode() 3031 { 3032 return 3033 Objects.hashCode(this.name) 3034 + Objects.hashCode(this.value) 3035 + Objects.hashCode(this.url) 3036 + Objects.hashCode(this.domain) 3037 + Objects.hashCode(this.path) 3038 + Objects.hashCode(this.secure) 3039 + Objects.hashCode(this.httpOnly) 3040 + Objects.hashCode(this.sameSite) 3041 + Objects.hashCode(this.expires) 3042 + Objects.hashCode(this.priority) 3043 + Objects.hashCode(this.sameParty) 3044 + Objects.hashCode(this.sourceScheme) 3045 + Objects.hashCode(this.sourcePort); 3046 } 3047 } 3048 3049 /** 3050 * Authorization challenge for HTTP status code 401 or 407. 3051 * <BR /> 3052 * <BR /><B>EXPERIMENTAL</B> 3053 */ 3054 public static class AuthChallenge 3055 extends BaseType 3056 implements java.io.Serializable 3057 { 3058 /** For Object Serialization. java.io.Serializable */ 3059 protected static final long serialVersionUID = 1; 3060 3061 public boolean[] optionals() 3062 { return new boolean[] { true, false, false, false, }; } 3063 3064 /** 3065 * Source of the authentication challenge. 3066 * <BR /> 3067 * <BR /><B>OPTIONAL</B> 3068 */ 3069 public final String source; 3070 3071 /** Origin of the challenger. */ 3072 public final String origin; 3073 3074 /** The authentication scheme used, such as basic or digest */ 3075 public final String scheme; 3076 3077 /** The realm of the challenge. May be empty. */ 3078 public final String realm; 3079 3080 /** 3081 * Constructor 3082 * 3083 * @param source Source of the authentication challenge. 3084 * <BR />Acceptable Values: ["Server", "Proxy"] 3085 * <BR /><B>OPTIONAL</B> 3086 * 3087 * @param origin Origin of the challenger. 3088 * 3089 * @param scheme The authentication scheme used, such as basic or digest 3090 * 3091 * @param realm The realm of the challenge. May be empty. 3092 */ 3093 public AuthChallenge(String source, String origin, String scheme, String realm) 3094 { 3095 // Exception-Check(s) to ensure that if any parameters which are not declared as 3096 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 3097 3098 if (origin == null) THROWS.throwNPE("origin"); 3099 if (scheme == null) THROWS.throwNPE("scheme"); 3100 if (realm == null) THROWS.throwNPE("realm"); 3101 3102 // Exception-Check(s) to ensure that if any parameters which must adhere to a 3103 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 3104 3105 THROWS.checkIAE( 3106 "source", source, 3107 "Server", "Proxy" 3108 ); 3109 3110 this.source = source; 3111 this.origin = origin; 3112 this.scheme = scheme; 3113 this.realm = realm; 3114 } 3115 3116 /** 3117 * JSON Object Constructor 3118 * @param jo A Json-Object having data about an instance of {@code 'AuthChallenge'}. 3119 */ 3120 public AuthChallenge (JsonObject jo) 3121 { 3122 this.source = ReadJSON.getString(jo, "source", true, false); 3123 this.origin = ReadJSON.getString(jo, "origin", false, true); 3124 this.scheme = ReadJSON.getString(jo, "scheme", false, true); 3125 this.realm = ReadJSON.getString(jo, "realm", false, true); 3126 } 3127 3128 3129 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 3130 public boolean equals(Object other) 3131 { 3132 if (this == other) return true; 3133 if (other == null) return false; 3134 if (other.getClass() != this.getClass()) return false; 3135 3136 AuthChallenge o = (AuthChallenge) other; 3137 3138 return 3139 Objects.equals(this.source, o.source) 3140 && Objects.equals(this.origin, o.origin) 3141 && Objects.equals(this.scheme, o.scheme) 3142 && Objects.equals(this.realm, o.realm); 3143 } 3144 3145 /** Generates a Hash-Code for {@code 'this'} instance */ 3146 public int hashCode() 3147 { 3148 return 3149 Objects.hashCode(this.source) 3150 + Objects.hashCode(this.origin) 3151 + Objects.hashCode(this.scheme) 3152 + Objects.hashCode(this.realm); 3153 } 3154 } 3155 3156 /** 3157 * Response to an AuthChallenge. 3158 * <BR /> 3159 * <BR /><B>EXPERIMENTAL</B> 3160 */ 3161 public static class AuthChallengeResponse 3162 extends BaseType 3163 implements java.io.Serializable 3164 { 3165 /** For Object Serialization. java.io.Serializable */ 3166 protected static final long serialVersionUID = 1; 3167 3168 public boolean[] optionals() 3169 { return new boolean[] { false, true, true, }; } 3170 3171 /** 3172 * The decision on what to do in response to the authorization challenge. Default means 3173 * deferring to the default behavior of the net stack, which will likely either the Cancel 3174 * authentication or display a popup dialog box. 3175 */ 3176 public final String response; 3177 3178 /** 3179 * The username to provide, possibly empty. Should only be set if response is 3180 * ProvideCredentials. 3181 * <BR /> 3182 * <BR /><B>OPTIONAL</B> 3183 */ 3184 public final String username; 3185 3186 /** 3187 * The password to provide, possibly empty. Should only be set if response is 3188 * ProvideCredentials. 3189 * <BR /> 3190 * <BR /><B>OPTIONAL</B> 3191 */ 3192 public final String password; 3193 3194 /** 3195 * Constructor 3196 * 3197 * @param response 3198 * The decision on what to do in response to the authorization challenge. Default means 3199 * deferring to the default behavior of the net stack, which will likely either the Cancel 3200 * authentication or display a popup dialog box. 3201 * <BR />Acceptable Values: ["Default", "CancelAuth", "ProvideCredentials"] 3202 * 3203 * @param username 3204 * The username to provide, possibly empty. Should only be set if response is 3205 * ProvideCredentials. 3206 * <BR /><B>OPTIONAL</B> 3207 * 3208 * @param password 3209 * The password to provide, possibly empty. Should only be set if response is 3210 * ProvideCredentials. 3211 * <BR /><B>OPTIONAL</B> 3212 */ 3213 public AuthChallengeResponse(String response, String username, String password) 3214 { 3215 // Exception-Check(s) to ensure that if any parameters which are not declared as 3216 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 3217 3218 if (response == null) THROWS.throwNPE("response"); 3219 3220 // Exception-Check(s) to ensure that if any parameters which must adhere to a 3221 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 3222 3223 THROWS.checkIAE( 3224 "response", response, 3225 "Default", "CancelAuth", "ProvideCredentials" 3226 ); 3227 3228 this.response = response; 3229 this.username = username; 3230 this.password = password; 3231 } 3232 3233 /** 3234 * JSON Object Constructor 3235 * @param jo A Json-Object having data about an instance of {@code 'AuthChallengeResponse'}. 3236 */ 3237 public AuthChallengeResponse (JsonObject jo) 3238 { 3239 this.response = ReadJSON.getString(jo, "response", false, true); 3240 this.username = ReadJSON.getString(jo, "username", true, false); 3241 this.password = ReadJSON.getString(jo, "password", true, false); 3242 } 3243 3244 3245 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 3246 public boolean equals(Object other) 3247 { 3248 if (this == other) return true; 3249 if (other == null) return false; 3250 if (other.getClass() != this.getClass()) return false; 3251 3252 AuthChallengeResponse o = (AuthChallengeResponse) other; 3253 3254 return 3255 Objects.equals(this.response, o.response) 3256 && Objects.equals(this.username, o.username) 3257 && Objects.equals(this.password, o.password); 3258 } 3259 3260 /** Generates a Hash-Code for {@code 'this'} instance */ 3261 public int hashCode() 3262 { 3263 return 3264 Objects.hashCode(this.response) 3265 + Objects.hashCode(this.username) 3266 + Objects.hashCode(this.password); 3267 } 3268 } 3269 3270 /** 3271 * Request pattern for interception. 3272 * <BR /> 3273 * <BR /><B>EXPERIMENTAL</B> 3274 */ 3275 public static class RequestPattern 3276 extends BaseType 3277 implements java.io.Serializable 3278 { 3279 /** For Object Serialization. java.io.Serializable */ 3280 protected static final long serialVersionUID = 1; 3281 3282 public boolean[] optionals() 3283 { return new boolean[] { true, true, true, }; } 3284 3285 /** 3286 * Wildcards (<CODE>'*'</CODE> -> zero or more, <CODE>'?'</CODE> -> exactly one) are allowed. Escape character is 3287 * backslash. Omitting is equivalent to <CODE>"*"</CODE>. 3288 * <BR /> 3289 * <BR /><B>OPTIONAL</B> 3290 */ 3291 public final String urlPattern; 3292 3293 /** 3294 * If set, only requests for matching resource types will be intercepted. 3295 * <BR /> 3296 * <BR /><B>OPTIONAL</B> 3297 */ 3298 public final String resourceType; 3299 3300 /** 3301 * Stage at which to begin intercepting requests. Default is Request. 3302 * <BR /> 3303 * <BR /><B>OPTIONAL</B> 3304 */ 3305 public final String interceptionStage; 3306 3307 /** 3308 * Constructor 3309 * 3310 * @param urlPattern 3311 * Wildcards (<CODE>'*'</CODE> -> zero or more, <CODE>'?'</CODE> -> exactly one) are allowed. Escape character is 3312 * backslash. Omitting is equivalent to <CODE>"*"</CODE>. 3313 * <BR /><B>OPTIONAL</B> 3314 * 3315 * @param resourceType If set, only requests for matching resource types will be intercepted. 3316 * <BR /><B>OPTIONAL</B> 3317 * 3318 * @param interceptionStage Stage at which to begin intercepting requests. Default is Request. 3319 * <BR /><B>OPTIONAL</B> 3320 */ 3321 public RequestPattern(String urlPattern, String resourceType, String interceptionStage) 3322 { 3323 // Exception-Check(s) to ensure that if any parameters which must adhere to a 3324 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 3325 3326 THROWS.checkIAE("resourceType", resourceType, "Network.ResourceType", Network.ResourceType); 3327 THROWS.checkIAE("interceptionStage", interceptionStage, "Network.InterceptionStage", Network.InterceptionStage); 3328 3329 this.urlPattern = urlPattern; 3330 this.resourceType = resourceType; 3331 this.interceptionStage = interceptionStage; 3332 } 3333 3334 /** 3335 * JSON Object Constructor 3336 * @param jo A Json-Object having data about an instance of {@code 'RequestPattern'}. 3337 */ 3338 public RequestPattern (JsonObject jo) 3339 { 3340 this.urlPattern = ReadJSON.getString(jo, "urlPattern", true, false); 3341 this.resourceType = ReadJSON.getString(jo, "resourceType", true, false); 3342 this.interceptionStage = ReadJSON.getString(jo, "interceptionStage", true, false); 3343 } 3344 3345 3346 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 3347 public boolean equals(Object other) 3348 { 3349 if (this == other) return true; 3350 if (other == null) return false; 3351 if (other.getClass() != this.getClass()) return false; 3352 3353 RequestPattern o = (RequestPattern) other; 3354 3355 return 3356 Objects.equals(this.urlPattern, o.urlPattern) 3357 && Objects.equals(this.resourceType, o.resourceType) 3358 && Objects.equals(this.interceptionStage, o.interceptionStage); 3359 } 3360 3361 /** Generates a Hash-Code for {@code 'this'} instance */ 3362 public int hashCode() 3363 { 3364 return 3365 Objects.hashCode(this.urlPattern) 3366 + Objects.hashCode(this.resourceType) 3367 + Objects.hashCode(this.interceptionStage); 3368 } 3369 } 3370 3371 /** 3372 * Information about a signed exchange signature. 3373 * https://wicg.github.io/webpackage/draft-yasskin-httpbis-origin-signed-exchanges-impl.html#rfc.section.3.1 3374 * <BR /> 3375 * <BR /><B>EXPERIMENTAL</B> 3376 */ 3377 public static class SignedExchangeSignature 3378 extends BaseType 3379 implements java.io.Serializable 3380 { 3381 /** For Object Serialization. java.io.Serializable */ 3382 protected static final long serialVersionUID = 1; 3383 3384 public boolean[] optionals() 3385 { return new boolean[] { false, false, false, true, true, false, false, false, true, }; } 3386 3387 /** Signed exchange signature label. */ 3388 public final String label; 3389 3390 /** The hex string of signed exchange signature. */ 3391 public final String signature; 3392 3393 /** Signed exchange signature integrity. */ 3394 public final String integrity; 3395 3396 /** 3397 * Signed exchange signature cert Url. 3398 * <BR /> 3399 * <BR /><B>OPTIONAL</B> 3400 */ 3401 public final String certUrl; 3402 3403 /** 3404 * The hex string of signed exchange signature cert sha256. 3405 * <BR /> 3406 * <BR /><B>OPTIONAL</B> 3407 */ 3408 public final String certSha256; 3409 3410 /** Signed exchange signature validity Url. */ 3411 public final String validityUrl; 3412 3413 /** Signed exchange signature date. */ 3414 public final int date; 3415 3416 /** Signed exchange signature expires. */ 3417 public final int expires; 3418 3419 /** 3420 * The encoded certificates. 3421 * <BR /> 3422 * <BR /><B>OPTIONAL</B> 3423 */ 3424 public final String[] certificates; 3425 3426 /** 3427 * Constructor 3428 * 3429 * @param label Signed exchange signature label. 3430 * 3431 * @param signature The hex string of signed exchange signature. 3432 * 3433 * @param integrity Signed exchange signature integrity. 3434 * 3435 * @param certUrl Signed exchange signature cert Url. 3436 * <BR /><B>OPTIONAL</B> 3437 * 3438 * @param certSha256 The hex string of signed exchange signature cert sha256. 3439 * <BR /><B>OPTIONAL</B> 3440 * 3441 * @param validityUrl Signed exchange signature validity Url. 3442 * 3443 * @param date Signed exchange signature date. 3444 * 3445 * @param expires Signed exchange signature expires. 3446 * 3447 * @param certificates The encoded certificates. 3448 * <BR /><B>OPTIONAL</B> 3449 */ 3450 public SignedExchangeSignature( 3451 String label, String signature, String integrity, String certUrl, String certSha256, 3452 String validityUrl, int date, int expires, String[] certificates 3453 ) 3454 { 3455 // Exception-Check(s) to ensure that if any parameters which are not declared as 3456 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 3457 3458 if (label == null) THROWS.throwNPE("label"); 3459 if (signature == null) THROWS.throwNPE("signature"); 3460 if (integrity == null) THROWS.throwNPE("integrity"); 3461 if (validityUrl == null) THROWS.throwNPE("validityUrl"); 3462 3463 this.label = label; 3464 this.signature = signature; 3465 this.integrity = integrity; 3466 this.certUrl = certUrl; 3467 this.certSha256 = certSha256; 3468 this.validityUrl = validityUrl; 3469 this.date = date; 3470 this.expires = expires; 3471 this.certificates = certificates; 3472 } 3473 3474 /** 3475 * JSON Object Constructor 3476 * @param jo A Json-Object having data about an instance of {@code 'SignedExchangeSignature'}. 3477 */ 3478 public SignedExchangeSignature (JsonObject jo) 3479 { 3480 this.label = ReadJSON.getString(jo, "label", false, true); 3481 this.signature = ReadJSON.getString(jo, "signature", false, true); 3482 this.integrity = ReadJSON.getString(jo, "integrity", false, true); 3483 this.certUrl = ReadJSON.getString(jo, "certUrl", true, false); 3484 this.certSha256 = ReadJSON.getString(jo, "certSha256", true, false); 3485 this.validityUrl = ReadJSON.getString(jo, "validityUrl", false, true); 3486 this.date = ReadPrimJSON.getInt(jo, "date"); 3487 this.expires = ReadPrimJSON.getInt(jo, "expires"); 3488 this.certificates = (jo.getJsonArray("certificates") == null) 3489 ? null 3490 : RJArrIntoStream.strArr(jo.getJsonArray("certificates"), null, 0).toArray(String[]::new); 3491 3492 } 3493 3494 3495 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 3496 public boolean equals(Object other) 3497 { 3498 if (this == other) return true; 3499 if (other == null) return false; 3500 if (other.getClass() != this.getClass()) return false; 3501 3502 SignedExchangeSignature o = (SignedExchangeSignature) other; 3503 3504 return 3505 Objects.equals(this.label, o.label) 3506 && Objects.equals(this.signature, o.signature) 3507 && Objects.equals(this.integrity, o.integrity) 3508 && Objects.equals(this.certUrl, o.certUrl) 3509 && Objects.equals(this.certSha256, o.certSha256) 3510 && Objects.equals(this.validityUrl, o.validityUrl) 3511 && (this.date == o.date) 3512 && (this.expires == o.expires) 3513 && Arrays.deepEquals(this.certificates, o.certificates); 3514 } 3515 3516 /** Generates a Hash-Code for {@code 'this'} instance */ 3517 public int hashCode() 3518 { 3519 return 3520 Objects.hashCode(this.label) 3521 + Objects.hashCode(this.signature) 3522 + Objects.hashCode(this.integrity) 3523 + Objects.hashCode(this.certUrl) 3524 + Objects.hashCode(this.certSha256) 3525 + Objects.hashCode(this.validityUrl) 3526 + this.date 3527 + this.expires 3528 + Arrays.deepHashCode(this.certificates); 3529 } 3530 } 3531 3532 /** 3533 * Information about a signed exchange header. 3534 * https://wicg.github.io/webpackage/draft-yasskin-httpbis-origin-signed-exchanges-impl.html#cbor-representation 3535 * <BR /> 3536 * <BR /><B>EXPERIMENTAL</B> 3537 */ 3538 public static class SignedExchangeHeader 3539 extends BaseType 3540 implements java.io.Serializable 3541 { 3542 /** For Object Serialization. java.io.Serializable */ 3543 protected static final long serialVersionUID = 1; 3544 3545 public boolean[] optionals() 3546 { return new boolean[] { false, false, false, false, false, }; } 3547 3548 /** Signed exchange request URL. */ 3549 public final String requestUrl; 3550 3551 /** Signed exchange response code. */ 3552 public final int responseCode; 3553 3554 /** Signed exchange response headers. */ 3555 public final JsonObject responseHeaders; 3556 3557 /** Signed exchange response signature. */ 3558 public final Network.SignedExchangeSignature[] signatures; 3559 3560 /** Signed exchange header integrity hash in the form of "sha256-<base64-hash-value>". */ 3561 public final String headerIntegrity; 3562 3563 /** 3564 * Constructor 3565 * 3566 * @param requestUrl Signed exchange request URL. 3567 * 3568 * @param responseCode Signed exchange response code. 3569 * 3570 * @param responseHeaders Signed exchange response headers. 3571 * 3572 * @param signatures Signed exchange response signature. 3573 * 3574 * @param headerIntegrity Signed exchange header integrity hash in the form of "sha256-<base64-hash-value>". 3575 */ 3576 public SignedExchangeHeader( 3577 String requestUrl, int responseCode, JsonObject responseHeaders, 3578 Network.SignedExchangeSignature[] signatures, String headerIntegrity 3579 ) 3580 { 3581 // Exception-Check(s) to ensure that if any parameters which are not declared as 3582 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 3583 3584 if (requestUrl == null) THROWS.throwNPE("requestUrl"); 3585 if (responseHeaders == null) THROWS.throwNPE("responseHeaders"); 3586 if (signatures == null) THROWS.throwNPE("signatures"); 3587 if (headerIntegrity == null) THROWS.throwNPE("headerIntegrity"); 3588 3589 this.requestUrl = requestUrl; 3590 this.responseCode = responseCode; 3591 this.responseHeaders = responseHeaders; 3592 this.signatures = signatures; 3593 this.headerIntegrity = headerIntegrity; 3594 } 3595 3596 /** 3597 * JSON Object Constructor 3598 * @param jo A Json-Object having data about an instance of {@code 'SignedExchangeHeader'}. 3599 */ 3600 public SignedExchangeHeader (JsonObject jo) 3601 { 3602 this.requestUrl = ReadJSON.getString(jo, "requestUrl", false, true); 3603 this.responseCode = ReadPrimJSON.getInt(jo, "responseCode"); 3604 this.responseHeaders = jo.getJsonObject("responseHeaders"); 3605 this.signatures = (jo.getJsonArray("signatures") == null) 3606 ? null 3607 : RJArrIntoStream.objArr(jo.getJsonArray("signatures"), null, 0, Network.SignedExchangeSignature.class).toArray(Network.SignedExchangeSignature[]::new); 3608 3609 this.headerIntegrity = ReadJSON.getString(jo, "headerIntegrity", false, true); 3610 } 3611 3612 3613 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 3614 public boolean equals(Object other) 3615 { 3616 if (this == other) return true; 3617 if (other == null) return false; 3618 if (other.getClass() != this.getClass()) return false; 3619 3620 SignedExchangeHeader o = (SignedExchangeHeader) other; 3621 3622 return 3623 Objects.equals(this.requestUrl, o.requestUrl) 3624 && (this.responseCode == o.responseCode) 3625 && Objects.equals(this.responseHeaders, o.responseHeaders) 3626 && Arrays.deepEquals(this.signatures, o.signatures) 3627 && Objects.equals(this.headerIntegrity, o.headerIntegrity); 3628 } 3629 3630 /** Generates a Hash-Code for {@code 'this'} instance */ 3631 public int hashCode() 3632 { 3633 return 3634 Objects.hashCode(this.requestUrl) 3635 + this.responseCode 3636 + this.responseHeaders.hashCode() 3637 + Arrays.deepHashCode(this.signatures) 3638 + Objects.hashCode(this.headerIntegrity); 3639 } 3640 } 3641 3642 /** 3643 * Information about a signed exchange response. 3644 * <BR /> 3645 * <BR /><B>EXPERIMENTAL</B> 3646 */ 3647 public static class SignedExchangeError 3648 extends BaseType 3649 implements java.io.Serializable 3650 { 3651 /** For Object Serialization. java.io.Serializable */ 3652 protected static final long serialVersionUID = 1; 3653 3654 public boolean[] optionals() 3655 { return new boolean[] { false, true, true, }; } 3656 3657 /** Error message. */ 3658 public final String message; 3659 3660 /** 3661 * The index of the signature which caused the error. 3662 * <BR /> 3663 * <BR /><B>OPTIONAL</B> 3664 */ 3665 public final Integer signatureIndex; 3666 3667 /** 3668 * The field which caused the error. 3669 * <BR /> 3670 * <BR /><B>OPTIONAL</B> 3671 */ 3672 public final String errorField; 3673 3674 /** 3675 * Constructor 3676 * 3677 * @param message Error message. 3678 * 3679 * @param signatureIndex The index of the signature which caused the error. 3680 * <BR /><B>OPTIONAL</B> 3681 * 3682 * @param errorField The field which caused the error. 3683 * <BR /><B>OPTIONAL</B> 3684 */ 3685 public SignedExchangeError(String message, Integer signatureIndex, String errorField) 3686 { 3687 // Exception-Check(s) to ensure that if any parameters which are not declared as 3688 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 3689 3690 if (message == null) THROWS.throwNPE("message"); 3691 3692 // Exception-Check(s) to ensure that if any parameters which must adhere to a 3693 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 3694 3695 THROWS.checkIAE("errorField", errorField, "Network.SignedExchangeErrorField", Network.SignedExchangeErrorField); 3696 3697 this.message = message; 3698 this.signatureIndex = signatureIndex; 3699 this.errorField = errorField; 3700 } 3701 3702 /** 3703 * JSON Object Constructor 3704 * @param jo A Json-Object having data about an instance of {@code 'SignedExchangeError'}. 3705 */ 3706 public SignedExchangeError (JsonObject jo) 3707 { 3708 this.message = ReadJSON.getString(jo, "message", false, true); 3709 this.signatureIndex = ReadBoxedJSON.getInteger(jo, "signatureIndex", true); 3710 this.errorField = ReadJSON.getString(jo, "errorField", true, false); 3711 } 3712 3713 3714 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 3715 public boolean equals(Object other) 3716 { 3717 if (this == other) return true; 3718 if (other == null) return false; 3719 if (other.getClass() != this.getClass()) return false; 3720 3721 SignedExchangeError o = (SignedExchangeError) other; 3722 3723 return 3724 Objects.equals(this.message, o.message) 3725 && Objects.equals(this.signatureIndex, o.signatureIndex) 3726 && Objects.equals(this.errorField, o.errorField); 3727 } 3728 3729 /** Generates a Hash-Code for {@code 'this'} instance */ 3730 public int hashCode() 3731 { 3732 return 3733 Objects.hashCode(this.message) 3734 + Objects.hashCode(this.signatureIndex) 3735 + Objects.hashCode(this.errorField); 3736 } 3737 } 3738 3739 /** 3740 * Information about a signed exchange response. 3741 * <BR /> 3742 * <BR /><B>EXPERIMENTAL</B> 3743 */ 3744 public static class SignedExchangeInfo 3745 extends BaseType 3746 implements java.io.Serializable 3747 { 3748 /** For Object Serialization. java.io.Serializable */ 3749 protected static final long serialVersionUID = 1; 3750 3751 public boolean[] optionals() 3752 { return new boolean[] { false, true, true, true, }; } 3753 3754 /** The outer response of signed HTTP exchange which was received from network. */ 3755 public final Network.Response outerResponse; 3756 3757 /** 3758 * Information about the signed exchange header. 3759 * <BR /> 3760 * <BR /><B>OPTIONAL</B> 3761 */ 3762 public final Network.SignedExchangeHeader header; 3763 3764 /** 3765 * Security details for the signed exchange header. 3766 * <BR /> 3767 * <BR /><B>OPTIONAL</B> 3768 */ 3769 public final Network.SecurityDetails securityDetails; 3770 3771 /** 3772 * Errors occurred while handling the signed exchagne. 3773 * <BR /> 3774 * <BR /><B>OPTIONAL</B> 3775 */ 3776 public final Network.SignedExchangeError[] errors; 3777 3778 /** 3779 * Constructor 3780 * 3781 * @param outerResponse The outer response of signed HTTP exchange which was received from network. 3782 * 3783 * @param header Information about the signed exchange header. 3784 * <BR /><B>OPTIONAL</B> 3785 * 3786 * @param securityDetails Security details for the signed exchange header. 3787 * <BR /><B>OPTIONAL</B> 3788 * 3789 * @param errors Errors occurred while handling the signed exchagne. 3790 * <BR /><B>OPTIONAL</B> 3791 */ 3792 public SignedExchangeInfo( 3793 Network.Response outerResponse, Network.SignedExchangeHeader header, 3794 Network.SecurityDetails securityDetails, Network.SignedExchangeError[] errors 3795 ) 3796 { 3797 // Exception-Check(s) to ensure that if any parameters which are not declared as 3798 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 3799 3800 if (outerResponse == null) THROWS.throwNPE("outerResponse"); 3801 3802 this.outerResponse = outerResponse; 3803 this.header = header; 3804 this.securityDetails = securityDetails; 3805 this.errors = errors; 3806 } 3807 3808 /** 3809 * JSON Object Constructor 3810 * @param jo A Json-Object having data about an instance of {@code 'SignedExchangeInfo'}. 3811 */ 3812 public SignedExchangeInfo (JsonObject jo) 3813 { 3814 this.outerResponse = ReadJSON.getObject(jo, "outerResponse", Network.Response.class, false, true); 3815 this.header = ReadJSON.getObject(jo, "header", Network.SignedExchangeHeader.class, true, false); 3816 this.securityDetails = ReadJSON.getObject(jo, "securityDetails", Network.SecurityDetails.class, true, false); 3817 this.errors = (jo.getJsonArray("errors") == null) 3818 ? null 3819 : RJArrIntoStream.objArr(jo.getJsonArray("errors"), null, 0, Network.SignedExchangeError.class).toArray(Network.SignedExchangeError[]::new); 3820 3821 } 3822 3823 3824 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 3825 public boolean equals(Object other) 3826 { 3827 if (this == other) return true; 3828 if (other == null) return false; 3829 if (other.getClass() != this.getClass()) return false; 3830 3831 SignedExchangeInfo o = (SignedExchangeInfo) other; 3832 3833 return 3834 Objects.equals(this.outerResponse, o.outerResponse) 3835 && Objects.equals(this.header, o.header) 3836 && Objects.equals(this.securityDetails, o.securityDetails) 3837 && Arrays.deepEquals(this.errors, o.errors); 3838 } 3839 3840 /** Generates a Hash-Code for {@code 'this'} instance */ 3841 public int hashCode() 3842 { 3843 return 3844 this.outerResponse.hashCode() 3845 + this.header.hashCode() 3846 + this.securityDetails.hashCode() 3847 + Arrays.deepHashCode(this.errors); 3848 } 3849 } 3850 3851 /** 3852 * <CODE>[No Description Provided by Google]</CODE> 3853 * <BR /> 3854 * <BR /><B>EXPERIMENTAL</B> 3855 */ 3856 public static class ConnectTiming 3857 extends BaseType 3858 implements java.io.Serializable 3859 { 3860 /** For Object Serialization. java.io.Serializable */ 3861 protected static final long serialVersionUID = 1; 3862 3863 public boolean[] optionals() 3864 { return new boolean[] { false, }; } 3865 3866 /** 3867 * Timing's requestTime is a baseline in seconds, while the other numbers are ticks in 3868 * milliseconds relatively to this requestTime. Matches ResourceTiming's requestTime for 3869 * the same request (but not for redirected requests). 3870 */ 3871 public final Number requestTime; 3872 3873 /** 3874 * Constructor 3875 * 3876 * @param requestTime 3877 * Timing's requestTime is a baseline in seconds, while the other numbers are ticks in 3878 * milliseconds relatively to this requestTime. Matches ResourceTiming's requestTime for 3879 * the same request (but not for redirected requests). 3880 */ 3881 public ConnectTiming(Number requestTime) 3882 { 3883 // Exception-Check(s) to ensure that if any parameters which are not declared as 3884 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 3885 3886 if (requestTime == null) THROWS.throwNPE("requestTime"); 3887 3888 this.requestTime = requestTime; 3889 } 3890 3891 /** 3892 * JSON Object Constructor 3893 * @param jo A Json-Object having data about an instance of {@code 'ConnectTiming'}. 3894 */ 3895 public ConnectTiming (JsonObject jo) 3896 { 3897 this.requestTime = ReadNumberJSON.get(jo, "requestTime", false, true); 3898 } 3899 3900 3901 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 3902 public boolean equals(Object other) 3903 { 3904 if (this == other) return true; 3905 if (other == null) return false; 3906 if (other.getClass() != this.getClass()) return false; 3907 3908 ConnectTiming o = (ConnectTiming) other; 3909 3910 return 3911 Objects.equals(this.requestTime, o.requestTime); 3912 } 3913 3914 /** Generates a Hash-Code for {@code 'this'} instance */ 3915 public int hashCode() 3916 { 3917 return 3918 Objects.hashCode(this.requestTime); 3919 } 3920 } 3921 3922 /** 3923 * <CODE>[No Description Provided by Google]</CODE> 3924 * <BR /> 3925 * <BR /><B>EXPERIMENTAL</B> 3926 */ 3927 public static class ClientSecurityState 3928 extends BaseType 3929 implements java.io.Serializable 3930 { 3931 /** For Object Serialization. java.io.Serializable */ 3932 protected static final long serialVersionUID = 1; 3933 3934 public boolean[] optionals() 3935 { return new boolean[] { false, false, false, }; } 3936 3937 /** <CODE>[No Description Provided by Google]</CODE> */ 3938 public final boolean initiatorIsSecureContext; 3939 3940 /** <CODE>[No Description Provided by Google]</CODE> */ 3941 public final String initiatorIPAddressSpace; 3942 3943 /** <CODE>[No Description Provided by Google]</CODE> */ 3944 public final String privateNetworkRequestPolicy; 3945 3946 /** 3947 * Constructor 3948 * 3949 * @param initiatorIsSecureContext - 3950 * 3951 * @param initiatorIPAddressSpace - 3952 * 3953 * @param privateNetworkRequestPolicy - 3954 */ 3955 public ClientSecurityState( 3956 boolean initiatorIsSecureContext, String initiatorIPAddressSpace, 3957 String privateNetworkRequestPolicy 3958 ) 3959 { 3960 // Exception-Check(s) to ensure that if any parameters which are not declared as 3961 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 3962 3963 if (initiatorIPAddressSpace == null) THROWS.throwNPE("initiatorIPAddressSpace"); 3964 if (privateNetworkRequestPolicy == null) THROWS.throwNPE("privateNetworkRequestPolicy"); 3965 3966 // Exception-Check(s) to ensure that if any parameters which must adhere to a 3967 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 3968 3969 THROWS.checkIAE("initiatorIPAddressSpace", initiatorIPAddressSpace, "Network.IPAddressSpace", Network.IPAddressSpace); 3970 THROWS.checkIAE("privateNetworkRequestPolicy", privateNetworkRequestPolicy, "Network.PrivateNetworkRequestPolicy", Network.PrivateNetworkRequestPolicy); 3971 3972 this.initiatorIsSecureContext = initiatorIsSecureContext; 3973 this.initiatorIPAddressSpace = initiatorIPAddressSpace; 3974 this.privateNetworkRequestPolicy = privateNetworkRequestPolicy; 3975 } 3976 3977 /** 3978 * JSON Object Constructor 3979 * @param jo A Json-Object having data about an instance of {@code 'ClientSecurityState'}. 3980 */ 3981 public ClientSecurityState (JsonObject jo) 3982 { 3983 this.initiatorIsSecureContext = ReadPrimJSON.getBoolean(jo, "initiatorIsSecureContext"); 3984 this.initiatorIPAddressSpace = ReadJSON.getString(jo, "initiatorIPAddressSpace", false, true); 3985 this.privateNetworkRequestPolicy = ReadJSON.getString(jo, "privateNetworkRequestPolicy", false, true); 3986 } 3987 3988 3989 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 3990 public boolean equals(Object other) 3991 { 3992 if (this == other) return true; 3993 if (other == null) return false; 3994 if (other.getClass() != this.getClass()) return false; 3995 3996 ClientSecurityState o = (ClientSecurityState) other; 3997 3998 return 3999 (this.initiatorIsSecureContext == o.initiatorIsSecureContext) 4000 && Objects.equals(this.initiatorIPAddressSpace, o.initiatorIPAddressSpace) 4001 && Objects.equals(this.privateNetworkRequestPolicy, o.privateNetworkRequestPolicy); 4002 } 4003 4004 /** Generates a Hash-Code for {@code 'this'} instance */ 4005 public int hashCode() 4006 { 4007 return 4008 (this.initiatorIsSecureContext ? 1 : 0) 4009 + Objects.hashCode(this.initiatorIPAddressSpace) 4010 + Objects.hashCode(this.privateNetworkRequestPolicy); 4011 } 4012 } 4013 4014 /** 4015 * <CODE>[No Description Provided by Google]</CODE> 4016 * <BR /> 4017 * <BR /><B>EXPERIMENTAL</B> 4018 */ 4019 public static class CrossOriginOpenerPolicyStatus 4020 extends BaseType 4021 implements java.io.Serializable 4022 { 4023 /** For Object Serialization. java.io.Serializable */ 4024 protected static final long serialVersionUID = 1; 4025 4026 public boolean[] optionals() 4027 { return new boolean[] { false, false, true, true, }; } 4028 4029 /** <CODE>[No Description Provided by Google]</CODE> */ 4030 public final String value; 4031 4032 /** <CODE>[No Description Provided by Google]</CODE> */ 4033 public final String reportOnlyValue; 4034 4035 /** 4036 * <CODE>[No Description Provided by Google]</CODE> 4037 * <BR /> 4038 * <BR /><B>OPTIONAL</B> 4039 */ 4040 public final String reportingEndpoint; 4041 4042 /** 4043 * <CODE>[No Description Provided by Google]</CODE> 4044 * <BR /> 4045 * <BR /><B>OPTIONAL</B> 4046 */ 4047 public final String reportOnlyReportingEndpoint; 4048 4049 /** 4050 * Constructor 4051 * 4052 * @param value - 4053 * 4054 * @param reportOnlyValue - 4055 * 4056 * @param reportingEndpoint - 4057 * <BR /><B>OPTIONAL</B> 4058 * 4059 * @param reportOnlyReportingEndpoint - 4060 * <BR /><B>OPTIONAL</B> 4061 */ 4062 public CrossOriginOpenerPolicyStatus( 4063 String value, String reportOnlyValue, String reportingEndpoint, 4064 String reportOnlyReportingEndpoint 4065 ) 4066 { 4067 // Exception-Check(s) to ensure that if any parameters which are not declared as 4068 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 4069 4070 if (value == null) THROWS.throwNPE("value"); 4071 if (reportOnlyValue == null) THROWS.throwNPE("reportOnlyValue"); 4072 4073 // Exception-Check(s) to ensure that if any parameters which must adhere to a 4074 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 4075 4076 THROWS.checkIAE("value", value, "Network.CrossOriginOpenerPolicyValue", Network.CrossOriginOpenerPolicyValue); 4077 THROWS.checkIAE("reportOnlyValue", reportOnlyValue, "Network.CrossOriginOpenerPolicyValue", Network.CrossOriginOpenerPolicyValue); 4078 4079 this.value = value; 4080 this.reportOnlyValue = reportOnlyValue; 4081 this.reportingEndpoint = reportingEndpoint; 4082 this.reportOnlyReportingEndpoint = reportOnlyReportingEndpoint; 4083 } 4084 4085 /** 4086 * JSON Object Constructor 4087 * @param jo A Json-Object having data about an instance of {@code 'CrossOriginOpenerPolicyStatus'}. 4088 */ 4089 public CrossOriginOpenerPolicyStatus (JsonObject jo) 4090 { 4091 this.value = ReadJSON.getString(jo, "value", false, true); 4092 this.reportOnlyValue = ReadJSON.getString(jo, "reportOnlyValue", false, true); 4093 this.reportingEndpoint = ReadJSON.getString(jo, "reportingEndpoint", true, false); 4094 this.reportOnlyReportingEndpoint = ReadJSON.getString(jo, "reportOnlyReportingEndpoint", true, false); 4095 } 4096 4097 4098 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 4099 public boolean equals(Object other) 4100 { 4101 if (this == other) return true; 4102 if (other == null) return false; 4103 if (other.getClass() != this.getClass()) return false; 4104 4105 CrossOriginOpenerPolicyStatus o = (CrossOriginOpenerPolicyStatus) other; 4106 4107 return 4108 Objects.equals(this.value, o.value) 4109 && Objects.equals(this.reportOnlyValue, o.reportOnlyValue) 4110 && Objects.equals(this.reportingEndpoint, o.reportingEndpoint) 4111 && Objects.equals(this.reportOnlyReportingEndpoint, o.reportOnlyReportingEndpoint); 4112 } 4113 4114 /** Generates a Hash-Code for {@code 'this'} instance */ 4115 public int hashCode() 4116 { 4117 return 4118 Objects.hashCode(this.value) 4119 + Objects.hashCode(this.reportOnlyValue) 4120 + Objects.hashCode(this.reportingEndpoint) 4121 + Objects.hashCode(this.reportOnlyReportingEndpoint); 4122 } 4123 } 4124 4125 /** 4126 * <CODE>[No Description Provided by Google]</CODE> 4127 * <BR /> 4128 * <BR /><B>EXPERIMENTAL</B> 4129 */ 4130 public static class CrossOriginEmbedderPolicyStatus 4131 extends BaseType 4132 implements java.io.Serializable 4133 { 4134 /** For Object Serialization. java.io.Serializable */ 4135 protected static final long serialVersionUID = 1; 4136 4137 public boolean[] optionals() 4138 { return new boolean[] { false, false, true, true, }; } 4139 4140 /** <CODE>[No Description Provided by Google]</CODE> */ 4141 public final String value; 4142 4143 /** <CODE>[No Description Provided by Google]</CODE> */ 4144 public final String reportOnlyValue; 4145 4146 /** 4147 * <CODE>[No Description Provided by Google]</CODE> 4148 * <BR /> 4149 * <BR /><B>OPTIONAL</B> 4150 */ 4151 public final String reportingEndpoint; 4152 4153 /** 4154 * <CODE>[No Description Provided by Google]</CODE> 4155 * <BR /> 4156 * <BR /><B>OPTIONAL</B> 4157 */ 4158 public final String reportOnlyReportingEndpoint; 4159 4160 /** 4161 * Constructor 4162 * 4163 * @param value - 4164 * 4165 * @param reportOnlyValue - 4166 * 4167 * @param reportingEndpoint - 4168 * <BR /><B>OPTIONAL</B> 4169 * 4170 * @param reportOnlyReportingEndpoint - 4171 * <BR /><B>OPTIONAL</B> 4172 */ 4173 public CrossOriginEmbedderPolicyStatus( 4174 String value, String reportOnlyValue, String reportingEndpoint, 4175 String reportOnlyReportingEndpoint 4176 ) 4177 { 4178 // Exception-Check(s) to ensure that if any parameters which are not declared as 4179 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 4180 4181 if (value == null) THROWS.throwNPE("value"); 4182 if (reportOnlyValue == null) THROWS.throwNPE("reportOnlyValue"); 4183 4184 // Exception-Check(s) to ensure that if any parameters which must adhere to a 4185 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 4186 4187 THROWS.checkIAE("value", value, "Network.CrossOriginEmbedderPolicyValue", Network.CrossOriginEmbedderPolicyValue); 4188 THROWS.checkIAE("reportOnlyValue", reportOnlyValue, "Network.CrossOriginEmbedderPolicyValue", Network.CrossOriginEmbedderPolicyValue); 4189 4190 this.value = value; 4191 this.reportOnlyValue = reportOnlyValue; 4192 this.reportingEndpoint = reportingEndpoint; 4193 this.reportOnlyReportingEndpoint = reportOnlyReportingEndpoint; 4194 } 4195 4196 /** 4197 * JSON Object Constructor 4198 * @param jo A Json-Object having data about an instance of {@code 'CrossOriginEmbedderPolicyStatus'}. 4199 */ 4200 public CrossOriginEmbedderPolicyStatus (JsonObject jo) 4201 { 4202 this.value = ReadJSON.getString(jo, "value", false, true); 4203 this.reportOnlyValue = ReadJSON.getString(jo, "reportOnlyValue", false, true); 4204 this.reportingEndpoint = ReadJSON.getString(jo, "reportingEndpoint", true, false); 4205 this.reportOnlyReportingEndpoint = ReadJSON.getString(jo, "reportOnlyReportingEndpoint", true, false); 4206 } 4207 4208 4209 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 4210 public boolean equals(Object other) 4211 { 4212 if (this == other) return true; 4213 if (other == null) return false; 4214 if (other.getClass() != this.getClass()) return false; 4215 4216 CrossOriginEmbedderPolicyStatus o = (CrossOriginEmbedderPolicyStatus) other; 4217 4218 return 4219 Objects.equals(this.value, o.value) 4220 && Objects.equals(this.reportOnlyValue, o.reportOnlyValue) 4221 && Objects.equals(this.reportingEndpoint, o.reportingEndpoint) 4222 && Objects.equals(this.reportOnlyReportingEndpoint, o.reportOnlyReportingEndpoint); 4223 } 4224 4225 /** Generates a Hash-Code for {@code 'this'} instance */ 4226 public int hashCode() 4227 { 4228 return 4229 Objects.hashCode(this.value) 4230 + Objects.hashCode(this.reportOnlyValue) 4231 + Objects.hashCode(this.reportingEndpoint) 4232 + Objects.hashCode(this.reportOnlyReportingEndpoint); 4233 } 4234 } 4235 4236 /** 4237 * <CODE>[No Description Provided by Google]</CODE> 4238 * <BR /> 4239 * <BR /><B>EXPERIMENTAL</B> 4240 */ 4241 public static class SecurityIsolationStatus 4242 extends BaseType 4243 implements java.io.Serializable 4244 { 4245 /** For Object Serialization. java.io.Serializable */ 4246 protected static final long serialVersionUID = 1; 4247 4248 public boolean[] optionals() 4249 { return new boolean[] { true, true, }; } 4250 4251 /** 4252 * <CODE>[No Description Provided by Google]</CODE> 4253 * <BR /> 4254 * <BR /><B>OPTIONAL</B> 4255 */ 4256 public final Network.CrossOriginOpenerPolicyStatus coop; 4257 4258 /** 4259 * <CODE>[No Description Provided by Google]</CODE> 4260 * <BR /> 4261 * <BR /><B>OPTIONAL</B> 4262 */ 4263 public final Network.CrossOriginEmbedderPolicyStatus coep; 4264 4265 /** 4266 * Constructor 4267 * 4268 * @param coop - 4269 * <BR /><B>OPTIONAL</B> 4270 * 4271 * @param coep - 4272 * <BR /><B>OPTIONAL</B> 4273 */ 4274 public SecurityIsolationStatus( 4275 Network.CrossOriginOpenerPolicyStatus coop, 4276 Network.CrossOriginEmbedderPolicyStatus coep 4277 ) 4278 { 4279 this.coop = coop; 4280 this.coep = coep; 4281 } 4282 4283 /** 4284 * JSON Object Constructor 4285 * @param jo A Json-Object having data about an instance of {@code 'SecurityIsolationStatus'}. 4286 */ 4287 public SecurityIsolationStatus (JsonObject jo) 4288 { 4289 this.coop = ReadJSON.getObject(jo, "coop", Network.CrossOriginOpenerPolicyStatus.class, true, false); 4290 this.coep = ReadJSON.getObject(jo, "coep", Network.CrossOriginEmbedderPolicyStatus.class, true, false); 4291 } 4292 4293 4294 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 4295 public boolean equals(Object other) 4296 { 4297 if (this == other) return true; 4298 if (other == null) return false; 4299 if (other.getClass() != this.getClass()) return false; 4300 4301 SecurityIsolationStatus o = (SecurityIsolationStatus) other; 4302 4303 return 4304 Objects.equals(this.coop, o.coop) 4305 && Objects.equals(this.coep, o.coep); 4306 } 4307 4308 /** Generates a Hash-Code for {@code 'this'} instance */ 4309 public int hashCode() 4310 { 4311 return 4312 this.coop.hashCode() 4313 + this.coep.hashCode(); 4314 } 4315 } 4316 4317 /** 4318 * An object representing a report generated by the Reporting API. 4319 * <BR /> 4320 * <BR /><B>EXPERIMENTAL</B> 4321 */ 4322 public static class ReportingApiReport 4323 extends BaseType 4324 implements java.io.Serializable 4325 { 4326 /** For Object Serialization. java.io.Serializable */ 4327 protected static final long serialVersionUID = 1; 4328 4329 public boolean[] optionals() 4330 { return new boolean[] { false, false, false, false, false, false, false, false, false, }; } 4331 4332 /** <CODE>[No Description Provided by Google]</CODE> */ 4333 public final String id; 4334 4335 /** The URL of the document that triggered the report. */ 4336 public final String initiatorUrl; 4337 4338 /** The name of the endpoint group that should be used to deliver the report. */ 4339 public final String destination; 4340 4341 /** The type of the report (specifies the set of data that is contained in the report body). */ 4342 public final String type; 4343 4344 /** When the report was generated. */ 4345 public final Number timestamp; 4346 4347 /** How many uploads deep the related request was. */ 4348 public final int depth; 4349 4350 /** The number of delivery attempts made so far, not including an active attempt. */ 4351 public final int completedAttempts; 4352 4353 /** <CODE>[No Description Provided by Google]</CODE> */ 4354 public final JsonObject body; 4355 4356 /** <CODE>[No Description Provided by Google]</CODE> */ 4357 public final String status; 4358 4359 /** 4360 * Constructor 4361 * 4362 * @param id - 4363 * 4364 * @param initiatorUrl The URL of the document that triggered the report. 4365 * 4366 * @param destination The name of the endpoint group that should be used to deliver the report. 4367 * 4368 * @param type The type of the report (specifies the set of data that is contained in the report body). 4369 * 4370 * @param timestamp When the report was generated. 4371 * 4372 * @param depth How many uploads deep the related request was. 4373 * 4374 * @param completedAttempts The number of delivery attempts made so far, not including an active attempt. 4375 * 4376 * @param body - 4377 * 4378 * @param status - 4379 */ 4380 public ReportingApiReport( 4381 String id, String initiatorUrl, String destination, String type, Number timestamp, 4382 int depth, int completedAttempts, JsonObject body, String status 4383 ) 4384 { 4385 // Exception-Check(s) to ensure that if any parameters which are not declared as 4386 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 4387 4388 if (id == null) THROWS.throwNPE("id"); 4389 if (initiatorUrl == null) THROWS.throwNPE("initiatorUrl"); 4390 if (destination == null) THROWS.throwNPE("destination"); 4391 if (type == null) THROWS.throwNPE("type"); 4392 if (timestamp == null) THROWS.throwNPE("timestamp"); 4393 if (body == null) THROWS.throwNPE("body"); 4394 if (status == null) THROWS.throwNPE("status"); 4395 4396 // Exception-Check(s) to ensure that if any parameters which must adhere to a 4397 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 4398 4399 THROWS.checkIAE("status", status, "Network.ReportStatus", Network.ReportStatus); 4400 4401 this.id = id; 4402 this.initiatorUrl = initiatorUrl; 4403 this.destination = destination; 4404 this.type = type; 4405 this.timestamp = timestamp; 4406 this.depth = depth; 4407 this.completedAttempts = completedAttempts; 4408 this.body = body; 4409 this.status = status; 4410 } 4411 4412 /** 4413 * JSON Object Constructor 4414 * @param jo A Json-Object having data about an instance of {@code 'ReportingApiReport'}. 4415 */ 4416 public ReportingApiReport (JsonObject jo) 4417 { 4418 this.id = ReadJSON.getString(jo, "id", false, true); 4419 this.initiatorUrl = ReadJSON.getString(jo, "initiatorUrl", false, true); 4420 this.destination = ReadJSON.getString(jo, "destination", false, true); 4421 this.type = ReadJSON.getString(jo, "type", false, true); 4422 this.timestamp = ReadNumberJSON.get(jo, "timestamp", false, true); 4423 this.depth = ReadPrimJSON.getInt(jo, "depth"); 4424 this.completedAttempts = ReadPrimJSON.getInt(jo, "completedAttempts"); 4425 this.body = jo.getJsonObject("body"); 4426 this.status = ReadJSON.getString(jo, "status", false, true); 4427 } 4428 4429 4430 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 4431 public boolean equals(Object other) 4432 { 4433 if (this == other) return true; 4434 if (other == null) return false; 4435 if (other.getClass() != this.getClass()) return false; 4436 4437 ReportingApiReport o = (ReportingApiReport) other; 4438 4439 return 4440 Objects.equals(this.id, o.id) 4441 && Objects.equals(this.initiatorUrl, o.initiatorUrl) 4442 && Objects.equals(this.destination, o.destination) 4443 && Objects.equals(this.type, o.type) 4444 && Objects.equals(this.timestamp, o.timestamp) 4445 && (this.depth == o.depth) 4446 && (this.completedAttempts == o.completedAttempts) 4447 && Objects.equals(this.body, o.body) 4448 && Objects.equals(this.status, o.status); 4449 } 4450 4451 /** Generates a Hash-Code for {@code 'this'} instance */ 4452 public int hashCode() 4453 { 4454 return 4455 Objects.hashCode(this.id) 4456 + Objects.hashCode(this.initiatorUrl) 4457 + Objects.hashCode(this.destination) 4458 + Objects.hashCode(this.type) 4459 + Objects.hashCode(this.timestamp) 4460 + this.depth 4461 + this.completedAttempts 4462 + Objects.hashCode(this.body) 4463 + Objects.hashCode(this.status); 4464 } 4465 } 4466 4467 /** 4468 * An object providing the result of a network resource load. 4469 * <BR /> 4470 * <BR /><B>EXPERIMENTAL</B> 4471 */ 4472 public static class LoadNetworkResourcePageResult 4473 extends BaseType 4474 implements java.io.Serializable 4475 { 4476 /** For Object Serialization. java.io.Serializable */ 4477 protected static final long serialVersionUID = 1; 4478 4479 public boolean[] optionals() 4480 { return new boolean[] { false, true, true, true, true, true, }; } 4481 4482 /** <CODE>[No Description Provided by Google]</CODE> */ 4483 public final boolean success; 4484 4485 /** 4486 * Optional values used for error reporting. 4487 * <BR /> 4488 * <BR /><B>OPTIONAL</B> 4489 */ 4490 public final Number netError; 4491 4492 /** 4493 * <CODE>[No Description Provided by Google]</CODE> 4494 * <BR /> 4495 * <BR /><B>OPTIONAL</B> 4496 */ 4497 public final String netErrorName; 4498 4499 /** 4500 * <CODE>[No Description Provided by Google]</CODE> 4501 * <BR /> 4502 * <BR /><B>OPTIONAL</B> 4503 */ 4504 public final Number httpStatusCode; 4505 4506 /** 4507 * If successful, one of the following two fields holds the result. 4508 * <BR /> 4509 * <BR /><B>OPTIONAL</B> 4510 */ 4511 public final String stream; 4512 4513 /** 4514 * Response headers. 4515 * <BR /> 4516 * <BR /><B>OPTIONAL</B> 4517 */ 4518 public final JsonObject headers; 4519 4520 /** 4521 * Constructor 4522 * 4523 * @param success - 4524 * 4525 * @param netError Optional values used for error reporting. 4526 * <BR /><B>OPTIONAL</B> 4527 * 4528 * @param netErrorName - 4529 * <BR /><B>OPTIONAL</B> 4530 * 4531 * @param httpStatusCode - 4532 * <BR /><B>OPTIONAL</B> 4533 * 4534 * @param stream If successful, one of the following two fields holds the result. 4535 * <BR /><B>OPTIONAL</B> 4536 * 4537 * @param headers Response headers. 4538 * <BR /><B>OPTIONAL</B> 4539 */ 4540 public LoadNetworkResourcePageResult( 4541 boolean success, Number netError, String netErrorName, Number httpStatusCode, 4542 String stream, JsonObject headers 4543 ) 4544 { 4545 this.success = success; 4546 this.netError = netError; 4547 this.netErrorName = netErrorName; 4548 this.httpStatusCode = httpStatusCode; 4549 this.stream = stream; 4550 this.headers = headers; 4551 } 4552 4553 /** 4554 * JSON Object Constructor 4555 * @param jo A Json-Object having data about an instance of {@code 'LoadNetworkResourcePageResult'}. 4556 */ 4557 public LoadNetworkResourcePageResult (JsonObject jo) 4558 { 4559 this.success = ReadPrimJSON.getBoolean(jo, "success"); 4560 this.netError = ReadNumberJSON.get(jo, "netError", true, false); 4561 this.netErrorName = ReadJSON.getString(jo, "netErrorName", true, false); 4562 this.httpStatusCode = ReadNumberJSON.get(jo, "httpStatusCode", true, false); 4563 this.stream = ReadJSON.getString(jo, "stream", true, false); 4564 this.headers = jo.getJsonObject("headers"); 4565 } 4566 4567 4568 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 4569 public boolean equals(Object other) 4570 { 4571 if (this == other) return true; 4572 if (other == null) return false; 4573 if (other.getClass() != this.getClass()) return false; 4574 4575 LoadNetworkResourcePageResult o = (LoadNetworkResourcePageResult) other; 4576 4577 return 4578 (this.success == o.success) 4579 && Objects.equals(this.netError, o.netError) 4580 && Objects.equals(this.netErrorName, o.netErrorName) 4581 && Objects.equals(this.httpStatusCode, o.httpStatusCode) 4582 && Objects.equals(this.stream, o.stream) 4583 && Objects.equals(this.headers, o.headers); 4584 } 4585 4586 /** Generates a Hash-Code for {@code 'this'} instance */ 4587 public int hashCode() 4588 { 4589 return 4590 (this.success ? 1 : 0) 4591 + Objects.hashCode(this.netError) 4592 + Objects.hashCode(this.netErrorName) 4593 + Objects.hashCode(this.httpStatusCode) 4594 + Objects.hashCode(this.stream) 4595 + this.headers.hashCode(); 4596 } 4597 } 4598 4599 /** 4600 * An options object that may be extended later to better support CORS, 4601 * CORB and streaming. 4602 * <BR /> 4603 * <BR /><B>EXPERIMENTAL</B> 4604 */ 4605 public static class LoadNetworkResourceOptions 4606 extends BaseType 4607 implements java.io.Serializable 4608 { 4609 /** For Object Serialization. java.io.Serializable */ 4610 protected static final long serialVersionUID = 1; 4611 4612 public boolean[] optionals() 4613 { return new boolean[] { false, false, }; } 4614 4615 /** <CODE>[No Description Provided by Google]</CODE> */ 4616 public final boolean disableCache; 4617 4618 /** <CODE>[No Description Provided by Google]</CODE> */ 4619 public final boolean includeCredentials; 4620 4621 /** 4622 * Constructor 4623 * 4624 * @param disableCache - 4625 * 4626 * @param includeCredentials - 4627 */ 4628 public LoadNetworkResourceOptions(boolean disableCache, boolean includeCredentials) 4629 { 4630 this.disableCache = disableCache; 4631 this.includeCredentials = includeCredentials; 4632 } 4633 4634 /** 4635 * JSON Object Constructor 4636 * @param jo A Json-Object having data about an instance of {@code 'LoadNetworkResourceOptions'}. 4637 */ 4638 public LoadNetworkResourceOptions (JsonObject jo) 4639 { 4640 this.disableCache = ReadPrimJSON.getBoolean(jo, "disableCache"); 4641 this.includeCredentials = ReadPrimJSON.getBoolean(jo, "includeCredentials"); 4642 } 4643 4644 4645 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 4646 public boolean equals(Object other) 4647 { 4648 if (this == other) return true; 4649 if (other == null) return false; 4650 if (other.getClass() != this.getClass()) return false; 4651 4652 LoadNetworkResourceOptions o = (LoadNetworkResourceOptions) other; 4653 4654 return 4655 (this.disableCache == o.disableCache) 4656 && (this.includeCredentials == o.includeCredentials); 4657 } 4658 4659 /** Generates a Hash-Code for {@code 'this'} instance */ 4660 public int hashCode() 4661 { 4662 return 4663 (this.disableCache ? 1 : 0) 4664 + (this.includeCredentials ? 1 : 0); 4665 } 4666 } 4667 4668 /** Fired when data chunk was received over the network. */ 4669 public static class dataReceived 4670 extends BrowserEvent 4671 implements java.io.Serializable 4672 { 4673 /** For Object Serialization. java.io.Serializable */ 4674 protected static final long serialVersionUID = 1; 4675 4676 public boolean[] optionals() 4677 { return new boolean[] { false, false, false, false, }; } 4678 4679 /** Request identifier. */ 4680 public final String requestId; 4681 4682 /** Timestamp. */ 4683 public final Number timestamp; 4684 4685 /** Data chunk length. */ 4686 public final int dataLength; 4687 4688 /** Actual bytes received (might be less than dataLength for compressed encodings). */ 4689 public final int encodedDataLength; 4690 4691 /** 4692 * Constructor 4693 * 4694 * @param requestId Request identifier. 4695 * 4696 * @param timestamp Timestamp. 4697 * 4698 * @param dataLength Data chunk length. 4699 * 4700 * @param encodedDataLength Actual bytes received (might be less than dataLength for compressed encodings). 4701 */ 4702 public dataReceived 4703 (String requestId, Number timestamp, int dataLength, int encodedDataLength) 4704 { 4705 super("Network", "dataReceived", 4); 4706 4707 // Exception-Check(s) to ensure that if any parameters which are not declared as 4708 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 4709 4710 if (requestId == null) THROWS.throwNPE("requestId"); 4711 if (timestamp == null) THROWS.throwNPE("timestamp"); 4712 4713 this.requestId = requestId; 4714 this.timestamp = timestamp; 4715 this.dataLength = dataLength; 4716 this.encodedDataLength = encodedDataLength; 4717 } 4718 4719 /** 4720 * JSON Object Constructor 4721 * @param jo A Json-Object having data about an instance of {@code 'dataReceived'}. 4722 */ 4723 public dataReceived (JsonObject jo) 4724 { 4725 super("Network", "dataReceived", 4); 4726 4727 this.requestId = ReadJSON.getString(jo, "requestId", false, true); 4728 this.timestamp = ReadNumberJSON.get(jo, "timestamp", false, true); 4729 this.dataLength = ReadPrimJSON.getInt(jo, "dataLength"); 4730 this.encodedDataLength = ReadPrimJSON.getInt(jo, "encodedDataLength"); 4731 } 4732 4733 4734 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 4735 public boolean equals(Object other) 4736 { 4737 if (this == other) return true; 4738 if (other == null) return false; 4739 if (other.getClass() != this.getClass()) return false; 4740 4741 dataReceived o = (dataReceived) other; 4742 4743 return 4744 Objects.equals(this.requestId, o.requestId) 4745 && Objects.equals(this.timestamp, o.timestamp) 4746 && (this.dataLength == o.dataLength) 4747 && (this.encodedDataLength == o.encodedDataLength); 4748 } 4749 4750 /** Generates a Hash-Code for {@code 'this'} instance */ 4751 public int hashCode() 4752 { 4753 return 4754 Objects.hashCode(this.requestId) 4755 + Objects.hashCode(this.timestamp) 4756 + this.dataLength 4757 + this.encodedDataLength; 4758 } 4759 } 4760 4761 /** Fired when EventSource message is received. */ 4762 public static class eventSourceMessageReceived 4763 extends BrowserEvent 4764 implements java.io.Serializable 4765 { 4766 /** For Object Serialization. java.io.Serializable */ 4767 protected static final long serialVersionUID = 1; 4768 4769 public boolean[] optionals() 4770 { return new boolean[] { false, false, false, false, false, }; } 4771 4772 /** Request identifier. */ 4773 public final String requestId; 4774 4775 /** Timestamp. */ 4776 public final Number timestamp; 4777 4778 /** Message type. */ 4779 public final String eventName; 4780 4781 /** Message identifier. */ 4782 public final String eventId; 4783 4784 /** Message content. */ 4785 public final String data; 4786 4787 /** 4788 * Constructor 4789 * 4790 * @param requestId Request identifier. 4791 * 4792 * @param timestamp Timestamp. 4793 * 4794 * @param eventName Message type. 4795 * 4796 * @param eventId Message identifier. 4797 * 4798 * @param data Message content. 4799 */ 4800 public eventSourceMessageReceived 4801 (String requestId, Number timestamp, String eventName, String eventId, String data) 4802 { 4803 super("Network", "eventSourceMessageReceived", 5); 4804 4805 // Exception-Check(s) to ensure that if any parameters which are not declared as 4806 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 4807 4808 if (requestId == null) THROWS.throwNPE("requestId"); 4809 if (timestamp == null) THROWS.throwNPE("timestamp"); 4810 if (eventName == null) THROWS.throwNPE("eventName"); 4811 if (eventId == null) THROWS.throwNPE("eventId"); 4812 if (data == null) THROWS.throwNPE("data"); 4813 4814 this.requestId = requestId; 4815 this.timestamp = timestamp; 4816 this.eventName = eventName; 4817 this.eventId = eventId; 4818 this.data = data; 4819 } 4820 4821 /** 4822 * JSON Object Constructor 4823 * @param jo A Json-Object having data about an instance of {@code 'eventSourceMessageReceived'}. 4824 */ 4825 public eventSourceMessageReceived (JsonObject jo) 4826 { 4827 super("Network", "eventSourceMessageReceived", 5); 4828 4829 this.requestId = ReadJSON.getString(jo, "requestId", false, true); 4830 this.timestamp = ReadNumberJSON.get(jo, "timestamp", false, true); 4831 this.eventName = ReadJSON.getString(jo, "eventName", false, true); 4832 this.eventId = ReadJSON.getString(jo, "eventId", false, true); 4833 this.data = ReadJSON.getString(jo, "data", false, true); 4834 } 4835 4836 4837 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 4838 public boolean equals(Object other) 4839 { 4840 if (this == other) return true; 4841 if (other == null) return false; 4842 if (other.getClass() != this.getClass()) return false; 4843 4844 eventSourceMessageReceived o = (eventSourceMessageReceived) other; 4845 4846 return 4847 Objects.equals(this.requestId, o.requestId) 4848 && Objects.equals(this.timestamp, o.timestamp) 4849 && Objects.equals(this.eventName, o.eventName) 4850 && Objects.equals(this.eventId, o.eventId) 4851 && Objects.equals(this.data, o.data); 4852 } 4853 4854 /** Generates a Hash-Code for {@code 'this'} instance */ 4855 public int hashCode() 4856 { 4857 return 4858 Objects.hashCode(this.requestId) 4859 + Objects.hashCode(this.timestamp) 4860 + Objects.hashCode(this.eventName) 4861 + Objects.hashCode(this.eventId) 4862 + Objects.hashCode(this.data); 4863 } 4864 } 4865 4866 /** Fired when HTTP request has failed to load. */ 4867 public static class loadingFailed 4868 extends BrowserEvent 4869 implements java.io.Serializable 4870 { 4871 /** For Object Serialization. java.io.Serializable */ 4872 protected static final long serialVersionUID = 1; 4873 4874 public boolean[] optionals() 4875 { return new boolean[] { false, false, false, false, true, true, true, }; } 4876 4877 /** Request identifier. */ 4878 public final String requestId; 4879 4880 /** Timestamp. */ 4881 public final Number timestamp; 4882 4883 /** Resource type. */ 4884 public final String type; 4885 4886 /** User friendly error message. */ 4887 public final String errorText; 4888 4889 /** 4890 * True if loading was canceled. 4891 * <BR /> 4892 * <BR /><B>OPTIONAL</B> 4893 */ 4894 public final Boolean canceled; 4895 4896 /** 4897 * The reason why loading was blocked, if any. 4898 * <BR /> 4899 * <BR /><B>OPTIONAL</B> 4900 */ 4901 public final String blockedReason; 4902 4903 /** 4904 * The reason why loading was blocked by CORS, if any. 4905 * <BR /> 4906 * <BR /><B>OPTIONAL</B> 4907 */ 4908 public final Network.CorsErrorStatus corsErrorStatus; 4909 4910 /** 4911 * Constructor 4912 * 4913 * @param requestId Request identifier. 4914 * 4915 * @param timestamp Timestamp. 4916 * 4917 * @param type Resource type. 4918 * 4919 * @param errorText User friendly error message. 4920 * 4921 * @param canceled True if loading was canceled. 4922 * <BR /><B>OPTIONAL</B> 4923 * 4924 * @param blockedReason The reason why loading was blocked, if any. 4925 * <BR /><B>OPTIONAL</B> 4926 * 4927 * @param corsErrorStatus The reason why loading was blocked by CORS, if any. 4928 * <BR /><B>OPTIONAL</B> 4929 */ 4930 public loadingFailed( 4931 String requestId, Number timestamp, String type, String errorText, Boolean canceled, 4932 String blockedReason, Network.CorsErrorStatus corsErrorStatus 4933 ) 4934 { 4935 super("Network", "loadingFailed", 7); 4936 4937 // Exception-Check(s) to ensure that if any parameters which are not declared as 4938 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 4939 4940 if (requestId == null) THROWS.throwNPE("requestId"); 4941 if (timestamp == null) THROWS.throwNPE("timestamp"); 4942 if (type == null) THROWS.throwNPE("type"); 4943 if (errorText == null) THROWS.throwNPE("errorText"); 4944 4945 // Exception-Check(s) to ensure that if any parameters which must adhere to a 4946 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 4947 4948 THROWS.checkIAE("type", type, "Network.ResourceType", Network.ResourceType); 4949 THROWS.checkIAE("blockedReason", blockedReason, "Network.BlockedReason", Network.BlockedReason); 4950 4951 this.requestId = requestId; 4952 this.timestamp = timestamp; 4953 this.type = type; 4954 this.errorText = errorText; 4955 this.canceled = canceled; 4956 this.blockedReason = blockedReason; 4957 this.corsErrorStatus = corsErrorStatus; 4958 } 4959 4960 /** 4961 * JSON Object Constructor 4962 * @param jo A Json-Object having data about an instance of {@code 'loadingFailed'}. 4963 */ 4964 public loadingFailed (JsonObject jo) 4965 { 4966 super("Network", "loadingFailed", 7); 4967 4968 this.requestId = ReadJSON.getString(jo, "requestId", false, true); 4969 this.timestamp = ReadNumberJSON.get(jo, "timestamp", false, true); 4970 this.type = ReadJSON.getString(jo, "type", false, true); 4971 this.errorText = ReadJSON.getString(jo, "errorText", false, true); 4972 this.canceled = ReadBoxedJSON.getBoolean(jo, "canceled", true); 4973 this.blockedReason = ReadJSON.getString(jo, "blockedReason", true, false); 4974 this.corsErrorStatus = ReadJSON.getObject(jo, "corsErrorStatus", Network.CorsErrorStatus.class, true, false); 4975 } 4976 4977 4978 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 4979 public boolean equals(Object other) 4980 { 4981 if (this == other) return true; 4982 if (other == null) return false; 4983 if (other.getClass() != this.getClass()) return false; 4984 4985 loadingFailed o = (loadingFailed) other; 4986 4987 return 4988 Objects.equals(this.requestId, o.requestId) 4989 && Objects.equals(this.timestamp, o.timestamp) 4990 && Objects.equals(this.type, o.type) 4991 && Objects.equals(this.errorText, o.errorText) 4992 && Objects.equals(this.canceled, o.canceled) 4993 && Objects.equals(this.blockedReason, o.blockedReason) 4994 && Objects.equals(this.corsErrorStatus, o.corsErrorStatus); 4995 } 4996 4997 /** Generates a Hash-Code for {@code 'this'} instance */ 4998 public int hashCode() 4999 { 5000 return 5001 Objects.hashCode(this.requestId) 5002 + Objects.hashCode(this.timestamp) 5003 + Objects.hashCode(this.type) 5004 + Objects.hashCode(this.errorText) 5005 + Objects.hashCode(this.canceled) 5006 + Objects.hashCode(this.blockedReason) 5007 + this.corsErrorStatus.hashCode(); 5008 } 5009 } 5010 5011 /** Fired when HTTP request has finished loading. */ 5012 public static class loadingFinished 5013 extends BrowserEvent 5014 implements java.io.Serializable 5015 { 5016 /** For Object Serialization. java.io.Serializable */ 5017 protected static final long serialVersionUID = 1; 5018 5019 public boolean[] optionals() 5020 { return new boolean[] { false, false, false, true, }; } 5021 5022 /** Request identifier. */ 5023 public final String requestId; 5024 5025 /** Timestamp. */ 5026 public final Number timestamp; 5027 5028 /** Total number of bytes received for this request. */ 5029 public final Number encodedDataLength; 5030 5031 /** 5032 * Set when 1) response was blocked by Cross-Origin Read Blocking and also 5033 * 2) this needs to be reported to the DevTools console. 5034 * <BR /> 5035 * <BR /><B>OPTIONAL</B> 5036 */ 5037 public final Boolean shouldReportCorbBlocking; 5038 5039 /** 5040 * Constructor 5041 * 5042 * @param requestId Request identifier. 5043 * 5044 * @param timestamp Timestamp. 5045 * 5046 * @param encodedDataLength Total number of bytes received for this request. 5047 * 5048 * @param shouldReportCorbBlocking 5049 * Set when 1) response was blocked by Cross-Origin Read Blocking and also 5050 * 2) this needs to be reported to the DevTools console. 5051 * <BR /><B>OPTIONAL</B> 5052 */ 5053 public loadingFinished( 5054 String requestId, Number timestamp, Number encodedDataLength, 5055 Boolean shouldReportCorbBlocking 5056 ) 5057 { 5058 super("Network", "loadingFinished", 4); 5059 5060 // Exception-Check(s) to ensure that if any parameters which are not declared as 5061 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 5062 5063 if (requestId == null) THROWS.throwNPE("requestId"); 5064 if (timestamp == null) THROWS.throwNPE("timestamp"); 5065 if (encodedDataLength == null) THROWS.throwNPE("encodedDataLength"); 5066 5067 this.requestId = requestId; 5068 this.timestamp = timestamp; 5069 this.encodedDataLength = encodedDataLength; 5070 this.shouldReportCorbBlocking = shouldReportCorbBlocking; 5071 } 5072 5073 /** 5074 * JSON Object Constructor 5075 * @param jo A Json-Object having data about an instance of {@code 'loadingFinished'}. 5076 */ 5077 public loadingFinished (JsonObject jo) 5078 { 5079 super("Network", "loadingFinished", 4); 5080 5081 this.requestId = ReadJSON.getString(jo, "requestId", false, true); 5082 this.timestamp = ReadNumberJSON.get(jo, "timestamp", false, true); 5083 this.encodedDataLength = ReadNumberJSON.get(jo, "encodedDataLength", false, true); 5084 this.shouldReportCorbBlocking = ReadBoxedJSON.getBoolean(jo, "shouldReportCorbBlocking", true); 5085 } 5086 5087 5088 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 5089 public boolean equals(Object other) 5090 { 5091 if (this == other) return true; 5092 if (other == null) return false; 5093 if (other.getClass() != this.getClass()) return false; 5094 5095 loadingFinished o = (loadingFinished) other; 5096 5097 return 5098 Objects.equals(this.requestId, o.requestId) 5099 && Objects.equals(this.timestamp, o.timestamp) 5100 && Objects.equals(this.encodedDataLength, o.encodedDataLength) 5101 && Objects.equals(this.shouldReportCorbBlocking, o.shouldReportCorbBlocking); 5102 } 5103 5104 /** Generates a Hash-Code for {@code 'this'} instance */ 5105 public int hashCode() 5106 { 5107 return 5108 Objects.hashCode(this.requestId) 5109 + Objects.hashCode(this.timestamp) 5110 + Objects.hashCode(this.encodedDataLength) 5111 + Objects.hashCode(this.shouldReportCorbBlocking); 5112 } 5113 } 5114 5115 /** 5116 * Details of an intercepted HTTP request, which must be either allowed, blocked, modified or 5117 * mocked. 5118 * Deprecated, use Fetch.requestPaused instead. 5119 * <BR /> 5120 * <BR /><B>EXPERIMENTAL</B> 5121 * <BR /><B>DEPRECATED</B> 5122 */ 5123 public static class requestIntercepted 5124 extends BrowserEvent 5125 implements java.io.Serializable 5126 { 5127 /** For Object Serialization. java.io.Serializable */ 5128 protected static final long serialVersionUID = 1; 5129 5130 public boolean[] optionals() 5131 { return new boolean[] { false, false, false, false, false, true, true, true, true, true, true, true, }; } 5132 5133 /** 5134 * Each request the page makes will have a unique id, however if any redirects are encountered 5135 * while processing that fetch, they will be reported with the same id as the original fetch. 5136 * Likewise if HTTP authentication is needed then the same fetch id will be used. 5137 */ 5138 public final String interceptionId; 5139 5140 /** <CODE>[No Description Provided by Google]</CODE> */ 5141 public final Network.Request request; 5142 5143 /** The id of the frame that initiated the request. */ 5144 public final String frameId; 5145 5146 /** How the requested resource will be used. */ 5147 public final String resourceType; 5148 5149 /** Whether this is a navigation request, which can abort the navigation completely. */ 5150 public final boolean isNavigationRequest; 5151 5152 /** 5153 * Set if the request is a navigation that will result in a download. 5154 * Only present after response is received from the server (i.e. HeadersReceived stage). 5155 * <BR /> 5156 * <BR /><B>OPTIONAL</B> 5157 */ 5158 public final Boolean isDownload; 5159 5160 /** 5161 * Redirect location, only sent if a redirect was intercepted. 5162 * <BR /> 5163 * <BR /><B>OPTIONAL</B> 5164 */ 5165 public final String redirectUrl; 5166 5167 /** 5168 * Details of the Authorization Challenge encountered. If this is set then 5169 * continueInterceptedRequest must contain an authChallengeResponse. 5170 * <BR /> 5171 * <BR /><B>OPTIONAL</B> 5172 */ 5173 public final Network.AuthChallenge authChallenge; 5174 5175 /** 5176 * Response error if intercepted at response stage or if redirect occurred while intercepting 5177 * request. 5178 * <BR /> 5179 * <BR /><B>OPTIONAL</B> 5180 */ 5181 public final String responseErrorReason; 5182 5183 /** 5184 * Response code if intercepted at response stage or if redirect occurred while intercepting 5185 * request or auth retry occurred. 5186 * <BR /> 5187 * <BR /><B>OPTIONAL</B> 5188 */ 5189 public final Integer responseStatusCode; 5190 5191 /** 5192 * Response headers if intercepted at the response stage or if redirect occurred while 5193 * intercepting request or auth retry occurred. 5194 * <BR /> 5195 * <BR /><B>OPTIONAL</B> 5196 */ 5197 public final JsonObject responseHeaders; 5198 5199 /** 5200 * If the intercepted request had a corresponding requestWillBeSent event fired for it, then 5201 * this requestId will be the same as the requestId present in the requestWillBeSent event. 5202 * <BR /> 5203 * <BR /><B>OPTIONAL</B> 5204 */ 5205 public final String requestId; 5206 5207 /** 5208 * Constructor 5209 * 5210 * @param interceptionId 5211 * Each request the page makes will have a unique id, however if any redirects are encountered 5212 * while processing that fetch, they will be reported with the same id as the original fetch. 5213 * Likewise if HTTP authentication is needed then the same fetch id will be used. 5214 * 5215 * @param request - 5216 * 5217 * @param frameId The id of the frame that initiated the request. 5218 * 5219 * @param resourceType How the requested resource will be used. 5220 * 5221 * @param isNavigationRequest Whether this is a navigation request, which can abort the navigation completely. 5222 * 5223 * @param isDownload 5224 * Set if the request is a navigation that will result in a download. 5225 * Only present after response is received from the server (i.e. HeadersReceived stage). 5226 * <BR /><B>OPTIONAL</B> 5227 * 5228 * @param redirectUrl Redirect location, only sent if a redirect was intercepted. 5229 * <BR /><B>OPTIONAL</B> 5230 * 5231 * @param authChallenge 5232 * Details of the Authorization Challenge encountered. If this is set then 5233 * continueInterceptedRequest must contain an authChallengeResponse. 5234 * <BR /><B>OPTIONAL</B> 5235 * 5236 * @param responseErrorReason 5237 * Response error if intercepted at response stage or if redirect occurred while intercepting 5238 * request. 5239 * <BR /><B>OPTIONAL</B> 5240 * 5241 * @param responseStatusCode 5242 * Response code if intercepted at response stage or if redirect occurred while intercepting 5243 * request or auth retry occurred. 5244 * <BR /><B>OPTIONAL</B> 5245 * 5246 * @param responseHeaders 5247 * Response headers if intercepted at the response stage or if redirect occurred while 5248 * intercepting request or auth retry occurred. 5249 * <BR /><B>OPTIONAL</B> 5250 * 5251 * @param requestId 5252 * If the intercepted request had a corresponding requestWillBeSent event fired for it, then 5253 * this requestId will be the same as the requestId present in the requestWillBeSent event. 5254 * <BR /><B>OPTIONAL</B> 5255 */ 5256 public requestIntercepted( 5257 String interceptionId, Network.Request request, String frameId, String resourceType, 5258 boolean isNavigationRequest, Boolean isDownload, String redirectUrl, 5259 Network.AuthChallenge authChallenge, String responseErrorReason, 5260 Integer responseStatusCode, JsonObject responseHeaders, String requestId 5261 ) 5262 { 5263 super("Network", "requestIntercepted", 12); 5264 5265 // Exception-Check(s) to ensure that if any parameters which are not declared as 5266 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 5267 5268 if (interceptionId == null) THROWS.throwNPE("interceptionId"); 5269 if (request == null) THROWS.throwNPE("request"); 5270 if (frameId == null) THROWS.throwNPE("frameId"); 5271 if (resourceType == null) THROWS.throwNPE("resourceType"); 5272 5273 // Exception-Check(s) to ensure that if any parameters which must adhere to a 5274 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 5275 5276 THROWS.checkIAE("resourceType", resourceType, "Network.ResourceType", Network.ResourceType); 5277 THROWS.checkIAE("responseErrorReason", responseErrorReason, "Network.ErrorReason", Network.ErrorReason); 5278 5279 this.interceptionId = interceptionId; 5280 this.request = request; 5281 this.frameId = frameId; 5282 this.resourceType = resourceType; 5283 this.isNavigationRequest = isNavigationRequest; 5284 this.isDownload = isDownload; 5285 this.redirectUrl = redirectUrl; 5286 this.authChallenge = authChallenge; 5287 this.responseErrorReason = responseErrorReason; 5288 this.responseStatusCode = responseStatusCode; 5289 this.responseHeaders = responseHeaders; 5290 this.requestId = requestId; 5291 } 5292 5293 /** 5294 * JSON Object Constructor 5295 * @param jo A Json-Object having data about an instance of {@code 'requestIntercepted'}. 5296 */ 5297 public requestIntercepted (JsonObject jo) 5298 { 5299 super("Network", "requestIntercepted", 12); 5300 5301 this.interceptionId = ReadJSON.getString(jo, "interceptionId", false, true); 5302 this.request = ReadJSON.getObject(jo, "request", Network.Request.class, false, true); 5303 this.frameId = ReadJSON.getString(jo, "frameId", false, true); 5304 this.resourceType = ReadJSON.getString(jo, "resourceType", false, true); 5305 this.isNavigationRequest = ReadPrimJSON.getBoolean(jo, "isNavigationRequest"); 5306 this.isDownload = ReadBoxedJSON.getBoolean(jo, "isDownload", true); 5307 this.redirectUrl = ReadJSON.getString(jo, "redirectUrl", true, false); 5308 this.authChallenge = ReadJSON.getObject(jo, "authChallenge", Network.AuthChallenge.class, true, false); 5309 this.responseErrorReason = ReadJSON.getString(jo, "responseErrorReason", true, false); 5310 this.responseStatusCode = ReadBoxedJSON.getInteger(jo, "responseStatusCode", true); 5311 this.responseHeaders = jo.getJsonObject("responseHeaders"); 5312 this.requestId = ReadJSON.getString(jo, "requestId", true, false); 5313 } 5314 5315 5316 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 5317 public boolean equals(Object other) 5318 { 5319 if (this == other) return true; 5320 if (other == null) return false; 5321 if (other.getClass() != this.getClass()) return false; 5322 5323 requestIntercepted o = (requestIntercepted) other; 5324 5325 return 5326 Objects.equals(this.interceptionId, o.interceptionId) 5327 && Objects.equals(this.request, o.request) 5328 && Objects.equals(this.frameId, o.frameId) 5329 && Objects.equals(this.resourceType, o.resourceType) 5330 && (this.isNavigationRequest == o.isNavigationRequest) 5331 && Objects.equals(this.isDownload, o.isDownload) 5332 && Objects.equals(this.redirectUrl, o.redirectUrl) 5333 && Objects.equals(this.authChallenge, o.authChallenge) 5334 && Objects.equals(this.responseErrorReason, o.responseErrorReason) 5335 && Objects.equals(this.responseStatusCode, o.responseStatusCode) 5336 && Objects.equals(this.responseHeaders, o.responseHeaders) 5337 && Objects.equals(this.requestId, o.requestId); 5338 } 5339 5340 /** Generates a Hash-Code for {@code 'this'} instance */ 5341 public int hashCode() 5342 { 5343 return 5344 Objects.hashCode(this.interceptionId) 5345 + this.request.hashCode() 5346 + Objects.hashCode(this.frameId) 5347 + Objects.hashCode(this.resourceType) 5348 + (this.isNavigationRequest ? 1 : 0) 5349 + Objects.hashCode(this.isDownload) 5350 + Objects.hashCode(this.redirectUrl) 5351 + this.authChallenge.hashCode() 5352 + Objects.hashCode(this.responseErrorReason) 5353 + Objects.hashCode(this.responseStatusCode) 5354 + this.responseHeaders.hashCode() 5355 + Objects.hashCode(this.requestId); 5356 } 5357 } 5358 5359 /** Fired if request ended up loading from cache. */ 5360 public static class requestServedFromCache 5361 extends BrowserEvent 5362 implements java.io.Serializable 5363 { 5364 /** For Object Serialization. java.io.Serializable */ 5365 protected static final long serialVersionUID = 1; 5366 5367 public boolean[] optionals() 5368 { return new boolean[] { false, }; } 5369 5370 /** Request identifier. */ 5371 public final String requestId; 5372 5373 /** 5374 * Constructor 5375 * 5376 * @param requestId Request identifier. 5377 */ 5378 public requestServedFromCache(String requestId) 5379 { 5380 super("Network", "requestServedFromCache", 1); 5381 5382 // Exception-Check(s) to ensure that if any parameters which are not declared as 5383 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 5384 5385 if (requestId == null) THROWS.throwNPE("requestId"); 5386 5387 this.requestId = requestId; 5388 } 5389 5390 /** 5391 * JSON Object Constructor 5392 * @param jo A Json-Object having data about an instance of {@code 'requestServedFromCache'}. 5393 */ 5394 public requestServedFromCache (JsonObject jo) 5395 { 5396 super("Network", "requestServedFromCache", 1); 5397 5398 this.requestId = ReadJSON.getString(jo, "requestId", false, true); 5399 } 5400 5401 5402 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 5403 public boolean equals(Object other) 5404 { 5405 if (this == other) return true; 5406 if (other == null) return false; 5407 if (other.getClass() != this.getClass()) return false; 5408 5409 requestServedFromCache o = (requestServedFromCache) other; 5410 5411 return 5412 Objects.equals(this.requestId, o.requestId); 5413 } 5414 5415 /** Generates a Hash-Code for {@code 'this'} instance */ 5416 public int hashCode() 5417 { 5418 return 5419 Objects.hashCode(this.requestId); 5420 } 5421 } 5422 5423 /** Fired when page is about to send HTTP request. */ 5424 public static class requestWillBeSent 5425 extends BrowserEvent 5426 implements java.io.Serializable 5427 { 5428 /** For Object Serialization. java.io.Serializable */ 5429 protected static final long serialVersionUID = 1; 5430 5431 public boolean[] optionals() 5432 { return new boolean[] { false, false, false, false, false, false, false, false, true, true, true, true, }; } 5433 5434 /** Request identifier. */ 5435 public final String requestId; 5436 5437 /** Loader identifier. Empty string if the request is fetched from worker. */ 5438 public final String loaderId; 5439 5440 /** URL of the document this request is loaded for. */ 5441 public final String documentURL; 5442 5443 /** Request data. */ 5444 public final Network.Request request; 5445 5446 /** Timestamp. */ 5447 public final Number timestamp; 5448 5449 /** Timestamp. */ 5450 public final Number wallTime; 5451 5452 /** Request initiator. */ 5453 public final Network.Initiator initiator; 5454 5455 /** 5456 * In the case that redirectResponse is populated, this flag indicates whether 5457 * requestWillBeSentExtraInfo and responseReceivedExtraInfo events will be or were emitted 5458 * for the request which was just redirected. 5459 * <BR /> 5460 * <BR /><B>EXPERIMENTAL</B> 5461 */ 5462 public final boolean redirectHasExtraInfo; 5463 5464 /** 5465 * Redirect response data. 5466 * <BR /> 5467 * <BR /><B>OPTIONAL</B> 5468 */ 5469 public final Network.Response redirectResponse; 5470 5471 /** 5472 * Type of this resource. 5473 * <BR /> 5474 * <BR /><B>OPTIONAL</B> 5475 */ 5476 public final String type; 5477 5478 /** 5479 * Frame identifier. 5480 * <BR /> 5481 * <BR /><B>OPTIONAL</B> 5482 */ 5483 public final String frameId; 5484 5485 /** 5486 * Whether the request is initiated by a user gesture. Defaults to false. 5487 * <BR /> 5488 * <BR /><B>OPTIONAL</B> 5489 */ 5490 public final Boolean hasUserGesture; 5491 5492 /** 5493 * Constructor 5494 * 5495 * @param requestId Request identifier. 5496 * 5497 * @param loaderId Loader identifier. Empty string if the request is fetched from worker. 5498 * 5499 * @param documentURL URL of the document this request is loaded for. 5500 * 5501 * @param request Request data. 5502 * 5503 * @param timestamp Timestamp. 5504 * 5505 * @param wallTime Timestamp. 5506 * 5507 * @param initiator Request initiator. 5508 * 5509 * @param redirectHasExtraInfo 5510 * In the case that redirectResponse is populated, this flag indicates whether 5511 * requestWillBeSentExtraInfo and responseReceivedExtraInfo events will be or were emitted 5512 * for the request which was just redirected. 5513 * <BR /><B>EXPERIMENTAL</B> 5514 * 5515 * @param redirectResponse Redirect response data. 5516 * <BR /><B>OPTIONAL</B> 5517 * 5518 * @param type Type of this resource. 5519 * <BR /><B>OPTIONAL</B> 5520 * 5521 * @param frameId Frame identifier. 5522 * <BR /><B>OPTIONAL</B> 5523 * 5524 * @param hasUserGesture Whether the request is initiated by a user gesture. Defaults to false. 5525 * <BR /><B>OPTIONAL</B> 5526 */ 5527 public requestWillBeSent( 5528 String requestId, String loaderId, String documentURL, Network.Request request, 5529 Number timestamp, Number wallTime, Network.Initiator initiator, 5530 boolean redirectHasExtraInfo, Network.Response redirectResponse, String type, 5531 String frameId, Boolean hasUserGesture 5532 ) 5533 { 5534 super("Network", "requestWillBeSent", 12); 5535 5536 // Exception-Check(s) to ensure that if any parameters which are not declared as 5537 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 5538 5539 if (requestId == null) THROWS.throwNPE("requestId"); 5540 if (loaderId == null) THROWS.throwNPE("loaderId"); 5541 if (documentURL == null) THROWS.throwNPE("documentURL"); 5542 if (request == null) THROWS.throwNPE("request"); 5543 if (timestamp == null) THROWS.throwNPE("timestamp"); 5544 if (wallTime == null) THROWS.throwNPE("wallTime"); 5545 if (initiator == null) THROWS.throwNPE("initiator"); 5546 5547 // Exception-Check(s) to ensure that if any parameters which must adhere to a 5548 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 5549 5550 THROWS.checkIAE("type", type, "Network.ResourceType", Network.ResourceType); 5551 5552 this.requestId = requestId; 5553 this.loaderId = loaderId; 5554 this.documentURL = documentURL; 5555 this.request = request; 5556 this.timestamp = timestamp; 5557 this.wallTime = wallTime; 5558 this.initiator = initiator; 5559 this.redirectHasExtraInfo = redirectHasExtraInfo; 5560 this.redirectResponse = redirectResponse; 5561 this.type = type; 5562 this.frameId = frameId; 5563 this.hasUserGesture = hasUserGesture; 5564 } 5565 5566 /** 5567 * JSON Object Constructor 5568 * @param jo A Json-Object having data about an instance of {@code 'requestWillBeSent'}. 5569 */ 5570 public requestWillBeSent (JsonObject jo) 5571 { 5572 super("Network", "requestWillBeSent", 12); 5573 5574 this.requestId = ReadJSON.getString(jo, "requestId", false, true); 5575 this.loaderId = ReadJSON.getString(jo, "loaderId", false, true); 5576 this.documentURL = ReadJSON.getString(jo, "documentURL", false, true); 5577 this.request = ReadJSON.getObject(jo, "request", Network.Request.class, false, true); 5578 this.timestamp = ReadNumberJSON.get(jo, "timestamp", false, true); 5579 this.wallTime = ReadNumberJSON.get(jo, "wallTime", false, true); 5580 this.initiator = ReadJSON.getObject(jo, "initiator", Network.Initiator.class, false, true); 5581 this.redirectHasExtraInfo = ReadPrimJSON.getBoolean(jo, "redirectHasExtraInfo"); 5582 this.redirectResponse = ReadJSON.getObject(jo, "redirectResponse", Network.Response.class, true, false); 5583 this.type = ReadJSON.getString(jo, "type", true, false); 5584 this.frameId = ReadJSON.getString(jo, "frameId", true, false); 5585 this.hasUserGesture = ReadBoxedJSON.getBoolean(jo, "hasUserGesture", true); 5586 } 5587 5588 5589 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 5590 public boolean equals(Object other) 5591 { 5592 if (this == other) return true; 5593 if (other == null) return false; 5594 if (other.getClass() != this.getClass()) return false; 5595 5596 requestWillBeSent o = (requestWillBeSent) other; 5597 5598 return 5599 Objects.equals(this.requestId, o.requestId) 5600 && Objects.equals(this.loaderId, o.loaderId) 5601 && Objects.equals(this.documentURL, o.documentURL) 5602 && Objects.equals(this.request, o.request) 5603 && Objects.equals(this.timestamp, o.timestamp) 5604 && Objects.equals(this.wallTime, o.wallTime) 5605 && Objects.equals(this.initiator, o.initiator) 5606 && (this.redirectHasExtraInfo == o.redirectHasExtraInfo) 5607 && Objects.equals(this.redirectResponse, o.redirectResponse) 5608 && Objects.equals(this.type, o.type) 5609 && Objects.equals(this.frameId, o.frameId) 5610 && Objects.equals(this.hasUserGesture, o.hasUserGesture); 5611 } 5612 5613 /** Generates a Hash-Code for {@code 'this'} instance */ 5614 public int hashCode() 5615 { 5616 return 5617 Objects.hashCode(this.requestId) 5618 + Objects.hashCode(this.loaderId) 5619 + Objects.hashCode(this.documentURL) 5620 + this.request.hashCode() 5621 + Objects.hashCode(this.timestamp) 5622 + Objects.hashCode(this.wallTime) 5623 + this.initiator.hashCode() 5624 + (this.redirectHasExtraInfo ? 1 : 0) 5625 + this.redirectResponse.hashCode() 5626 + Objects.hashCode(this.type) 5627 + Objects.hashCode(this.frameId) 5628 + Objects.hashCode(this.hasUserGesture); 5629 } 5630 } 5631 5632 /** 5633 * Fired when resource loading priority is changed 5634 * <BR /> 5635 * <BR /><B>EXPERIMENTAL</B> 5636 */ 5637 public static class resourceChangedPriority 5638 extends BrowserEvent 5639 implements java.io.Serializable 5640 { 5641 /** For Object Serialization. java.io.Serializable */ 5642 protected static final long serialVersionUID = 1; 5643 5644 public boolean[] optionals() 5645 { return new boolean[] { false, false, false, }; } 5646 5647 /** Request identifier. */ 5648 public final String requestId; 5649 5650 /** New priority */ 5651 public final String newPriority; 5652 5653 /** Timestamp. */ 5654 public final Number timestamp; 5655 5656 /** 5657 * Constructor 5658 * 5659 * @param requestId Request identifier. 5660 * 5661 * @param newPriority New priority 5662 * 5663 * @param timestamp Timestamp. 5664 */ 5665 public resourceChangedPriority(String requestId, String newPriority, Number timestamp) 5666 { 5667 super("Network", "resourceChangedPriority", 3); 5668 5669 // Exception-Check(s) to ensure that if any parameters which are not declared as 5670 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 5671 5672 if (requestId == null) THROWS.throwNPE("requestId"); 5673 if (newPriority == null) THROWS.throwNPE("newPriority"); 5674 if (timestamp == null) THROWS.throwNPE("timestamp"); 5675 5676 // Exception-Check(s) to ensure that if any parameters which must adhere to a 5677 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 5678 5679 THROWS.checkIAE("newPriority", newPriority, "Network.ResourcePriority", Network.ResourcePriority); 5680 5681 this.requestId = requestId; 5682 this.newPriority = newPriority; 5683 this.timestamp = timestamp; 5684 } 5685 5686 /** 5687 * JSON Object Constructor 5688 * @param jo A Json-Object having data about an instance of {@code 'resourceChangedPriority'}. 5689 */ 5690 public resourceChangedPriority (JsonObject jo) 5691 { 5692 super("Network", "resourceChangedPriority", 3); 5693 5694 this.requestId = ReadJSON.getString(jo, "requestId", false, true); 5695 this.newPriority = ReadJSON.getString(jo, "newPriority", false, true); 5696 this.timestamp = ReadNumberJSON.get(jo, "timestamp", false, true); 5697 } 5698 5699 5700 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 5701 public boolean equals(Object other) 5702 { 5703 if (this == other) return true; 5704 if (other == null) return false; 5705 if (other.getClass() != this.getClass()) return false; 5706 5707 resourceChangedPriority o = (resourceChangedPriority) other; 5708 5709 return 5710 Objects.equals(this.requestId, o.requestId) 5711 && Objects.equals(this.newPriority, o.newPriority) 5712 && Objects.equals(this.timestamp, o.timestamp); 5713 } 5714 5715 /** Generates a Hash-Code for {@code 'this'} instance */ 5716 public int hashCode() 5717 { 5718 return 5719 Objects.hashCode(this.requestId) 5720 + Objects.hashCode(this.newPriority) 5721 + Objects.hashCode(this.timestamp); 5722 } 5723 } 5724 5725 /** 5726 * Fired when a signed exchange was received over the network 5727 * <BR /> 5728 * <BR /><B>EXPERIMENTAL</B> 5729 */ 5730 public static class signedExchangeReceived 5731 extends BrowserEvent 5732 implements java.io.Serializable 5733 { 5734 /** For Object Serialization. java.io.Serializable */ 5735 protected static final long serialVersionUID = 1; 5736 5737 public boolean[] optionals() 5738 { return new boolean[] { false, false, }; } 5739 5740 /** Request identifier. */ 5741 public final String requestId; 5742 5743 /** Information about the signed exchange response. */ 5744 public final Network.SignedExchangeInfo info; 5745 5746 /** 5747 * Constructor 5748 * 5749 * @param requestId Request identifier. 5750 * 5751 * @param info Information about the signed exchange response. 5752 */ 5753 public signedExchangeReceived(String requestId, Network.SignedExchangeInfo info) 5754 { 5755 super("Network", "signedExchangeReceived", 2); 5756 5757 // Exception-Check(s) to ensure that if any parameters which are not declared as 5758 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 5759 5760 if (requestId == null) THROWS.throwNPE("requestId"); 5761 if (info == null) THROWS.throwNPE("info"); 5762 5763 this.requestId = requestId; 5764 this.info = info; 5765 } 5766 5767 /** 5768 * JSON Object Constructor 5769 * @param jo A Json-Object having data about an instance of {@code 'signedExchangeReceived'}. 5770 */ 5771 public signedExchangeReceived (JsonObject jo) 5772 { 5773 super("Network", "signedExchangeReceived", 2); 5774 5775 this.requestId = ReadJSON.getString(jo, "requestId", false, true); 5776 this.info = ReadJSON.getObject(jo, "info", Network.SignedExchangeInfo.class, false, true); 5777 } 5778 5779 5780 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 5781 public boolean equals(Object other) 5782 { 5783 if (this == other) return true; 5784 if (other == null) return false; 5785 if (other.getClass() != this.getClass()) return false; 5786 5787 signedExchangeReceived o = (signedExchangeReceived) other; 5788 5789 return 5790 Objects.equals(this.requestId, o.requestId) 5791 && Objects.equals(this.info, o.info); 5792 } 5793 5794 /** Generates a Hash-Code for {@code 'this'} instance */ 5795 public int hashCode() 5796 { 5797 return 5798 Objects.hashCode(this.requestId) 5799 + this.info.hashCode(); 5800 } 5801 } 5802 5803 /** Fired when HTTP response is available. */ 5804 public static class responseReceived 5805 extends BrowserEvent 5806 implements java.io.Serializable 5807 { 5808 /** For Object Serialization. java.io.Serializable */ 5809 protected static final long serialVersionUID = 1; 5810 5811 public boolean[] optionals() 5812 { return new boolean[] { false, false, false, false, false, false, true, }; } 5813 5814 /** Request identifier. */ 5815 public final String requestId; 5816 5817 /** Loader identifier. Empty string if the request is fetched from worker. */ 5818 public final String loaderId; 5819 5820 /** Timestamp. */ 5821 public final Number timestamp; 5822 5823 /** Resource type. */ 5824 public final String type; 5825 5826 /** Response data. */ 5827 public final Network.Response response; 5828 5829 /** 5830 * Indicates whether requestWillBeSentExtraInfo and responseReceivedExtraInfo events will be 5831 * or were emitted for this request. 5832 * <BR /> 5833 * <BR /><B>EXPERIMENTAL</B> 5834 */ 5835 public final boolean hasExtraInfo; 5836 5837 /** 5838 * Frame identifier. 5839 * <BR /> 5840 * <BR /><B>OPTIONAL</B> 5841 */ 5842 public final String frameId; 5843 5844 /** 5845 * Constructor 5846 * 5847 * @param requestId Request identifier. 5848 * 5849 * @param loaderId Loader identifier. Empty string if the request is fetched from worker. 5850 * 5851 * @param timestamp Timestamp. 5852 * 5853 * @param type Resource type. 5854 * 5855 * @param response Response data. 5856 * 5857 * @param hasExtraInfo 5858 * Indicates whether requestWillBeSentExtraInfo and responseReceivedExtraInfo events will be 5859 * or were emitted for this request. 5860 * <BR /><B>EXPERIMENTAL</B> 5861 * 5862 * @param frameId Frame identifier. 5863 * <BR /><B>OPTIONAL</B> 5864 */ 5865 public responseReceived( 5866 String requestId, String loaderId, Number timestamp, String type, 5867 Network.Response response, boolean hasExtraInfo, String frameId 5868 ) 5869 { 5870 super("Network", "responseReceived", 7); 5871 5872 // Exception-Check(s) to ensure that if any parameters which are not declared as 5873 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 5874 5875 if (requestId == null) THROWS.throwNPE("requestId"); 5876 if (loaderId == null) THROWS.throwNPE("loaderId"); 5877 if (timestamp == null) THROWS.throwNPE("timestamp"); 5878 if (type == null) THROWS.throwNPE("type"); 5879 if (response == null) THROWS.throwNPE("response"); 5880 5881 // Exception-Check(s) to ensure that if any parameters which must adhere to a 5882 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 5883 5884 THROWS.checkIAE("type", type, "Network.ResourceType", Network.ResourceType); 5885 5886 this.requestId = requestId; 5887 this.loaderId = loaderId; 5888 this.timestamp = timestamp; 5889 this.type = type; 5890 this.response = response; 5891 this.hasExtraInfo = hasExtraInfo; 5892 this.frameId = frameId; 5893 } 5894 5895 /** 5896 * JSON Object Constructor 5897 * @param jo A Json-Object having data about an instance of {@code 'responseReceived'}. 5898 */ 5899 public responseReceived (JsonObject jo) 5900 { 5901 super("Network", "responseReceived", 7); 5902 5903 this.requestId = ReadJSON.getString(jo, "requestId", false, true); 5904 this.loaderId = ReadJSON.getString(jo, "loaderId", false, true); 5905 this.timestamp = ReadNumberJSON.get(jo, "timestamp", false, true); 5906 this.type = ReadJSON.getString(jo, "type", false, true); 5907 this.response = ReadJSON.getObject(jo, "response", Network.Response.class, false, true); 5908 this.hasExtraInfo = ReadPrimJSON.getBoolean(jo, "hasExtraInfo"); 5909 this.frameId = ReadJSON.getString(jo, "frameId", true, false); 5910 } 5911 5912 5913 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 5914 public boolean equals(Object other) 5915 { 5916 if (this == other) return true; 5917 if (other == null) return false; 5918 if (other.getClass() != this.getClass()) return false; 5919 5920 responseReceived o = (responseReceived) other; 5921 5922 return 5923 Objects.equals(this.requestId, o.requestId) 5924 && Objects.equals(this.loaderId, o.loaderId) 5925 && Objects.equals(this.timestamp, o.timestamp) 5926 && Objects.equals(this.type, o.type) 5927 && Objects.equals(this.response, o.response) 5928 && (this.hasExtraInfo == o.hasExtraInfo) 5929 && Objects.equals(this.frameId, o.frameId); 5930 } 5931 5932 /** Generates a Hash-Code for {@code 'this'} instance */ 5933 public int hashCode() 5934 { 5935 return 5936 Objects.hashCode(this.requestId) 5937 + Objects.hashCode(this.loaderId) 5938 + Objects.hashCode(this.timestamp) 5939 + Objects.hashCode(this.type) 5940 + this.response.hashCode() 5941 + (this.hasExtraInfo ? 1 : 0) 5942 + Objects.hashCode(this.frameId); 5943 } 5944 } 5945 5946 /** Fired when WebSocket is closed. */ 5947 public static class webSocketClosed 5948 extends BrowserEvent 5949 implements java.io.Serializable 5950 { 5951 /** For Object Serialization. java.io.Serializable */ 5952 protected static final long serialVersionUID = 1; 5953 5954 public boolean[] optionals() 5955 { return new boolean[] { false, false, }; } 5956 5957 /** Request identifier. */ 5958 public final String requestId; 5959 5960 /** Timestamp. */ 5961 public final Number timestamp; 5962 5963 /** 5964 * Constructor 5965 * 5966 * @param requestId Request identifier. 5967 * 5968 * @param timestamp Timestamp. 5969 */ 5970 public webSocketClosed(String requestId, Number timestamp) 5971 { 5972 super("Network", "webSocketClosed", 2); 5973 5974 // Exception-Check(s) to ensure that if any parameters which are not declared as 5975 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 5976 5977 if (requestId == null) THROWS.throwNPE("requestId"); 5978 if (timestamp == null) THROWS.throwNPE("timestamp"); 5979 5980 this.requestId = requestId; 5981 this.timestamp = timestamp; 5982 } 5983 5984 /** 5985 * JSON Object Constructor 5986 * @param jo A Json-Object having data about an instance of {@code 'webSocketClosed'}. 5987 */ 5988 public webSocketClosed (JsonObject jo) 5989 { 5990 super("Network", "webSocketClosed", 2); 5991 5992 this.requestId = ReadJSON.getString(jo, "requestId", false, true); 5993 this.timestamp = ReadNumberJSON.get(jo, "timestamp", false, true); 5994 } 5995 5996 5997 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 5998 public boolean equals(Object other) 5999 { 6000 if (this == other) return true; 6001 if (other == null) return false; 6002 if (other.getClass() != this.getClass()) return false; 6003 6004 webSocketClosed o = (webSocketClosed) other; 6005 6006 return 6007 Objects.equals(this.requestId, o.requestId) 6008 && Objects.equals(this.timestamp, o.timestamp); 6009 } 6010 6011 /** Generates a Hash-Code for {@code 'this'} instance */ 6012 public int hashCode() 6013 { 6014 return 6015 Objects.hashCode(this.requestId) 6016 + Objects.hashCode(this.timestamp); 6017 } 6018 } 6019 6020 /** Fired upon WebSocket creation. */ 6021 public static class webSocketCreated 6022 extends BrowserEvent 6023 implements java.io.Serializable 6024 { 6025 /** For Object Serialization. java.io.Serializable */ 6026 protected static final long serialVersionUID = 1; 6027 6028 public boolean[] optionals() 6029 { return new boolean[] { false, false, true, }; } 6030 6031 /** Request identifier. */ 6032 public final String requestId; 6033 6034 /** WebSocket request URL. */ 6035 public final String url; 6036 6037 /** 6038 * Request initiator. 6039 * <BR /> 6040 * <BR /><B>OPTIONAL</B> 6041 */ 6042 public final Network.Initiator initiator; 6043 6044 /** 6045 * Constructor 6046 * 6047 * @param requestId Request identifier. 6048 * 6049 * @param url WebSocket request URL. 6050 * 6051 * @param initiator Request initiator. 6052 * <BR /><B>OPTIONAL</B> 6053 */ 6054 public webSocketCreated(String requestId, String url, Network.Initiator initiator) 6055 { 6056 super("Network", "webSocketCreated", 3); 6057 6058 // Exception-Check(s) to ensure that if any parameters which are not declared as 6059 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 6060 6061 if (requestId == null) THROWS.throwNPE("requestId"); 6062 if (url == null) THROWS.throwNPE("url"); 6063 6064 this.requestId = requestId; 6065 this.url = url; 6066 this.initiator = initiator; 6067 } 6068 6069 /** 6070 * JSON Object Constructor 6071 * @param jo A Json-Object having data about an instance of {@code 'webSocketCreated'}. 6072 */ 6073 public webSocketCreated (JsonObject jo) 6074 { 6075 super("Network", "webSocketCreated", 3); 6076 6077 this.requestId = ReadJSON.getString(jo, "requestId", false, true); 6078 this.url = ReadJSON.getString(jo, "url", false, true); 6079 this.initiator = ReadJSON.getObject(jo, "initiator", Network.Initiator.class, true, false); 6080 } 6081 6082 6083 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 6084 public boolean equals(Object other) 6085 { 6086 if (this == other) return true; 6087 if (other == null) return false; 6088 if (other.getClass() != this.getClass()) return false; 6089 6090 webSocketCreated o = (webSocketCreated) other; 6091 6092 return 6093 Objects.equals(this.requestId, o.requestId) 6094 && Objects.equals(this.url, o.url) 6095 && Objects.equals(this.initiator, o.initiator); 6096 } 6097 6098 /** Generates a Hash-Code for {@code 'this'} instance */ 6099 public int hashCode() 6100 { 6101 return 6102 Objects.hashCode(this.requestId) 6103 + Objects.hashCode(this.url) 6104 + this.initiator.hashCode(); 6105 } 6106 } 6107 6108 /** Fired when WebSocket message error occurs. */ 6109 public static class webSocketFrameError 6110 extends BrowserEvent 6111 implements java.io.Serializable 6112 { 6113 /** For Object Serialization. java.io.Serializable */ 6114 protected static final long serialVersionUID = 1; 6115 6116 public boolean[] optionals() 6117 { return new boolean[] { false, false, false, }; } 6118 6119 /** Request identifier. */ 6120 public final String requestId; 6121 6122 /** Timestamp. */ 6123 public final Number timestamp; 6124 6125 /** WebSocket error message. */ 6126 public final String errorMessage; 6127 6128 /** 6129 * Constructor 6130 * 6131 * @param requestId Request identifier. 6132 * 6133 * @param timestamp Timestamp. 6134 * 6135 * @param errorMessage WebSocket error message. 6136 */ 6137 public webSocketFrameError(String requestId, Number timestamp, String errorMessage) 6138 { 6139 super("Network", "webSocketFrameError", 3); 6140 6141 // Exception-Check(s) to ensure that if any parameters which are not declared as 6142 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 6143 6144 if (requestId == null) THROWS.throwNPE("requestId"); 6145 if (timestamp == null) THROWS.throwNPE("timestamp"); 6146 if (errorMessage == null) THROWS.throwNPE("errorMessage"); 6147 6148 this.requestId = requestId; 6149 this.timestamp = timestamp; 6150 this.errorMessage = errorMessage; 6151 } 6152 6153 /** 6154 * JSON Object Constructor 6155 * @param jo A Json-Object having data about an instance of {@code 'webSocketFrameError'}. 6156 */ 6157 public webSocketFrameError (JsonObject jo) 6158 { 6159 super("Network", "webSocketFrameError", 3); 6160 6161 this.requestId = ReadJSON.getString(jo, "requestId", false, true); 6162 this.timestamp = ReadNumberJSON.get(jo, "timestamp", false, true); 6163 this.errorMessage = ReadJSON.getString(jo, "errorMessage", false, true); 6164 } 6165 6166 6167 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 6168 public boolean equals(Object other) 6169 { 6170 if (this == other) return true; 6171 if (other == null) return false; 6172 if (other.getClass() != this.getClass()) return false; 6173 6174 webSocketFrameError o = (webSocketFrameError) other; 6175 6176 return 6177 Objects.equals(this.requestId, o.requestId) 6178 && Objects.equals(this.timestamp, o.timestamp) 6179 && Objects.equals(this.errorMessage, o.errorMessage); 6180 } 6181 6182 /** Generates a Hash-Code for {@code 'this'} instance */ 6183 public int hashCode() 6184 { 6185 return 6186 Objects.hashCode(this.requestId) 6187 + Objects.hashCode(this.timestamp) 6188 + Objects.hashCode(this.errorMessage); 6189 } 6190 } 6191 6192 /** Fired when WebSocket message is received. */ 6193 public static class webSocketFrameReceived 6194 extends BrowserEvent 6195 implements java.io.Serializable 6196 { 6197 /** For Object Serialization. java.io.Serializable */ 6198 protected static final long serialVersionUID = 1; 6199 6200 public boolean[] optionals() 6201 { return new boolean[] { false, false, false, }; } 6202 6203 /** Request identifier. */ 6204 public final String requestId; 6205 6206 /** Timestamp. */ 6207 public final Number timestamp; 6208 6209 /** WebSocket response data. */ 6210 public final Network.WebSocketFrame response; 6211 6212 /** 6213 * Constructor 6214 * 6215 * @param requestId Request identifier. 6216 * 6217 * @param timestamp Timestamp. 6218 * 6219 * @param response WebSocket response data. 6220 */ 6221 public webSocketFrameReceived 6222 (String requestId, Number timestamp, Network.WebSocketFrame response) 6223 { 6224 super("Network", "webSocketFrameReceived", 3); 6225 6226 // Exception-Check(s) to ensure that if any parameters which are not declared as 6227 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 6228 6229 if (requestId == null) THROWS.throwNPE("requestId"); 6230 if (timestamp == null) THROWS.throwNPE("timestamp"); 6231 if (response == null) THROWS.throwNPE("response"); 6232 6233 this.requestId = requestId; 6234 this.timestamp = timestamp; 6235 this.response = response; 6236 } 6237 6238 /** 6239 * JSON Object Constructor 6240 * @param jo A Json-Object having data about an instance of {@code 'webSocketFrameReceived'}. 6241 */ 6242 public webSocketFrameReceived (JsonObject jo) 6243 { 6244 super("Network", "webSocketFrameReceived", 3); 6245 6246 this.requestId = ReadJSON.getString(jo, "requestId", false, true); 6247 this.timestamp = ReadNumberJSON.get(jo, "timestamp", false, true); 6248 this.response = ReadJSON.getObject(jo, "response", Network.WebSocketFrame.class, false, true); 6249 } 6250 6251 6252 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 6253 public boolean equals(Object other) 6254 { 6255 if (this == other) return true; 6256 if (other == null) return false; 6257 if (other.getClass() != this.getClass()) return false; 6258 6259 webSocketFrameReceived o = (webSocketFrameReceived) other; 6260 6261 return 6262 Objects.equals(this.requestId, o.requestId) 6263 && Objects.equals(this.timestamp, o.timestamp) 6264 && Objects.equals(this.response, o.response); 6265 } 6266 6267 /** Generates a Hash-Code for {@code 'this'} instance */ 6268 public int hashCode() 6269 { 6270 return 6271 Objects.hashCode(this.requestId) 6272 + Objects.hashCode(this.timestamp) 6273 + this.response.hashCode(); 6274 } 6275 } 6276 6277 /** Fired when WebSocket message is sent. */ 6278 public static class webSocketFrameSent 6279 extends BrowserEvent 6280 implements java.io.Serializable 6281 { 6282 /** For Object Serialization. java.io.Serializable */ 6283 protected static final long serialVersionUID = 1; 6284 6285 public boolean[] optionals() 6286 { return new boolean[] { false, false, false, }; } 6287 6288 /** Request identifier. */ 6289 public final String requestId; 6290 6291 /** Timestamp. */ 6292 public final Number timestamp; 6293 6294 /** WebSocket response data. */ 6295 public final Network.WebSocketFrame response; 6296 6297 /** 6298 * Constructor 6299 * 6300 * @param requestId Request identifier. 6301 * 6302 * @param timestamp Timestamp. 6303 * 6304 * @param response WebSocket response data. 6305 */ 6306 public webSocketFrameSent 6307 (String requestId, Number timestamp, Network.WebSocketFrame response) 6308 { 6309 super("Network", "webSocketFrameSent", 3); 6310 6311 // Exception-Check(s) to ensure that if any parameters which are not declared as 6312 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 6313 6314 if (requestId == null) THROWS.throwNPE("requestId"); 6315 if (timestamp == null) THROWS.throwNPE("timestamp"); 6316 if (response == null) THROWS.throwNPE("response"); 6317 6318 this.requestId = requestId; 6319 this.timestamp = timestamp; 6320 this.response = response; 6321 } 6322 6323 /** 6324 * JSON Object Constructor 6325 * @param jo A Json-Object having data about an instance of {@code 'webSocketFrameSent'}. 6326 */ 6327 public webSocketFrameSent (JsonObject jo) 6328 { 6329 super("Network", "webSocketFrameSent", 3); 6330 6331 this.requestId = ReadJSON.getString(jo, "requestId", false, true); 6332 this.timestamp = ReadNumberJSON.get(jo, "timestamp", false, true); 6333 this.response = ReadJSON.getObject(jo, "response", Network.WebSocketFrame.class, false, true); 6334 } 6335 6336 6337 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 6338 public boolean equals(Object other) 6339 { 6340 if (this == other) return true; 6341 if (other == null) return false; 6342 if (other.getClass() != this.getClass()) return false; 6343 6344 webSocketFrameSent o = (webSocketFrameSent) other; 6345 6346 return 6347 Objects.equals(this.requestId, o.requestId) 6348 && Objects.equals(this.timestamp, o.timestamp) 6349 && Objects.equals(this.response, o.response); 6350 } 6351 6352 /** Generates a Hash-Code for {@code 'this'} instance */ 6353 public int hashCode() 6354 { 6355 return 6356 Objects.hashCode(this.requestId) 6357 + Objects.hashCode(this.timestamp) 6358 + this.response.hashCode(); 6359 } 6360 } 6361 6362 /** Fired when WebSocket handshake response becomes available. */ 6363 public static class webSocketHandshakeResponseReceived 6364 extends BrowserEvent 6365 implements java.io.Serializable 6366 { 6367 /** For Object Serialization. java.io.Serializable */ 6368 protected static final long serialVersionUID = 1; 6369 6370 public boolean[] optionals() 6371 { return new boolean[] { false, false, false, }; } 6372 6373 /** Request identifier. */ 6374 public final String requestId; 6375 6376 /** Timestamp. */ 6377 public final Number timestamp; 6378 6379 /** WebSocket response data. */ 6380 public final Network.WebSocketResponse response; 6381 6382 /** 6383 * Constructor 6384 * 6385 * @param requestId Request identifier. 6386 * 6387 * @param timestamp Timestamp. 6388 * 6389 * @param response WebSocket response data. 6390 */ 6391 public webSocketHandshakeResponseReceived 6392 (String requestId, Number timestamp, Network.WebSocketResponse response) 6393 { 6394 super("Network", "webSocketHandshakeResponseReceived", 3); 6395 6396 // Exception-Check(s) to ensure that if any parameters which are not declared as 6397 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 6398 6399 if (requestId == null) THROWS.throwNPE("requestId"); 6400 if (timestamp == null) THROWS.throwNPE("timestamp"); 6401 if (response == null) THROWS.throwNPE("response"); 6402 6403 this.requestId = requestId; 6404 this.timestamp = timestamp; 6405 this.response = response; 6406 } 6407 6408 /** 6409 * JSON Object Constructor 6410 * @param jo A Json-Object having data about an instance of {@code 'webSocketHandshakeResponseReceived'}. 6411 */ 6412 public webSocketHandshakeResponseReceived (JsonObject jo) 6413 { 6414 super("Network", "webSocketHandshakeResponseReceived", 3); 6415 6416 this.requestId = ReadJSON.getString(jo, "requestId", false, true); 6417 this.timestamp = ReadNumberJSON.get(jo, "timestamp", false, true); 6418 this.response = ReadJSON.getObject(jo, "response", Network.WebSocketResponse.class, false, true); 6419 } 6420 6421 6422 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 6423 public boolean equals(Object other) 6424 { 6425 if (this == other) return true; 6426 if (other == null) return false; 6427 if (other.getClass() != this.getClass()) return false; 6428 6429 webSocketHandshakeResponseReceived o = (webSocketHandshakeResponseReceived) other; 6430 6431 return 6432 Objects.equals(this.requestId, o.requestId) 6433 && Objects.equals(this.timestamp, o.timestamp) 6434 && Objects.equals(this.response, o.response); 6435 } 6436 6437 /** Generates a Hash-Code for {@code 'this'} instance */ 6438 public int hashCode() 6439 { 6440 return 6441 Objects.hashCode(this.requestId) 6442 + Objects.hashCode(this.timestamp) 6443 + this.response.hashCode(); 6444 } 6445 } 6446 6447 /** Fired when WebSocket is about to initiate handshake. */ 6448 public static class webSocketWillSendHandshakeRequest 6449 extends BrowserEvent 6450 implements java.io.Serializable 6451 { 6452 /** For Object Serialization. java.io.Serializable */ 6453 protected static final long serialVersionUID = 1; 6454 6455 public boolean[] optionals() 6456 { return new boolean[] { false, false, false, false, }; } 6457 6458 /** Request identifier. */ 6459 public final String requestId; 6460 6461 /** Timestamp. */ 6462 public final Number timestamp; 6463 6464 /** UTC Timestamp. */ 6465 public final Number wallTime; 6466 6467 /** WebSocket request data. */ 6468 public final Network.WebSocketRequest request; 6469 6470 /** 6471 * Constructor 6472 * 6473 * @param requestId Request identifier. 6474 * 6475 * @param timestamp Timestamp. 6476 * 6477 * @param wallTime UTC Timestamp. 6478 * 6479 * @param request WebSocket request data. 6480 */ 6481 public webSocketWillSendHandshakeRequest 6482 (String requestId, Number timestamp, Number wallTime, Network.WebSocketRequest request) 6483 { 6484 super("Network", "webSocketWillSendHandshakeRequest", 4); 6485 6486 // Exception-Check(s) to ensure that if any parameters which are not declared as 6487 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 6488 6489 if (requestId == null) THROWS.throwNPE("requestId"); 6490 if (timestamp == null) THROWS.throwNPE("timestamp"); 6491 if (wallTime == null) THROWS.throwNPE("wallTime"); 6492 if (request == null) THROWS.throwNPE("request"); 6493 6494 this.requestId = requestId; 6495 this.timestamp = timestamp; 6496 this.wallTime = wallTime; 6497 this.request = request; 6498 } 6499 6500 /** 6501 * JSON Object Constructor 6502 * @param jo A Json-Object having data about an instance of {@code 'webSocketWillSendHandshakeRequest'}. 6503 */ 6504 public webSocketWillSendHandshakeRequest (JsonObject jo) 6505 { 6506 super("Network", "webSocketWillSendHandshakeRequest", 4); 6507 6508 this.requestId = ReadJSON.getString(jo, "requestId", false, true); 6509 this.timestamp = ReadNumberJSON.get(jo, "timestamp", false, true); 6510 this.wallTime = ReadNumberJSON.get(jo, "wallTime", false, true); 6511 this.request = ReadJSON.getObject(jo, "request", Network.WebSocketRequest.class, false, true); 6512 } 6513 6514 6515 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 6516 public boolean equals(Object other) 6517 { 6518 if (this == other) return true; 6519 if (other == null) return false; 6520 if (other.getClass() != this.getClass()) return false; 6521 6522 webSocketWillSendHandshakeRequest o = (webSocketWillSendHandshakeRequest) other; 6523 6524 return 6525 Objects.equals(this.requestId, o.requestId) 6526 && Objects.equals(this.timestamp, o.timestamp) 6527 && Objects.equals(this.wallTime, o.wallTime) 6528 && Objects.equals(this.request, o.request); 6529 } 6530 6531 /** Generates a Hash-Code for {@code 'this'} instance */ 6532 public int hashCode() 6533 { 6534 return 6535 Objects.hashCode(this.requestId) 6536 + Objects.hashCode(this.timestamp) 6537 + Objects.hashCode(this.wallTime) 6538 + this.request.hashCode(); 6539 } 6540 } 6541 6542 /** Fired upon WebTransport creation. */ 6543 public static class webTransportCreated 6544 extends BrowserEvent 6545 implements java.io.Serializable 6546 { 6547 /** For Object Serialization. java.io.Serializable */ 6548 protected static final long serialVersionUID = 1; 6549 6550 public boolean[] optionals() 6551 { return new boolean[] { false, false, false, true, }; } 6552 6553 /** WebTransport identifier. */ 6554 public final String transportId; 6555 6556 /** WebTransport request URL. */ 6557 public final String url; 6558 6559 /** Timestamp. */ 6560 public final Number timestamp; 6561 6562 /** 6563 * Request initiator. 6564 * <BR /> 6565 * <BR /><B>OPTIONAL</B> 6566 */ 6567 public final Network.Initiator initiator; 6568 6569 /** 6570 * Constructor 6571 * 6572 * @param transportId WebTransport identifier. 6573 * 6574 * @param url WebTransport request URL. 6575 * 6576 * @param timestamp Timestamp. 6577 * 6578 * @param initiator Request initiator. 6579 * <BR /><B>OPTIONAL</B> 6580 */ 6581 public webTransportCreated 6582 (String transportId, String url, Number timestamp, Network.Initiator initiator) 6583 { 6584 super("Network", "webTransportCreated", 4); 6585 6586 // Exception-Check(s) to ensure that if any parameters which are not declared as 6587 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 6588 6589 if (transportId == null) THROWS.throwNPE("transportId"); 6590 if (url == null) THROWS.throwNPE("url"); 6591 if (timestamp == null) THROWS.throwNPE("timestamp"); 6592 6593 this.transportId = transportId; 6594 this.url = url; 6595 this.timestamp = timestamp; 6596 this.initiator = initiator; 6597 } 6598 6599 /** 6600 * JSON Object Constructor 6601 * @param jo A Json-Object having data about an instance of {@code 'webTransportCreated'}. 6602 */ 6603 public webTransportCreated (JsonObject jo) 6604 { 6605 super("Network", "webTransportCreated", 4); 6606 6607 this.transportId = ReadJSON.getString(jo, "transportId", false, true); 6608 this.url = ReadJSON.getString(jo, "url", false, true); 6609 this.timestamp = ReadNumberJSON.get(jo, "timestamp", false, true); 6610 this.initiator = ReadJSON.getObject(jo, "initiator", Network.Initiator.class, true, false); 6611 } 6612 6613 6614 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 6615 public boolean equals(Object other) 6616 { 6617 if (this == other) return true; 6618 if (other == null) return false; 6619 if (other.getClass() != this.getClass()) return false; 6620 6621 webTransportCreated o = (webTransportCreated) other; 6622 6623 return 6624 Objects.equals(this.transportId, o.transportId) 6625 && Objects.equals(this.url, o.url) 6626 && Objects.equals(this.timestamp, o.timestamp) 6627 && Objects.equals(this.initiator, o.initiator); 6628 } 6629 6630 /** Generates a Hash-Code for {@code 'this'} instance */ 6631 public int hashCode() 6632 { 6633 return 6634 Objects.hashCode(this.transportId) 6635 + Objects.hashCode(this.url) 6636 + Objects.hashCode(this.timestamp) 6637 + this.initiator.hashCode(); 6638 } 6639 } 6640 6641 /** Fired when WebTransport handshake is finished. */ 6642 public static class webTransportConnectionEstablished 6643 extends BrowserEvent 6644 implements java.io.Serializable 6645 { 6646 /** For Object Serialization. java.io.Serializable */ 6647 protected static final long serialVersionUID = 1; 6648 6649 public boolean[] optionals() 6650 { return new boolean[] { false, false, }; } 6651 6652 /** WebTransport identifier. */ 6653 public final String transportId; 6654 6655 /** Timestamp. */ 6656 public final Number timestamp; 6657 6658 /** 6659 * Constructor 6660 * 6661 * @param transportId WebTransport identifier. 6662 * 6663 * @param timestamp Timestamp. 6664 */ 6665 public webTransportConnectionEstablished(String transportId, Number timestamp) 6666 { 6667 super("Network", "webTransportConnectionEstablished", 2); 6668 6669 // Exception-Check(s) to ensure that if any parameters which are not declared as 6670 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 6671 6672 if (transportId == null) THROWS.throwNPE("transportId"); 6673 if (timestamp == null) THROWS.throwNPE("timestamp"); 6674 6675 this.transportId = transportId; 6676 this.timestamp = timestamp; 6677 } 6678 6679 /** 6680 * JSON Object Constructor 6681 * @param jo A Json-Object having data about an instance of {@code 'webTransportConnectionEstablished'}. 6682 */ 6683 public webTransportConnectionEstablished (JsonObject jo) 6684 { 6685 super("Network", "webTransportConnectionEstablished", 2); 6686 6687 this.transportId = ReadJSON.getString(jo, "transportId", false, true); 6688 this.timestamp = ReadNumberJSON.get(jo, "timestamp", false, true); 6689 } 6690 6691 6692 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 6693 public boolean equals(Object other) 6694 { 6695 if (this == other) return true; 6696 if (other == null) return false; 6697 if (other.getClass() != this.getClass()) return false; 6698 6699 webTransportConnectionEstablished o = (webTransportConnectionEstablished) other; 6700 6701 return 6702 Objects.equals(this.transportId, o.transportId) 6703 && Objects.equals(this.timestamp, o.timestamp); 6704 } 6705 6706 /** Generates a Hash-Code for {@code 'this'} instance */ 6707 public int hashCode() 6708 { 6709 return 6710 Objects.hashCode(this.transportId) 6711 + Objects.hashCode(this.timestamp); 6712 } 6713 } 6714 6715 /** Fired when WebTransport is disposed. */ 6716 public static class webTransportClosed 6717 extends BrowserEvent 6718 implements java.io.Serializable 6719 { 6720 /** For Object Serialization. java.io.Serializable */ 6721 protected static final long serialVersionUID = 1; 6722 6723 public boolean[] optionals() 6724 { return new boolean[] { false, false, }; } 6725 6726 /** WebTransport identifier. */ 6727 public final String transportId; 6728 6729 /** Timestamp. */ 6730 public final Number timestamp; 6731 6732 /** 6733 * Constructor 6734 * 6735 * @param transportId WebTransport identifier. 6736 * 6737 * @param timestamp Timestamp. 6738 */ 6739 public webTransportClosed(String transportId, Number timestamp) 6740 { 6741 super("Network", "webTransportClosed", 2); 6742 6743 // Exception-Check(s) to ensure that if any parameters which are not declared as 6744 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 6745 6746 if (transportId == null) THROWS.throwNPE("transportId"); 6747 if (timestamp == null) THROWS.throwNPE("timestamp"); 6748 6749 this.transportId = transportId; 6750 this.timestamp = timestamp; 6751 } 6752 6753 /** 6754 * JSON Object Constructor 6755 * @param jo A Json-Object having data about an instance of {@code 'webTransportClosed'}. 6756 */ 6757 public webTransportClosed (JsonObject jo) 6758 { 6759 super("Network", "webTransportClosed", 2); 6760 6761 this.transportId = ReadJSON.getString(jo, "transportId", false, true); 6762 this.timestamp = ReadNumberJSON.get(jo, "timestamp", false, true); 6763 } 6764 6765 6766 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 6767 public boolean equals(Object other) 6768 { 6769 if (this == other) return true; 6770 if (other == null) return false; 6771 if (other.getClass() != this.getClass()) return false; 6772 6773 webTransportClosed o = (webTransportClosed) other; 6774 6775 return 6776 Objects.equals(this.transportId, o.transportId) 6777 && Objects.equals(this.timestamp, o.timestamp); 6778 } 6779 6780 /** Generates a Hash-Code for {@code 'this'} instance */ 6781 public int hashCode() 6782 { 6783 return 6784 Objects.hashCode(this.transportId) 6785 + Objects.hashCode(this.timestamp); 6786 } 6787 } 6788 6789 /** 6790 * Fired when additional information about a requestWillBeSent event is available from the 6791 * network stack. Not every requestWillBeSent event will have an additional 6792 * requestWillBeSentExtraInfo fired for it, and there is no guarantee whether requestWillBeSent 6793 * or requestWillBeSentExtraInfo will be fired first for the same request. 6794 * <BR /> 6795 * <BR /><B>EXPERIMENTAL</B> 6796 */ 6797 public static class requestWillBeSentExtraInfo 6798 extends BrowserEvent 6799 implements java.io.Serializable 6800 { 6801 /** For Object Serialization. java.io.Serializable */ 6802 protected static final long serialVersionUID = 1; 6803 6804 public boolean[] optionals() 6805 { return new boolean[] { false, false, false, false, true, }; } 6806 6807 /** Request identifier. Used to match this information to an existing requestWillBeSent event. */ 6808 public final String requestId; 6809 6810 /** 6811 * A list of cookies potentially associated to the requested URL. This includes both cookies sent with 6812 * the request and the ones not sent; the latter are distinguished by having blockedReason field set. 6813 */ 6814 public final Network.BlockedCookieWithReason[] associatedCookies; 6815 6816 /** Raw request headers as they will be sent over the wire. */ 6817 public final JsonObject headers; 6818 6819 /** 6820 * Connection timing information for the request. 6821 * <BR /> 6822 * <BR /><B>EXPERIMENTAL</B> 6823 */ 6824 public final Network.ConnectTiming connectTiming; 6825 6826 /** 6827 * The client security state set for the request. 6828 * <BR /> 6829 * <BR /><B>OPTIONAL</B> 6830 */ 6831 public final Network.ClientSecurityState clientSecurityState; 6832 6833 /** 6834 * Constructor 6835 * 6836 * @param requestId Request identifier. Used to match this information to an existing requestWillBeSent event. 6837 * 6838 * @param associatedCookies 6839 * A list of cookies potentially associated to the requested URL. This includes both cookies sent with 6840 * the request and the ones not sent; the latter are distinguished by having blockedReason field set. 6841 * 6842 * @param headers Raw request headers as they will be sent over the wire. 6843 * 6844 * @param connectTiming Connection timing information for the request. 6845 * <BR /><B>EXPERIMENTAL</B> 6846 * 6847 * @param clientSecurityState The client security state set for the request. 6848 * <BR /><B>OPTIONAL</B> 6849 */ 6850 public requestWillBeSentExtraInfo( 6851 String requestId, Network.BlockedCookieWithReason[] associatedCookies, 6852 JsonObject headers, Network.ConnectTiming connectTiming, 6853 Network.ClientSecurityState clientSecurityState 6854 ) 6855 { 6856 super("Network", "requestWillBeSentExtraInfo", 5); 6857 6858 // Exception-Check(s) to ensure that if any parameters which are not declared as 6859 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 6860 6861 if (requestId == null) THROWS.throwNPE("requestId"); 6862 if (associatedCookies == null) THROWS.throwNPE("associatedCookies"); 6863 if (headers == null) THROWS.throwNPE("headers"); 6864 if (connectTiming == null) THROWS.throwNPE("connectTiming"); 6865 6866 this.requestId = requestId; 6867 this.associatedCookies = associatedCookies; 6868 this.headers = headers; 6869 this.connectTiming = connectTiming; 6870 this.clientSecurityState = clientSecurityState; 6871 } 6872 6873 /** 6874 * JSON Object Constructor 6875 * @param jo A Json-Object having data about an instance of {@code 'requestWillBeSentExtraInfo'}. 6876 */ 6877 public requestWillBeSentExtraInfo (JsonObject jo) 6878 { 6879 super("Network", "requestWillBeSentExtraInfo", 5); 6880 6881 this.requestId = ReadJSON.getString(jo, "requestId", false, true); 6882 this.associatedCookies = (jo.getJsonArray("associatedCookies") == null) 6883 ? null 6884 : RJArrIntoStream.objArr(jo.getJsonArray("associatedCookies"), null, 0, Network.BlockedCookieWithReason.class).toArray(Network.BlockedCookieWithReason[]::new); 6885 6886 this.headers = jo.getJsonObject("headers"); 6887 this.connectTiming = ReadJSON.getObject(jo, "connectTiming", Network.ConnectTiming.class, false, true); 6888 this.clientSecurityState = ReadJSON.getObject(jo, "clientSecurityState", Network.ClientSecurityState.class, true, false); 6889 } 6890 6891 6892 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 6893 public boolean equals(Object other) 6894 { 6895 if (this == other) return true; 6896 if (other == null) return false; 6897 if (other.getClass() != this.getClass()) return false; 6898 6899 requestWillBeSentExtraInfo o = (requestWillBeSentExtraInfo) other; 6900 6901 return 6902 Objects.equals(this.requestId, o.requestId) 6903 && Arrays.deepEquals(this.associatedCookies, o.associatedCookies) 6904 && Objects.equals(this.headers, o.headers) 6905 && Objects.equals(this.connectTiming, o.connectTiming) 6906 && Objects.equals(this.clientSecurityState, o.clientSecurityState); 6907 } 6908 6909 /** Generates a Hash-Code for {@code 'this'} instance */ 6910 public int hashCode() 6911 { 6912 return 6913 Objects.hashCode(this.requestId) 6914 + Arrays.deepHashCode(this.associatedCookies) 6915 + this.headers.hashCode() 6916 + this.connectTiming.hashCode() 6917 + this.clientSecurityState.hashCode(); 6918 } 6919 } 6920 6921 /** 6922 * Fired when additional information about a responseReceived event is available from the network 6923 * stack. Not every responseReceived event will have an additional responseReceivedExtraInfo for 6924 * it, and responseReceivedExtraInfo may be fired before or after responseReceived. 6925 * <BR /> 6926 * <BR /><B>EXPERIMENTAL</B> 6927 */ 6928 public static class responseReceivedExtraInfo 6929 extends BrowserEvent 6930 implements java.io.Serializable 6931 { 6932 /** For Object Serialization. java.io.Serializable */ 6933 protected static final long serialVersionUID = 1; 6934 6935 public boolean[] optionals() 6936 { return new boolean[] { false, false, false, false, false, true, }; } 6937 6938 /** Request identifier. Used to match this information to another responseReceived event. */ 6939 public final String requestId; 6940 6941 /** 6942 * A list of cookies which were not stored from the response along with the corresponding 6943 * reasons for blocking. The cookies here may not be valid due to syntax errors, which 6944 * are represented by the invalid cookie line string instead of a proper cookie. 6945 */ 6946 public final Network.BlockedSetCookieWithReason[] blockedCookies; 6947 6948 /** Raw response headers as they were received over the wire. */ 6949 public final JsonObject headers; 6950 6951 /** 6952 * The IP address space of the resource. The address space can only be determined once the transport 6953 * established the connection, so we can't send it in <CODE>requestWillBeSentExtraInfo</CODE>. 6954 */ 6955 public final String resourceIPAddressSpace; 6956 6957 /** 6958 * The status code of the response. This is useful in cases the request failed and no responseReceived 6959 * event is triggered, which is the case for, e.g., CORS errors. This is also the correct status code 6960 * for cached requests, where the status in responseReceived is a 200 and this will be 304. 6961 */ 6962 public final int statusCode; 6963 6964 /** 6965 * Raw response header text as it was received over the wire. The raw text may not always be 6966 * available, such as in the case of HTTP/2 or QUIC. 6967 * <BR /> 6968 * <BR /><B>OPTIONAL</B> 6969 */ 6970 public final String headersText; 6971 6972 /** 6973 * Constructor 6974 * 6975 * @param requestId Request identifier. Used to match this information to another responseReceived event. 6976 * 6977 * @param blockedCookies 6978 * A list of cookies which were not stored from the response along with the corresponding 6979 * reasons for blocking. The cookies here may not be valid due to syntax errors, which 6980 * are represented by the invalid cookie line string instead of a proper cookie. 6981 * 6982 * @param headers Raw response headers as they were received over the wire. 6983 * 6984 * @param resourceIPAddressSpace 6985 * The IP address space of the resource. The address space can only be determined once the transport 6986 * established the connection, so we can't send it in <CODE>requestWillBeSentExtraInfo</CODE>. 6987 * 6988 * @param statusCode 6989 * The status code of the response. This is useful in cases the request failed and no responseReceived 6990 * event is triggered, which is the case for, e.g., CORS errors. This is also the correct status code 6991 * for cached requests, where the status in responseReceived is a 200 and this will be 304. 6992 * 6993 * @param headersText 6994 * Raw response header text as it was received over the wire. The raw text may not always be 6995 * available, such as in the case of HTTP/2 or QUIC. 6996 * <BR /><B>OPTIONAL</B> 6997 */ 6998 public responseReceivedExtraInfo( 6999 String requestId, Network.BlockedSetCookieWithReason[] blockedCookies, 7000 JsonObject headers, String resourceIPAddressSpace, int statusCode, String headersText 7001 ) 7002 { 7003 super("Network", "responseReceivedExtraInfo", 6); 7004 7005 // Exception-Check(s) to ensure that if any parameters which are not declared as 7006 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 7007 7008 if (requestId == null) THROWS.throwNPE("requestId"); 7009 if (blockedCookies == null) THROWS.throwNPE("blockedCookies"); 7010 if (headers == null) THROWS.throwNPE("headers"); 7011 if (resourceIPAddressSpace == null) THROWS.throwNPE("resourceIPAddressSpace"); 7012 7013 // Exception-Check(s) to ensure that if any parameters which must adhere to a 7014 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 7015 7016 THROWS.checkIAE("resourceIPAddressSpace", resourceIPAddressSpace, "Network.IPAddressSpace", Network.IPAddressSpace); 7017 7018 this.requestId = requestId; 7019 this.blockedCookies = blockedCookies; 7020 this.headers = headers; 7021 this.resourceIPAddressSpace = resourceIPAddressSpace; 7022 this.statusCode = statusCode; 7023 this.headersText = headersText; 7024 } 7025 7026 /** 7027 * JSON Object Constructor 7028 * @param jo A Json-Object having data about an instance of {@code 'responseReceivedExtraInfo'}. 7029 */ 7030 public responseReceivedExtraInfo (JsonObject jo) 7031 { 7032 super("Network", "responseReceivedExtraInfo", 6); 7033 7034 this.requestId = ReadJSON.getString(jo, "requestId", false, true); 7035 this.blockedCookies = (jo.getJsonArray("blockedCookies") == null) 7036 ? null 7037 : RJArrIntoStream.objArr(jo.getJsonArray("blockedCookies"), null, 0, Network.BlockedSetCookieWithReason.class).toArray(Network.BlockedSetCookieWithReason[]::new); 7038 7039 this.headers = jo.getJsonObject("headers"); 7040 this.resourceIPAddressSpace = ReadJSON.getString(jo, "resourceIPAddressSpace", false, true); 7041 this.statusCode = ReadPrimJSON.getInt(jo, "statusCode"); 7042 this.headersText = ReadJSON.getString(jo, "headersText", true, false); 7043 } 7044 7045 7046 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 7047 public boolean equals(Object other) 7048 { 7049 if (this == other) return true; 7050 if (other == null) return false; 7051 if (other.getClass() != this.getClass()) return false; 7052 7053 responseReceivedExtraInfo o = (responseReceivedExtraInfo) other; 7054 7055 return 7056 Objects.equals(this.requestId, o.requestId) 7057 && Arrays.deepEquals(this.blockedCookies, o.blockedCookies) 7058 && Objects.equals(this.headers, o.headers) 7059 && Objects.equals(this.resourceIPAddressSpace, o.resourceIPAddressSpace) 7060 && (this.statusCode == o.statusCode) 7061 && Objects.equals(this.headersText, o.headersText); 7062 } 7063 7064 /** Generates a Hash-Code for {@code 'this'} instance */ 7065 public int hashCode() 7066 { 7067 return 7068 Objects.hashCode(this.requestId) 7069 + Arrays.deepHashCode(this.blockedCookies) 7070 + this.headers.hashCode() 7071 + Objects.hashCode(this.resourceIPAddressSpace) 7072 + this.statusCode 7073 + Objects.hashCode(this.headersText); 7074 } 7075 } 7076 7077 /** 7078 * Fired exactly once for each Trust Token operation. Depending on 7079 * the type of the operation and whether the operation succeeded or 7080 * failed, the event is fired before the corresponding request was sent 7081 * or after the response was received. 7082 * <BR /> 7083 * <BR /><B>EXPERIMENTAL</B> 7084 */ 7085 public static class trustTokenOperationDone 7086 extends BrowserEvent 7087 implements java.io.Serializable 7088 { 7089 /** For Object Serialization. java.io.Serializable */ 7090 protected static final long serialVersionUID = 1; 7091 7092 public boolean[] optionals() 7093 { return new boolean[] { false, false, false, true, true, true, }; } 7094 7095 /** 7096 * Detailed success or error status of the operation. 7097 * 'AlreadyExists' also signifies a successful operation, as the result 7098 * of the operation already exists und thus, the operation was abort 7099 * preemptively (e.g. a cache hit). 7100 */ 7101 public final String status; 7102 7103 /** <CODE>[No Description Provided by Google]</CODE> */ 7104 public final String type; 7105 7106 /** <CODE>[No Description Provided by Google]</CODE> */ 7107 public final String requestId; 7108 7109 /** 7110 * Top level origin. The context in which the operation was attempted. 7111 * <BR /> 7112 * <BR /><B>OPTIONAL</B> 7113 */ 7114 public final String topLevelOrigin; 7115 7116 /** 7117 * Origin of the issuer in case of a "Issuance" or "Redemption" operation. 7118 * <BR /> 7119 * <BR /><B>OPTIONAL</B> 7120 */ 7121 public final String issuerOrigin; 7122 7123 /** 7124 * The number of obtained Trust Tokens on a successful "Issuance" operation. 7125 * <BR /> 7126 * <BR /><B>OPTIONAL</B> 7127 */ 7128 public final Integer issuedTokenCount; 7129 7130 /** 7131 * Constructor 7132 * 7133 * @param status 7134 * Detailed success or error status of the operation. 7135 * 'AlreadyExists' also signifies a successful operation, as the result 7136 * of the operation already exists und thus, the operation was abort 7137 * preemptively (e.g. a cache hit). 7138 * <BR />Acceptable Values: ["Ok", "InvalidArgument", "FailedPrecondition", "ResourceExhausted", "AlreadyExists", "Unavailable", "BadResponse", "InternalError", "UnknownError", "FulfilledLocally"] 7139 * 7140 * @param type - 7141 * 7142 * @param requestId - 7143 * 7144 * @param topLevelOrigin Top level origin. The context in which the operation was attempted. 7145 * <BR /><B>OPTIONAL</B> 7146 * 7147 * @param issuerOrigin Origin of the issuer in case of a "Issuance" or "Redemption" operation. 7148 * <BR /><B>OPTIONAL</B> 7149 * 7150 * @param issuedTokenCount The number of obtained Trust Tokens on a successful "Issuance" operation. 7151 * <BR /><B>OPTIONAL</B> 7152 */ 7153 public trustTokenOperationDone( 7154 String status, String type, String requestId, String topLevelOrigin, 7155 String issuerOrigin, Integer issuedTokenCount 7156 ) 7157 { 7158 super("Network", "trustTokenOperationDone", 6); 7159 7160 // Exception-Check(s) to ensure that if any parameters which are not declared as 7161 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 7162 7163 if (status == null) THROWS.throwNPE("status"); 7164 if (type == null) THROWS.throwNPE("type"); 7165 if (requestId == null) THROWS.throwNPE("requestId"); 7166 7167 // Exception-Check(s) to ensure that if any parameters which must adhere to a 7168 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 7169 7170 THROWS.checkIAE( 7171 "status", status, 7172 "Ok", "InvalidArgument", "FailedPrecondition", "ResourceExhausted", "AlreadyExists", "Unavailable", "BadResponse", "InternalError", "UnknownError", "FulfilledLocally" 7173 ); 7174 THROWS.checkIAE("type", type, "Network.TrustTokenOperationType", Network.TrustTokenOperationType); 7175 7176 this.status = status; 7177 this.type = type; 7178 this.requestId = requestId; 7179 this.topLevelOrigin = topLevelOrigin; 7180 this.issuerOrigin = issuerOrigin; 7181 this.issuedTokenCount = issuedTokenCount; 7182 } 7183 7184 /** 7185 * JSON Object Constructor 7186 * @param jo A Json-Object having data about an instance of {@code 'trustTokenOperationDone'}. 7187 */ 7188 public trustTokenOperationDone (JsonObject jo) 7189 { 7190 super("Network", "trustTokenOperationDone", 6); 7191 7192 this.status = ReadJSON.getString(jo, "status", false, true); 7193 this.type = ReadJSON.getString(jo, "type", false, true); 7194 this.requestId = ReadJSON.getString(jo, "requestId", false, true); 7195 this.topLevelOrigin = ReadJSON.getString(jo, "topLevelOrigin", true, false); 7196 this.issuerOrigin = ReadJSON.getString(jo, "issuerOrigin", true, false); 7197 this.issuedTokenCount = ReadBoxedJSON.getInteger(jo, "issuedTokenCount", true); 7198 } 7199 7200 7201 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 7202 public boolean equals(Object other) 7203 { 7204 if (this == other) return true; 7205 if (other == null) return false; 7206 if (other.getClass() != this.getClass()) return false; 7207 7208 trustTokenOperationDone o = (trustTokenOperationDone) other; 7209 7210 return 7211 Objects.equals(this.status, o.status) 7212 && Objects.equals(this.type, o.type) 7213 && Objects.equals(this.requestId, o.requestId) 7214 && Objects.equals(this.topLevelOrigin, o.topLevelOrigin) 7215 && Objects.equals(this.issuerOrigin, o.issuerOrigin) 7216 && Objects.equals(this.issuedTokenCount, o.issuedTokenCount); 7217 } 7218 7219 /** Generates a Hash-Code for {@code 'this'} instance */ 7220 public int hashCode() 7221 { 7222 return 7223 Objects.hashCode(this.status) 7224 + Objects.hashCode(this.type) 7225 + Objects.hashCode(this.requestId) 7226 + Objects.hashCode(this.topLevelOrigin) 7227 + Objects.hashCode(this.issuerOrigin) 7228 + Objects.hashCode(this.issuedTokenCount); 7229 } 7230 } 7231 7232 /** 7233 * Fired once when parsing the .wbn file has succeeded. 7234 * The event contains the information about the web bundle contents. 7235 * <BR /> 7236 * <BR /><B>EXPERIMENTAL</B> 7237 */ 7238 public static class subresourceWebBundleMetadataReceived 7239 extends BrowserEvent 7240 implements java.io.Serializable 7241 { 7242 /** For Object Serialization. java.io.Serializable */ 7243 protected static final long serialVersionUID = 1; 7244 7245 public boolean[] optionals() 7246 { return new boolean[] { false, false, }; } 7247 7248 /** Request identifier. Used to match this information to another event. */ 7249 public final String requestId; 7250 7251 /** A list of URLs of resources in the subresource Web Bundle. */ 7252 public final String[] urls; 7253 7254 /** 7255 * Constructor 7256 * 7257 * @param requestId Request identifier. Used to match this information to another event. 7258 * 7259 * @param urls A list of URLs of resources in the subresource Web Bundle. 7260 */ 7261 public subresourceWebBundleMetadataReceived(String requestId, String[] urls) 7262 { 7263 super("Network", "subresourceWebBundleMetadataReceived", 2); 7264 7265 // Exception-Check(s) to ensure that if any parameters which are not declared as 7266 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 7267 7268 if (requestId == null) THROWS.throwNPE("requestId"); 7269 if (urls == null) THROWS.throwNPE("urls"); 7270 7271 this.requestId = requestId; 7272 this.urls = urls; 7273 } 7274 7275 /** 7276 * JSON Object Constructor 7277 * @param jo A Json-Object having data about an instance of {@code 'subresourceWebBundleMetadataReceived'}. 7278 */ 7279 public subresourceWebBundleMetadataReceived (JsonObject jo) 7280 { 7281 super("Network", "subresourceWebBundleMetadataReceived", 2); 7282 7283 this.requestId = ReadJSON.getString(jo, "requestId", false, true); 7284 this.urls = (jo.getJsonArray("urls") == null) 7285 ? null 7286 : RJArrIntoStream.strArr(jo.getJsonArray("urls"), null, 0).toArray(String[]::new); 7287 7288 } 7289 7290 7291 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 7292 public boolean equals(Object other) 7293 { 7294 if (this == other) return true; 7295 if (other == null) return false; 7296 if (other.getClass() != this.getClass()) return false; 7297 7298 subresourceWebBundleMetadataReceived o = (subresourceWebBundleMetadataReceived) other; 7299 7300 return 7301 Objects.equals(this.requestId, o.requestId) 7302 && Arrays.deepEquals(this.urls, o.urls); 7303 } 7304 7305 /** Generates a Hash-Code for {@code 'this'} instance */ 7306 public int hashCode() 7307 { 7308 return 7309 Objects.hashCode(this.requestId) 7310 + Arrays.deepHashCode(this.urls); 7311 } 7312 } 7313 7314 /** 7315 * Fired once when parsing the .wbn file has failed. 7316 * <BR /> 7317 * <BR /><B>EXPERIMENTAL</B> 7318 */ 7319 public static class subresourceWebBundleMetadataError 7320 extends BrowserEvent 7321 implements java.io.Serializable 7322 { 7323 /** For Object Serialization. java.io.Serializable */ 7324 protected static final long serialVersionUID = 1; 7325 7326 public boolean[] optionals() 7327 { return new boolean[] { false, false, }; } 7328 7329 /** Request identifier. Used to match this information to another event. */ 7330 public final String requestId; 7331 7332 /** Error message */ 7333 public final String errorMessage; 7334 7335 /** 7336 * Constructor 7337 * 7338 * @param requestId Request identifier. Used to match this information to another event. 7339 * 7340 * @param errorMessage Error message 7341 */ 7342 public subresourceWebBundleMetadataError(String requestId, String errorMessage) 7343 { 7344 super("Network", "subresourceWebBundleMetadataError", 2); 7345 7346 // Exception-Check(s) to ensure that if any parameters which are not declared as 7347 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 7348 7349 if (requestId == null) THROWS.throwNPE("requestId"); 7350 if (errorMessage == null) THROWS.throwNPE("errorMessage"); 7351 7352 this.requestId = requestId; 7353 this.errorMessage = errorMessage; 7354 } 7355 7356 /** 7357 * JSON Object Constructor 7358 * @param jo A Json-Object having data about an instance of {@code 'subresourceWebBundleMetadataError'}. 7359 */ 7360 public subresourceWebBundleMetadataError (JsonObject jo) 7361 { 7362 super("Network", "subresourceWebBundleMetadataError", 2); 7363 7364 this.requestId = ReadJSON.getString(jo, "requestId", false, true); 7365 this.errorMessage = ReadJSON.getString(jo, "errorMessage", false, true); 7366 } 7367 7368 7369 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 7370 public boolean equals(Object other) 7371 { 7372 if (this == other) return true; 7373 if (other == null) return false; 7374 if (other.getClass() != this.getClass()) return false; 7375 7376 subresourceWebBundleMetadataError o = (subresourceWebBundleMetadataError) other; 7377 7378 return 7379 Objects.equals(this.requestId, o.requestId) 7380 && Objects.equals(this.errorMessage, o.errorMessage); 7381 } 7382 7383 /** Generates a Hash-Code for {@code 'this'} instance */ 7384 public int hashCode() 7385 { 7386 return 7387 Objects.hashCode(this.requestId) 7388 + Objects.hashCode(this.errorMessage); 7389 } 7390 } 7391 7392 /** 7393 * Fired when handling requests for resources within a .wbn file. 7394 * Note: this will only be fired for resources that are requested by the webpage. 7395 * <BR /> 7396 * <BR /><B>EXPERIMENTAL</B> 7397 */ 7398 public static class subresourceWebBundleInnerResponseParsed 7399 extends BrowserEvent 7400 implements java.io.Serializable 7401 { 7402 /** For Object Serialization. java.io.Serializable */ 7403 protected static final long serialVersionUID = 1; 7404 7405 public boolean[] optionals() 7406 { return new boolean[] { false, false, true, }; } 7407 7408 /** Request identifier of the subresource request */ 7409 public final String innerRequestId; 7410 7411 /** URL of the subresource resource. */ 7412 public final String innerRequestURL; 7413 7414 /** 7415 * Bundle request identifier. Used to match this information to another event. 7416 * This made be absent in case when the instrumentation was enabled only 7417 * after webbundle was parsed. 7418 * <BR /> 7419 * <BR /><B>OPTIONAL</B> 7420 */ 7421 public final String bundleRequestId; 7422 7423 /** 7424 * Constructor 7425 * 7426 * @param innerRequestId Request identifier of the subresource request 7427 * 7428 * @param innerRequestURL URL of the subresource resource. 7429 * 7430 * @param bundleRequestId 7431 * Bundle request identifier. Used to match this information to another event. 7432 * This made be absent in case when the instrumentation was enabled only 7433 * after webbundle was parsed. 7434 * <BR /><B>OPTIONAL</B> 7435 */ 7436 public subresourceWebBundleInnerResponseParsed 7437 (String innerRequestId, String innerRequestURL, String bundleRequestId) 7438 { 7439 super("Network", "subresourceWebBundleInnerResponseParsed", 3); 7440 7441 // Exception-Check(s) to ensure that if any parameters which are not declared as 7442 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 7443 7444 if (innerRequestId == null) THROWS.throwNPE("innerRequestId"); 7445 if (innerRequestURL == null) THROWS.throwNPE("innerRequestURL"); 7446 7447 this.innerRequestId = innerRequestId; 7448 this.innerRequestURL = innerRequestURL; 7449 this.bundleRequestId = bundleRequestId; 7450 } 7451 7452 /** 7453 * JSON Object Constructor 7454 * @param jo A Json-Object having data about an instance of {@code 'subresourceWebBundleInnerResponseParsed'}. 7455 */ 7456 public subresourceWebBundleInnerResponseParsed (JsonObject jo) 7457 { 7458 super("Network", "subresourceWebBundleInnerResponseParsed", 3); 7459 7460 this.innerRequestId = ReadJSON.getString(jo, "innerRequestId", false, true); 7461 this.innerRequestURL = ReadJSON.getString(jo, "innerRequestURL", false, true); 7462 this.bundleRequestId = ReadJSON.getString(jo, "bundleRequestId", true, false); 7463 } 7464 7465 7466 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 7467 public boolean equals(Object other) 7468 { 7469 if (this == other) return true; 7470 if (other == null) return false; 7471 if (other.getClass() != this.getClass()) return false; 7472 7473 subresourceWebBundleInnerResponseParsed o = (subresourceWebBundleInnerResponseParsed) other; 7474 7475 return 7476 Objects.equals(this.innerRequestId, o.innerRequestId) 7477 && Objects.equals(this.innerRequestURL, o.innerRequestURL) 7478 && Objects.equals(this.bundleRequestId, o.bundleRequestId); 7479 } 7480 7481 /** Generates a Hash-Code for {@code 'this'} instance */ 7482 public int hashCode() 7483 { 7484 return 7485 Objects.hashCode(this.innerRequestId) 7486 + Objects.hashCode(this.innerRequestURL) 7487 + Objects.hashCode(this.bundleRequestId); 7488 } 7489 } 7490 7491 /** 7492 * Fired when request for resources within a .wbn file failed. 7493 * <BR /> 7494 * <BR /><B>EXPERIMENTAL</B> 7495 */ 7496 public static class subresourceWebBundleInnerResponseError 7497 extends BrowserEvent 7498 implements java.io.Serializable 7499 { 7500 /** For Object Serialization. java.io.Serializable */ 7501 protected static final long serialVersionUID = 1; 7502 7503 public boolean[] optionals() 7504 { return new boolean[] { false, false, false, true, }; } 7505 7506 /** Request identifier of the subresource request */ 7507 public final String innerRequestId; 7508 7509 /** URL of the subresource resource. */ 7510 public final String innerRequestURL; 7511 7512 /** Error message */ 7513 public final String errorMessage; 7514 7515 /** 7516 * Bundle request identifier. Used to match this information to another event. 7517 * This made be absent in case when the instrumentation was enabled only 7518 * after webbundle was parsed. 7519 * <BR /> 7520 * <BR /><B>OPTIONAL</B> 7521 */ 7522 public final String bundleRequestId; 7523 7524 /** 7525 * Constructor 7526 * 7527 * @param innerRequestId Request identifier of the subresource request 7528 * 7529 * @param innerRequestURL URL of the subresource resource. 7530 * 7531 * @param errorMessage Error message 7532 * 7533 * @param bundleRequestId 7534 * Bundle request identifier. Used to match this information to another event. 7535 * This made be absent in case when the instrumentation was enabled only 7536 * after webbundle was parsed. 7537 * <BR /><B>OPTIONAL</B> 7538 */ 7539 public subresourceWebBundleInnerResponseError( 7540 String innerRequestId, String innerRequestURL, String errorMessage, 7541 String bundleRequestId 7542 ) 7543 { 7544 super("Network", "subresourceWebBundleInnerResponseError", 4); 7545 7546 // Exception-Check(s) to ensure that if any parameters which are not declared as 7547 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 7548 7549 if (innerRequestId == null) THROWS.throwNPE("innerRequestId"); 7550 if (innerRequestURL == null) THROWS.throwNPE("innerRequestURL"); 7551 if (errorMessage == null) THROWS.throwNPE("errorMessage"); 7552 7553 this.innerRequestId = innerRequestId; 7554 this.innerRequestURL = innerRequestURL; 7555 this.errorMessage = errorMessage; 7556 this.bundleRequestId = bundleRequestId; 7557 } 7558 7559 /** 7560 * JSON Object Constructor 7561 * @param jo A Json-Object having data about an instance of {@code 'subresourceWebBundleInnerResponseError'}. 7562 */ 7563 public subresourceWebBundleInnerResponseError (JsonObject jo) 7564 { 7565 super("Network", "subresourceWebBundleInnerResponseError", 4); 7566 7567 this.innerRequestId = ReadJSON.getString(jo, "innerRequestId", false, true); 7568 this.innerRequestURL = ReadJSON.getString(jo, "innerRequestURL", false, true); 7569 this.errorMessage = ReadJSON.getString(jo, "errorMessage", false, true); 7570 this.bundleRequestId = ReadJSON.getString(jo, "bundleRequestId", true, false); 7571 } 7572 7573 7574 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 7575 public boolean equals(Object other) 7576 { 7577 if (this == other) return true; 7578 if (other == null) return false; 7579 if (other.getClass() != this.getClass()) return false; 7580 7581 subresourceWebBundleInnerResponseError o = (subresourceWebBundleInnerResponseError) other; 7582 7583 return 7584 Objects.equals(this.innerRequestId, o.innerRequestId) 7585 && Objects.equals(this.innerRequestURL, o.innerRequestURL) 7586 && Objects.equals(this.errorMessage, o.errorMessage) 7587 && Objects.equals(this.bundleRequestId, o.bundleRequestId); 7588 } 7589 7590 /** Generates a Hash-Code for {@code 'this'} instance */ 7591 public int hashCode() 7592 { 7593 return 7594 Objects.hashCode(this.innerRequestId) 7595 + Objects.hashCode(this.innerRequestURL) 7596 + Objects.hashCode(this.errorMessage) 7597 + Objects.hashCode(this.bundleRequestId); 7598 } 7599 } 7600 7601 /** 7602 * Is sent whenever a new report is added. 7603 * And after 'enableReportingApi' for all existing reports. 7604 * <BR /> 7605 * <BR /><B>EXPERIMENTAL</B> 7606 */ 7607 public static class reportingApiReportAdded 7608 extends BrowserEvent 7609 implements java.io.Serializable 7610 { 7611 /** For Object Serialization. java.io.Serializable */ 7612 protected static final long serialVersionUID = 1; 7613 7614 public boolean[] optionals() 7615 { return new boolean[] { false, }; } 7616 7617 /** <CODE>[No Description Provided by Google]</CODE> */ 7618 public final Network.ReportingApiReport report; 7619 7620 /** 7621 * Constructor 7622 * 7623 * @param report - 7624 */ 7625 public reportingApiReportAdded(Network.ReportingApiReport report) 7626 { 7627 super("Network", "reportingApiReportAdded", 1); 7628 7629 // Exception-Check(s) to ensure that if any parameters which are not declared as 7630 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 7631 7632 if (report == null) THROWS.throwNPE("report"); 7633 7634 this.report = report; 7635 } 7636 7637 /** 7638 * JSON Object Constructor 7639 * @param jo A Json-Object having data about an instance of {@code 'reportingApiReportAdded'}. 7640 */ 7641 public reportingApiReportAdded (JsonObject jo) 7642 { 7643 super("Network", "reportingApiReportAdded", 1); 7644 7645 this.report = ReadJSON.getObject(jo, "report", Network.ReportingApiReport.class, false, true); 7646 } 7647 7648 7649 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 7650 public boolean equals(Object other) 7651 { 7652 if (this == other) return true; 7653 if (other == null) return false; 7654 if (other.getClass() != this.getClass()) return false; 7655 7656 reportingApiReportAdded o = (reportingApiReportAdded) other; 7657 7658 return 7659 Objects.equals(this.report, o.report); 7660 } 7661 7662 /** Generates a Hash-Code for {@code 'this'} instance */ 7663 public int hashCode() 7664 { 7665 return 7666 this.report.hashCode(); 7667 } 7668 } 7669 7670 /** 7671 * <CODE>[No Description Provided by Google]</CODE> 7672 * <BR /> 7673 * <BR /><B>EXPERIMENTAL</B> 7674 */ 7675 public static class reportingApiReportUpdated 7676 extends BrowserEvent 7677 implements java.io.Serializable 7678 { 7679 /** For Object Serialization. java.io.Serializable */ 7680 protected static final long serialVersionUID = 1; 7681 7682 public boolean[] optionals() 7683 { return new boolean[] { false, }; } 7684 7685 /** <CODE>[No Description Provided by Google]</CODE> */ 7686 public final Network.ReportingApiReport report; 7687 7688 /** 7689 * Constructor 7690 * 7691 * @param report - 7692 */ 7693 public reportingApiReportUpdated(Network.ReportingApiReport report) 7694 { 7695 super("Network", "reportingApiReportUpdated", 1); 7696 7697 // Exception-Check(s) to ensure that if any parameters which are not declared as 7698 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 7699 7700 if (report == null) THROWS.throwNPE("report"); 7701 7702 this.report = report; 7703 } 7704 7705 /** 7706 * JSON Object Constructor 7707 * @param jo A Json-Object having data about an instance of {@code 'reportingApiReportUpdated'}. 7708 */ 7709 public reportingApiReportUpdated (JsonObject jo) 7710 { 7711 super("Network", "reportingApiReportUpdated", 1); 7712 7713 this.report = ReadJSON.getObject(jo, "report", Network.ReportingApiReport.class, false, true); 7714 } 7715 7716 7717 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 7718 public boolean equals(Object other) 7719 { 7720 if (this == other) return true; 7721 if (other == null) return false; 7722 if (other.getClass() != this.getClass()) return false; 7723 7724 reportingApiReportUpdated o = (reportingApiReportUpdated) other; 7725 7726 return 7727 Objects.equals(this.report, o.report); 7728 } 7729 7730 /** Generates a Hash-Code for {@code 'this'} instance */ 7731 public int hashCode() 7732 { 7733 return 7734 this.report.hashCode(); 7735 } 7736 } 7737 7738 7739 // Counter for keeping the WebSocket Request ID's distinct. 7740 private static int counter = 1; 7741 7742 /** 7743 * Sets a list of content encodings that will be accepted. Empty list means no encoding is accepted. 7744 * <BR /><B>EXPERIMENTAL</B> 7745 * 7746 * @param encodings List of accepted content encodings. 7747 * 7748 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 7749 * {@link Ret0}></CODE> 7750 * 7751 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 7752 * browser receives the invocation-request. 7753 * 7754 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 7755 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 7756 * {@code >} to ensure the Browser Function has run to completion. 7757 */ 7758 public static Script<String, JsonObject, Ret0> setAcceptedEncodings(String[] encodings) 7759 { 7760 // Exception-Check(s) to ensure that if any parameters which are not declared as 7761 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 7762 7763 if (encodings == null) THROWS.throwNPE("encodings"); 7764 7765 final int webSocketID = 30000000 + counter++; 7766 final boolean[] optionals = { false, }; 7767 7768 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 7769 String requestJSON = WriteJSON.get( 7770 parameterTypes.get("setAcceptedEncodings"), 7771 parameterNames.get("setAcceptedEncodings"), 7772 optionals, webSocketID, 7773 "Network.setAcceptedEncodings", 7774 (Object) encodings 7775 ); 7776 7777 // This Remote Command does not have a Return-Value. 7778 return new Script<> 7779 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 7780 } 7781 7782 /** 7783 * Clears accepted encodings set by setAcceptedEncodings 7784 * <BR /><B>EXPERIMENTAL</B> 7785 * 7786 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 7787 * {@link Ret0}></CODE> 7788 * 7789 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 7790 * browser receives the invocation-request. 7791 * 7792 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 7793 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 7794 * {@code >} to ensure the Browser Function has run to completion. 7795 */ 7796 public static Script<String, JsonObject, Ret0> clearAcceptedEncodingsOverride() 7797 { 7798 final int webSocketID = 30001000 + counter++; 7799 final boolean[] optionals = new boolean[0]; 7800 7801 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 7802 String requestJSON = WriteJSON.get( 7803 parameterTypes.get("clearAcceptedEncodingsOverride"), 7804 parameterNames.get("clearAcceptedEncodingsOverride"), 7805 optionals, webSocketID, 7806 "Network.clearAcceptedEncodingsOverride" 7807 ); 7808 7809 // This Remote Command does not have a Return-Value. 7810 return new Script<> 7811 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 7812 } 7813 7814 /** 7815 * Tells whether clearing browser cache is supported. 7816 * <BR /><B>DEPRECATED</B> 7817 * 7818 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 7819 * Boolean></CODE> 7820 * 7821 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 7822 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 7823 * Boolean></CODE> will be returned. 7824 * 7825 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 7826 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 7827 * may be retrieved.</I> 7828 * 7829 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 7830 * <BR /><BR /><UL CLASS=JDUL> 7831 * <LI><CODE>Boolean (<B>result</B></CODE>) 7832 * <BR />True if browser cache can be cleared. 7833 * </LI> 7834 * </UL> */ 7835 public static Script<String, JsonObject, Boolean> canClearBrowserCache() 7836 { 7837 final int webSocketID = 30002000 + counter++; 7838 final boolean[] optionals = new boolean[0]; 7839 7840 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 7841 String requestJSON = WriteJSON.get( 7842 parameterTypes.get("canClearBrowserCache"), 7843 parameterNames.get("canClearBrowserCache"), 7844 optionals, webSocketID, 7845 "Network.canClearBrowserCache" 7846 ); 7847 7848 // 'JSON Binding' ... Converts Browser Response-JSON to 'Boolean' 7849 Function<JsonObject, Boolean> responseProcessor = (JsonObject jo) -> 7850 ReadPrimJSON.getBoolean(jo, "result"); 7851 7852 return new Script<>(webSocketID, requestJSON, responseProcessor); 7853 } 7854 7855 /** 7856 * Tells whether clearing browser cookies is supported. 7857 * <BR /><B>DEPRECATED</B> 7858 * 7859 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 7860 * Boolean></CODE> 7861 * 7862 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 7863 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 7864 * Boolean></CODE> will be returned. 7865 * 7866 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 7867 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 7868 * may be retrieved.</I> 7869 * 7870 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 7871 * <BR /><BR /><UL CLASS=JDUL> 7872 * <LI><CODE>Boolean (<B>result</B></CODE>) 7873 * <BR />True if browser cookies can be cleared. 7874 * </LI> 7875 * </UL> */ 7876 public static Script<String, JsonObject, Boolean> canClearBrowserCookies() 7877 { 7878 final int webSocketID = 30003000 + counter++; 7879 final boolean[] optionals = new boolean[0]; 7880 7881 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 7882 String requestJSON = WriteJSON.get( 7883 parameterTypes.get("canClearBrowserCookies"), 7884 parameterNames.get("canClearBrowserCookies"), 7885 optionals, webSocketID, 7886 "Network.canClearBrowserCookies" 7887 ); 7888 7889 // 'JSON Binding' ... Converts Browser Response-JSON to 'Boolean' 7890 Function<JsonObject, Boolean> responseProcessor = (JsonObject jo) -> 7891 ReadPrimJSON.getBoolean(jo, "result"); 7892 7893 return new Script<>(webSocketID, requestJSON, responseProcessor); 7894 } 7895 7896 /** 7897 * Tells whether emulation of network conditions is supported. 7898 * <BR /><B>DEPRECATED</B> 7899 * 7900 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 7901 * Boolean></CODE> 7902 * 7903 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 7904 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 7905 * Boolean></CODE> will be returned. 7906 * 7907 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 7908 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 7909 * may be retrieved.</I> 7910 * 7911 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 7912 * <BR /><BR /><UL CLASS=JDUL> 7913 * <LI><CODE>Boolean (<B>result</B></CODE>) 7914 * <BR />True if emulation of network conditions is supported. 7915 * </LI> 7916 * </UL> */ 7917 public static Script<String, JsonObject, Boolean> canEmulateNetworkConditions() 7918 { 7919 final int webSocketID = 30004000 + counter++; 7920 final boolean[] optionals = new boolean[0]; 7921 7922 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 7923 String requestJSON = WriteJSON.get( 7924 parameterTypes.get("canEmulateNetworkConditions"), 7925 parameterNames.get("canEmulateNetworkConditions"), 7926 optionals, webSocketID, 7927 "Network.canEmulateNetworkConditions" 7928 ); 7929 7930 // 'JSON Binding' ... Converts Browser Response-JSON to 'Boolean' 7931 Function<JsonObject, Boolean> responseProcessor = (JsonObject jo) -> 7932 ReadPrimJSON.getBoolean(jo, "result"); 7933 7934 return new Script<>(webSocketID, requestJSON, responseProcessor); 7935 } 7936 7937 /** 7938 * Clears browser cache. 7939 * 7940 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 7941 * {@link Ret0}></CODE> 7942 * 7943 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 7944 * browser receives the invocation-request. 7945 * 7946 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 7947 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 7948 * {@code >} to ensure the Browser Function has run to completion. 7949 */ 7950 public static Script<String, JsonObject, Ret0> clearBrowserCache() 7951 { 7952 final int webSocketID = 30005000 + counter++; 7953 final boolean[] optionals = new boolean[0]; 7954 7955 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 7956 String requestJSON = WriteJSON.get( 7957 parameterTypes.get("clearBrowserCache"), 7958 parameterNames.get("clearBrowserCache"), 7959 optionals, webSocketID, 7960 "Network.clearBrowserCache" 7961 ); 7962 7963 // This Remote Command does not have a Return-Value. 7964 return new Script<> 7965 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 7966 } 7967 7968 /** 7969 * Clears browser cookies. 7970 * 7971 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 7972 * {@link Ret0}></CODE> 7973 * 7974 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 7975 * browser receives the invocation-request. 7976 * 7977 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 7978 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 7979 * {@code >} to ensure the Browser Function has run to completion. 7980 */ 7981 public static Script<String, JsonObject, Ret0> clearBrowserCookies() 7982 { 7983 final int webSocketID = 30006000 + counter++; 7984 final boolean[] optionals = new boolean[0]; 7985 7986 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 7987 String requestJSON = WriteJSON.get( 7988 parameterTypes.get("clearBrowserCookies"), 7989 parameterNames.get("clearBrowserCookies"), 7990 optionals, webSocketID, 7991 "Network.clearBrowserCookies" 7992 ); 7993 7994 // This Remote Command does not have a Return-Value. 7995 return new Script<> 7996 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 7997 } 7998 7999 /** 8000 * Response to Network.requestIntercepted which either modifies the request to continue with any 8001 * modifications, or blocks it, or completes it with the provided response bytes. If a network 8002 * fetch occurs as a result which encounters a redirect an additional Network.requestIntercepted 8003 * event will be sent with the same InterceptionId. 8004 * Deprecated, use Fetch.continueRequest, Fetch.fulfillRequest and Fetch.failRequest instead. 8005 * <BR /><B>EXPERIMENTAL</B> 8006 * <BR /><B>DEPRECATED</B> 8007 * 8008 * @param interceptionId - 8009 * 8010 * @param errorReason 8011 * If set this causes the request to fail with the given reason. Passing <CODE>Aborted</CODE> for requests 8012 * marked with <CODE>isNavigationRequest</CODE> also cancels the navigation. Must not be set in response 8013 * to an authChallenge. 8014 * <BR /><B>OPTIONAL</B> 8015 * 8016 * @param rawResponse 8017 * If set the requests completes using with the provided base64 encoded raw response, including 8018 * HTTP status line and headers etc... Must not be set in response to an authChallenge. (Encoded as a base64 string when passed over JSON) 8019 * <BR /><B>OPTIONAL</B> 8020 * 8021 * @param url 8022 * If set the request url will be modified in a way that's not observable by page. Must not be 8023 * set in response to an authChallenge. 8024 * <BR /><B>OPTIONAL</B> 8025 * 8026 * @param method 8027 * If set this allows the request method to be overridden. Must not be set in response to an 8028 * authChallenge. 8029 * <BR /><B>OPTIONAL</B> 8030 * 8031 * @param postData If set this allows postData to be set. Must not be set in response to an authChallenge. 8032 * <BR /><B>OPTIONAL</B> 8033 * 8034 * @param headers 8035 * If set this allows the request headers to be changed. Must not be set in response to an 8036 * authChallenge. 8037 * <BR /><B>OPTIONAL</B> 8038 * 8039 * @param authChallengeResponse Response to a requestIntercepted with an authChallenge. Must not be set otherwise. 8040 * <BR /><B>OPTIONAL</B> 8041 * 8042 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 8043 * {@link Ret0}></CODE> 8044 * 8045 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 8046 * browser receives the invocation-request. 8047 * 8048 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 8049 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 8050 * {@code >} to ensure the Browser Function has run to completion. 8051 */ 8052 public static Script<String, JsonObject, Ret0> continueInterceptedRequest( 8053 String interceptionId, String errorReason, String rawResponse, String url, 8054 String method, String postData, JsonObject headers, 8055 Network.AuthChallengeResponse authChallengeResponse 8056 ) 8057 { 8058 // Exception-Check(s) to ensure that if any parameters which are not declared as 8059 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 8060 8061 if (interceptionId == null) THROWS.throwNPE("interceptionId"); 8062 8063 // Exception-Check(s) to ensure that if any parameters which must adhere to a 8064 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 8065 8066 THROWS.checkIAE("errorReason", errorReason, "Network.ErrorReason", Network.ErrorReason); 8067 8068 final int webSocketID = 30007000 + counter++; 8069 final boolean[] optionals = { false, true, true, true, true, true, true, true, }; 8070 8071 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 8072 String requestJSON = WriteJSON.get( 8073 parameterTypes.get("continueInterceptedRequest"), 8074 parameterNames.get("continueInterceptedRequest"), 8075 optionals, webSocketID, 8076 "Network.continueInterceptedRequest", 8077 interceptionId, errorReason, rawResponse, url, method, postData, headers, 8078 authChallengeResponse 8079 ); 8080 8081 // This Remote Command does not have a Return-Value. 8082 return new Script<> 8083 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 8084 } 8085 8086 /** 8087 * Deletes browser cookies with matching name and url or domain/path pair. 8088 * 8089 * @param name Name of the cookies to remove. 8090 * 8091 * @param url 8092 * If specified, deletes all the cookies with the given name where domain and path match 8093 * provided URL. 8094 * <BR /><B>OPTIONAL</B> 8095 * 8096 * @param domain If specified, deletes only cookies with the exact domain. 8097 * <BR /><B>OPTIONAL</B> 8098 * 8099 * @param path If specified, deletes only cookies with the exact path. 8100 * <BR /><B>OPTIONAL</B> 8101 * 8102 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 8103 * {@link Ret0}></CODE> 8104 * 8105 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 8106 * browser receives the invocation-request. 8107 * 8108 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 8109 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 8110 * {@code >} to ensure the Browser Function has run to completion. 8111 */ 8112 public static Script<String, JsonObject, Ret0> deleteCookies 8113 (String name, String url, String domain, String path) 8114 { 8115 // Exception-Check(s) to ensure that if any parameters which are not declared as 8116 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 8117 8118 if (name == null) THROWS.throwNPE("name"); 8119 8120 final int webSocketID = 30008000 + counter++; 8121 final boolean[] optionals = { false, true, true, true, }; 8122 8123 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 8124 String requestJSON = WriteJSON.get( 8125 parameterTypes.get("deleteCookies"), 8126 parameterNames.get("deleteCookies"), 8127 optionals, webSocketID, 8128 "Network.deleteCookies", 8129 name, url, domain, path 8130 ); 8131 8132 // This Remote Command does not have a Return-Value. 8133 return new Script<> 8134 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 8135 } 8136 8137 /** 8138 * Disables network tracking, prevents network events from being sent to the client. 8139 * 8140 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 8141 * {@link Ret0}></CODE> 8142 * 8143 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 8144 * browser receives the invocation-request. 8145 * 8146 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 8147 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 8148 * {@code >} to ensure the Browser Function has run to completion. 8149 */ 8150 public static Script<String, JsonObject, Ret0> disable() 8151 { 8152 final int webSocketID = 30009000 + counter++; 8153 final boolean[] optionals = new boolean[0]; 8154 8155 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 8156 String requestJSON = WriteJSON.get( 8157 parameterTypes.get("disable"), 8158 parameterNames.get("disable"), 8159 optionals, webSocketID, 8160 "Network.disable" 8161 ); 8162 8163 // This Remote Command does not have a Return-Value. 8164 return new Script<> 8165 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 8166 } 8167 8168 /** 8169 * Activates emulation of network conditions. 8170 * 8171 * @param offline True to emulate internet disconnection. 8172 * 8173 * @param latency Minimum latency from request sent to response headers received (ms). 8174 * 8175 * @param downloadThroughput Maximal aggregated download throughput (bytes/sec). -1 disables download throttling. 8176 * 8177 * @param uploadThroughput Maximal aggregated upload throughput (bytes/sec). -1 disables upload throttling. 8178 * 8179 * @param connectionType Connection type if known. 8180 * <BR /><B>OPTIONAL</B> 8181 * 8182 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 8183 * {@link Ret0}></CODE> 8184 * 8185 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 8186 * browser receives the invocation-request. 8187 * 8188 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 8189 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 8190 * {@code >} to ensure the Browser Function has run to completion. 8191 */ 8192 public static Script<String, JsonObject, Ret0> emulateNetworkConditions( 8193 boolean offline, Number latency, Number downloadThroughput, Number uploadThroughput, 8194 String connectionType 8195 ) 8196 { 8197 // Exception-Check(s) to ensure that if any parameters which are not declared as 8198 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 8199 8200 if (latency == null) THROWS.throwNPE("latency"); 8201 if (downloadThroughput == null) THROWS.throwNPE("downloadThroughput"); 8202 if (uploadThroughput == null) THROWS.throwNPE("uploadThroughput"); 8203 8204 // Exception-Check(s) to ensure that if any parameters which must adhere to a 8205 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 8206 8207 THROWS.checkIAE("connectionType", connectionType, "Network.ConnectionType", Network.ConnectionType); 8208 8209 final int webSocketID = 30010000 + counter++; 8210 final boolean[] optionals = { false, false, false, false, true, }; 8211 8212 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 8213 String requestJSON = WriteJSON.get( 8214 parameterTypes.get("emulateNetworkConditions"), 8215 parameterNames.get("emulateNetworkConditions"), 8216 optionals, webSocketID, 8217 "Network.emulateNetworkConditions", 8218 offline, latency, downloadThroughput, uploadThroughput, connectionType 8219 ); 8220 8221 // This Remote Command does not have a Return-Value. 8222 return new Script<> 8223 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 8224 } 8225 8226 /** 8227 * Enables network tracking, network events will now be delivered to the client. 8228 * 8229 * @param maxTotalBufferSize Buffer size in bytes to use when preserving network payloads (XHRs, etc). 8230 * <BR /><B>OPTIONAL</B> 8231 * <BR /><B>EXPERIMENTAL</B> 8232 * 8233 * @param maxResourceBufferSize Per-resource buffer size in bytes to use when preserving network payloads (XHRs, etc). 8234 * <BR /><B>OPTIONAL</B> 8235 * <BR /><B>EXPERIMENTAL</B> 8236 * 8237 * @param maxPostDataSize Longest post body size (in bytes) that would be included in requestWillBeSent notification 8238 * <BR /><B>OPTIONAL</B> 8239 * 8240 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 8241 * {@link Ret0}></CODE> 8242 * 8243 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 8244 * browser receives the invocation-request. 8245 * 8246 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 8247 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 8248 * {@code >} to ensure the Browser Function has run to completion. 8249 */ 8250 public static Script<String, JsonObject, Ret0> enable 8251 (Integer maxTotalBufferSize, Integer maxResourceBufferSize, Integer maxPostDataSize) 8252 { 8253 final int webSocketID = 30011000 + counter++; 8254 final boolean[] optionals = { true, true, true, }; 8255 8256 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 8257 String requestJSON = WriteJSON.get( 8258 parameterTypes.get("enable"), 8259 parameterNames.get("enable"), 8260 optionals, webSocketID, 8261 "Network.enable", 8262 maxTotalBufferSize, maxResourceBufferSize, maxPostDataSize 8263 ); 8264 8265 // This Remote Command does not have a Return-Value. 8266 return new Script<> 8267 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 8268 } 8269 8270 /** 8271 * Returns all browser cookies. Depending on the backend support, will return detailed cookie 8272 * information in the <CODE>cookies</CODE> field. 8273 * 8274 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 8275 * {@link Network.Cookie}[]></CODE> 8276 * 8277 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 8278 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 8279 * {@link Network.Cookie}[]></CODE> will be returned. 8280 * 8281 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 8282 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 8283 * may be retrieved.</I> 8284 * 8285 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 8286 * <BR /><BR /><UL CLASS=JDUL> 8287 * <LI><CODE>{@link Network.Cookie}[] (<B>cookies</B></CODE>) 8288 * <BR />Array of cookie objects. 8289 * </LI> 8290 * </UL> */ 8291 public static Script<String, JsonObject, Network.Cookie[]> getAllCookies() 8292 { 8293 final int webSocketID = 30012000 + counter++; 8294 final boolean[] optionals = new boolean[0]; 8295 8296 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 8297 String requestJSON = WriteJSON.get( 8298 parameterTypes.get("getAllCookies"), 8299 parameterNames.get("getAllCookies"), 8300 optionals, webSocketID, 8301 "Network.getAllCookies" 8302 ); 8303 8304 // 'JSON Binding' ... Converts Browser Response-JSON to 'Network.Cookie[]' 8305 Function<JsonObject, Network.Cookie[]> responseProcessor = (JsonObject jo) -> 8306 (jo.getJsonArray("cookies") == null) 8307 ? null 8308 : RJArrIntoStream.objArr(jo.getJsonArray("cookies"), null, 0, Network.Cookie.class).toArray(Network.Cookie[]::new); 8309 8310 return new Script<>(webSocketID, requestJSON, responseProcessor); 8311 } 8312 8313 /** 8314 * Returns the DER-encoded certificate. 8315 * <BR /><B>EXPERIMENTAL</B> 8316 * 8317 * @param origin Origin to get certificate for. 8318 * 8319 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 8320 * String[]></CODE> 8321 * 8322 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 8323 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 8324 * String[]></CODE> will be returned. 8325 * 8326 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 8327 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 8328 * may be retrieved.</I> 8329 * 8330 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 8331 * <BR /><BR /><UL CLASS=JDUL> 8332 * <LI><CODE>String[] (<B>tableNames</B></CODE>) 8333 * <BR />- 8334 * </LI> 8335 * </UL> */ 8336 public static Script<String, JsonObject, String[]> getCertificate(String origin) 8337 { 8338 // Exception-Check(s) to ensure that if any parameters which are not declared as 8339 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 8340 8341 if (origin == null) THROWS.throwNPE("origin"); 8342 8343 final int webSocketID = 30013000 + counter++; 8344 final boolean[] optionals = { false, }; 8345 8346 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 8347 String requestJSON = WriteJSON.get( 8348 parameterTypes.get("getCertificate"), 8349 parameterNames.get("getCertificate"), 8350 optionals, webSocketID, 8351 "Network.getCertificate", 8352 origin 8353 ); 8354 8355 // 'JSON Binding' ... Converts Browser Response-JSON to 'String[]' 8356 Function<JsonObject, String[]> responseProcessor = (JsonObject jo) -> 8357 (jo.getJsonArray("tableNames") == null) 8358 ? null 8359 : RJArrIntoStream.strArr(jo.getJsonArray("tableNames"), null, 0).toArray(String[]::new); 8360 8361 return new Script<>(webSocketID, requestJSON, responseProcessor); 8362 } 8363 8364 /** 8365 * Returns all browser cookies for the current URL. Depending on the backend support, will return 8366 * detailed cookie information in the <CODE>cookies</CODE> field. 8367 * 8368 * @param urls 8369 * The list of URLs for which applicable cookies will be fetched. 8370 * If not specified, it's assumed to be set to the list containing 8371 * the URLs of the page and all of its subframes. 8372 * <BR /><B>OPTIONAL</B> 8373 * 8374 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 8375 * {@link Network.Cookie}[]></CODE> 8376 * 8377 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 8378 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 8379 * {@link Network.Cookie}[]></CODE> will be returned. 8380 * 8381 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 8382 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 8383 * may be retrieved.</I> 8384 * 8385 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 8386 * <BR /><BR /><UL CLASS=JDUL> 8387 * <LI><CODE>{@link Network.Cookie}[] (<B>cookies</B></CODE>) 8388 * <BR />Array of cookie objects. 8389 * </LI> 8390 * </UL> */ 8391 public static Script<String, JsonObject, Network.Cookie[]> getCookies(String[] urls) 8392 { 8393 final int webSocketID = 30014000 + counter++; 8394 final boolean[] optionals = { true, }; 8395 8396 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 8397 String requestJSON = WriteJSON.get( 8398 parameterTypes.get("getCookies"), 8399 parameterNames.get("getCookies"), 8400 optionals, webSocketID, 8401 "Network.getCookies", 8402 (Object) urls 8403 ); 8404 8405 // 'JSON Binding' ... Converts Browser Response-JSON to 'Network.Cookie[]' 8406 Function<JsonObject, Network.Cookie[]> responseProcessor = (JsonObject jo) -> 8407 (jo.getJsonArray("cookies") == null) 8408 ? null 8409 : RJArrIntoStream.objArr(jo.getJsonArray("cookies"), null, 0, Network.Cookie.class).toArray(Network.Cookie[]::new); 8410 8411 return new Script<>(webSocketID, requestJSON, responseProcessor); 8412 } 8413 8414 /** 8415 * Returns content served for the given request. 8416 * 8417 * @param requestId Identifier of the network request to get content for. 8418 * 8419 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 8420 * {@link Ret2}></CODE> 8421 * 8422 * <BR /><BR />This {@link Script} may be <B STYLE='color:red'>executed</B> (using 8423 * {@link Script#exec()}), and a {@link Promise} returned. 8424 * 8425 * <BR /><BR />When the {@code Promise} is <B STYLE='color: red'>awaited</B> 8426 * (using {@link Promise#await()}), the {@code Ret2} will subsequently 8427 * be returned from that call. 8428 * 8429 * <BR /><BR />The <B STYLE='color: red'>returned</B> values are encapsulated 8430 * in an instance of <B>{@link Ret2}</B> 8431 * 8432 * <BR /><BR /><UL CLASS=JDUL> 8433 * <LI><CODE><B>Ret2.a:</B> String (<B>body</B>)</CODE> 8434 * <BR />Response body. 8435 * <BR /><BR /></LI> 8436 * <LI><CODE><B>Ret2.b:</B> Boolean (<B>base64Encoded</B>)</CODE> 8437 * <BR />True, if content was sent as base64. 8438 * </LI> 8439 * </UL> 8440 */ 8441 public static Script<String, JsonObject, Ret2<String, Boolean>> getResponseBody 8442 (String requestId) 8443 { 8444 // Exception-Check(s) to ensure that if any parameters which are not declared as 8445 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 8446 8447 if (requestId == null) THROWS.throwNPE("requestId"); 8448 8449 final int webSocketID = 30015000 + counter++; 8450 final boolean[] optionals = { false, }; 8451 8452 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 8453 String requestJSON = WriteJSON.get( 8454 parameterTypes.get("getResponseBody"), 8455 parameterNames.get("getResponseBody"), 8456 optionals, webSocketID, 8457 "Network.getResponseBody", 8458 requestId 8459 ); 8460 8461 // 'JSON Binding' ... Converts Browser Response-JSON into Java-Type 'Ret2' 8462 Function<JsonObject, Ret2<String, Boolean>> 8463 responseProcessor = (JsonObject jo) -> new Ret2<>( 8464 ReadJSON.getString(jo, "body", false, true), 8465 ReadBoxedJSON.getBoolean(jo, "base64Encoded", true) 8466 ); 8467 8468 return new Script<>(webSocketID, requestJSON, responseProcessor); 8469 } 8470 8471 /** 8472 * Returns post data sent with the request. Returns an error when no data was sent with the request. 8473 * 8474 * @param requestId Identifier of the network request to get content for. 8475 * 8476 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 8477 * String></CODE> 8478 * 8479 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 8480 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 8481 * String></CODE> will be returned. 8482 * 8483 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 8484 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 8485 * may be retrieved.</I> 8486 * 8487 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 8488 * <BR /><BR /><UL CLASS=JDUL> 8489 * <LI><CODE>String (<B>postData</B></CODE>) 8490 * <BR />Request body string, omitting files from multipart requests 8491 * </LI> 8492 * </UL> */ 8493 public static Script<String, JsonObject, String> getRequestPostData(String requestId) 8494 { 8495 // Exception-Check(s) to ensure that if any parameters which are not declared as 8496 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 8497 8498 if (requestId == null) THROWS.throwNPE("requestId"); 8499 8500 final int webSocketID = 30016000 + counter++; 8501 final boolean[] optionals = { false, }; 8502 8503 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 8504 String requestJSON = WriteJSON.get( 8505 parameterTypes.get("getRequestPostData"), 8506 parameterNames.get("getRequestPostData"), 8507 optionals, webSocketID, 8508 "Network.getRequestPostData", 8509 requestId 8510 ); 8511 8512 // 'JSON Binding' ... Converts Browser Response-JSON to 'String' 8513 Function<JsonObject, String> responseProcessor = (JsonObject jo) -> 8514 ReadJSON.getString(jo, "postData", false, true); 8515 8516 return new Script<>(webSocketID, requestJSON, responseProcessor); 8517 } 8518 8519 /** 8520 * Returns content served for the given currently intercepted request. 8521 * <BR /><B>EXPERIMENTAL</B> 8522 * 8523 * @param interceptionId Identifier for the intercepted request to get body for. 8524 * 8525 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 8526 * {@link Ret2}></CODE> 8527 * 8528 * <BR /><BR />This {@link Script} may be <B STYLE='color:red'>executed</B> (using 8529 * {@link Script#exec()}), and a {@link Promise} returned. 8530 * 8531 * <BR /><BR />When the {@code Promise} is <B STYLE='color: red'>awaited</B> 8532 * (using {@link Promise#await()}), the {@code Ret2} will subsequently 8533 * be returned from that call. 8534 * 8535 * <BR /><BR />The <B STYLE='color: red'>returned</B> values are encapsulated 8536 * in an instance of <B>{@link Ret2}</B> 8537 * 8538 * <BR /><BR /><UL CLASS=JDUL> 8539 * <LI><CODE><B>Ret2.a:</B> String (<B>body</B>)</CODE> 8540 * <BR />Response body. 8541 * <BR /><BR /></LI> 8542 * <LI><CODE><B>Ret2.b:</B> Boolean (<B>base64Encoded</B>)</CODE> 8543 * <BR />True, if content was sent as base64. 8544 * </LI> 8545 * </UL> 8546 */ 8547 public static Script<String, JsonObject, Ret2<String, Boolean>> getResponseBodyForInterception 8548 (String interceptionId) 8549 { 8550 // Exception-Check(s) to ensure that if any parameters which are not declared as 8551 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 8552 8553 if (interceptionId == null) THROWS.throwNPE("interceptionId"); 8554 8555 final int webSocketID = 30017000 + counter++; 8556 final boolean[] optionals = { false, }; 8557 8558 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 8559 String requestJSON = WriteJSON.get( 8560 parameterTypes.get("getResponseBodyForInterception"), 8561 parameterNames.get("getResponseBodyForInterception"), 8562 optionals, webSocketID, 8563 "Network.getResponseBodyForInterception", 8564 interceptionId 8565 ); 8566 8567 // 'JSON Binding' ... Converts Browser Response-JSON into Java-Type 'Ret2' 8568 Function<JsonObject, Ret2<String, Boolean>> 8569 responseProcessor = (JsonObject jo) -> new Ret2<>( 8570 ReadJSON.getString(jo, "body", false, true), 8571 ReadBoxedJSON.getBoolean(jo, "base64Encoded", true) 8572 ); 8573 8574 return new Script<>(webSocketID, requestJSON, responseProcessor); 8575 } 8576 8577 /** 8578 * Returns a handle to the stream representing the response body. Note that after this command, 8579 * the intercepted request can't be continued as is -- you either need to cancel it or to provide 8580 * the response body. The stream only supports sequential read, IO.read will fail if the position 8581 * is specified. 8582 * <BR /><B>EXPERIMENTAL</B> 8583 * 8584 * @param interceptionId - 8585 * 8586 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 8587 * String></CODE> 8588 * 8589 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 8590 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 8591 * String></CODE> will be returned. 8592 * 8593 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 8594 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 8595 * may be retrieved.</I> 8596 * 8597 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 8598 * <BR /><BR /><UL CLASS=JDUL> 8599 * <LI><CODE>String (<B>stream</B></CODE>) 8600 * <BR />- 8601 * </LI> 8602 * </UL> */ 8603 public static Script<String, JsonObject, String> takeResponseBodyForInterceptionAsStream 8604 (String interceptionId) 8605 { 8606 // Exception-Check(s) to ensure that if any parameters which are not declared as 8607 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 8608 8609 if (interceptionId == null) THROWS.throwNPE("interceptionId"); 8610 8611 final int webSocketID = 30018000 + counter++; 8612 final boolean[] optionals = { false, }; 8613 8614 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 8615 String requestJSON = WriteJSON.get( 8616 parameterTypes.get("takeResponseBodyForInterceptionAsStream"), 8617 parameterNames.get("takeResponseBodyForInterceptionAsStream"), 8618 optionals, webSocketID, 8619 "Network.takeResponseBodyForInterceptionAsStream", 8620 interceptionId 8621 ); 8622 8623 // 'JSON Binding' ... Converts Browser Response-JSON to 'String' 8624 Function<JsonObject, String> responseProcessor = (JsonObject jo) -> 8625 ReadJSON.getString(jo, "stream", false, true); 8626 8627 return new Script<>(webSocketID, requestJSON, responseProcessor); 8628 } 8629 8630 /** 8631 * This method sends a new XMLHttpRequest which is identical to the original one. The following 8632 * parameters should be identical: method, url, async, request body, extra headers, withCredentials 8633 * attribute, user, password. 8634 * <BR /><B>EXPERIMENTAL</B> 8635 * 8636 * @param requestId Identifier of XHR to replay. 8637 * 8638 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 8639 * {@link Ret0}></CODE> 8640 * 8641 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 8642 * browser receives the invocation-request. 8643 * 8644 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 8645 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 8646 * {@code >} to ensure the Browser Function has run to completion. 8647 */ 8648 public static Script<String, JsonObject, Ret0> replayXHR(String requestId) 8649 { 8650 // Exception-Check(s) to ensure that if any parameters which are not declared as 8651 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 8652 8653 if (requestId == null) THROWS.throwNPE("requestId"); 8654 8655 final int webSocketID = 30019000 + counter++; 8656 final boolean[] optionals = { false, }; 8657 8658 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 8659 String requestJSON = WriteJSON.get( 8660 parameterTypes.get("replayXHR"), 8661 parameterNames.get("replayXHR"), 8662 optionals, webSocketID, 8663 "Network.replayXHR", 8664 requestId 8665 ); 8666 8667 // This Remote Command does not have a Return-Value. 8668 return new Script<> 8669 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 8670 } 8671 8672 /** 8673 * Searches for given string in response content. 8674 * <BR /><B>EXPERIMENTAL</B> 8675 * 8676 * @param requestId Identifier of the network response to search. 8677 * 8678 * @param query String to search for. 8679 * 8680 * @param caseSensitive If true, search is case sensitive. 8681 * <BR /><B>OPTIONAL</B> 8682 * 8683 * @param isRegex If true, treats string parameter as regex. 8684 * <BR /><B>OPTIONAL</B> 8685 * 8686 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 8687 * {@link Debugger.SearchMatch}[]></CODE> 8688 * 8689 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 8690 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 8691 * {@link Debugger.SearchMatch}[]></CODE> will be returned. 8692 * 8693 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 8694 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 8695 * may be retrieved.</I> 8696 * 8697 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 8698 * <BR /><BR /><UL CLASS=JDUL> 8699 * <LI><CODE>{@link Debugger.SearchMatch}[] (<B>result</B></CODE>) 8700 * <BR />List of search matches. 8701 * </LI> 8702 * </UL> */ 8703 public static Script<String, JsonObject, Debugger.SearchMatch[]> searchInResponseBody 8704 (String requestId, String query, Boolean caseSensitive, Boolean isRegex) 8705 { 8706 // Exception-Check(s) to ensure that if any parameters which are not declared as 8707 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 8708 8709 if (requestId == null) THROWS.throwNPE("requestId"); 8710 if (query == null) THROWS.throwNPE("query"); 8711 8712 final int webSocketID = 30020000 + counter++; 8713 final boolean[] optionals = { false, false, true, true, }; 8714 8715 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 8716 String requestJSON = WriteJSON.get( 8717 parameterTypes.get("searchInResponseBody"), 8718 parameterNames.get("searchInResponseBody"), 8719 optionals, webSocketID, 8720 "Network.searchInResponseBody", 8721 requestId, query, caseSensitive, isRegex 8722 ); 8723 8724 // 'JSON Binding' ... Converts Browser Response-JSON to 'Debugger.SearchMatch[]' 8725 Function<JsonObject, Debugger.SearchMatch[]> responseProcessor = (JsonObject jo) -> 8726 (jo.getJsonArray("result") == null) 8727 ? null 8728 : RJArrIntoStream.objArr(jo.getJsonArray("result"), null, 0, Debugger.SearchMatch.class).toArray(Debugger.SearchMatch[]::new); 8729 8730 return new Script<>(webSocketID, requestJSON, responseProcessor); 8731 } 8732 8733 /** 8734 * Blocks URLs from loading. 8735 * <BR /><B>EXPERIMENTAL</B> 8736 * 8737 * @param urls URL patterns to block. Wildcards ('*') are allowed. 8738 * 8739 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 8740 * {@link Ret0}></CODE> 8741 * 8742 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 8743 * browser receives the invocation-request. 8744 * 8745 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 8746 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 8747 * {@code >} to ensure the Browser Function has run to completion. 8748 */ 8749 public static Script<String, JsonObject, Ret0> setBlockedURLs(String[] urls) 8750 { 8751 // Exception-Check(s) to ensure that if any parameters which are not declared as 8752 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 8753 8754 if (urls == null) THROWS.throwNPE("urls"); 8755 8756 final int webSocketID = 30021000 + counter++; 8757 final boolean[] optionals = { false, }; 8758 8759 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 8760 String requestJSON = WriteJSON.get( 8761 parameterTypes.get("setBlockedURLs"), 8762 parameterNames.get("setBlockedURLs"), 8763 optionals, webSocketID, 8764 "Network.setBlockedURLs", 8765 (Object) urls 8766 ); 8767 8768 // This Remote Command does not have a Return-Value. 8769 return new Script<> 8770 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 8771 } 8772 8773 /** 8774 * Toggles ignoring of service worker for each request. 8775 * <BR /><B>EXPERIMENTAL</B> 8776 * 8777 * @param bypass Bypass service worker and load from network. 8778 * 8779 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 8780 * {@link Ret0}></CODE> 8781 * 8782 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 8783 * browser receives the invocation-request. 8784 * 8785 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 8786 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 8787 * {@code >} to ensure the Browser Function has run to completion. 8788 */ 8789 public static Script<String, JsonObject, Ret0> setBypassServiceWorker(boolean bypass) 8790 { 8791 final int webSocketID = 30022000 + counter++; 8792 final boolean[] optionals = { false, }; 8793 8794 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 8795 String requestJSON = WriteJSON.get( 8796 parameterTypes.get("setBypassServiceWorker"), 8797 parameterNames.get("setBypassServiceWorker"), 8798 optionals, webSocketID, 8799 "Network.setBypassServiceWorker", 8800 bypass 8801 ); 8802 8803 // This Remote Command does not have a Return-Value. 8804 return new Script<> 8805 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 8806 } 8807 8808 /** 8809 * Toggles ignoring cache for each request. If <CODE>true</CODE>, cache will not be used. 8810 * 8811 * @param cacheDisabled Cache disabled state. 8812 * 8813 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 8814 * {@link Ret0}></CODE> 8815 * 8816 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 8817 * browser receives the invocation-request. 8818 * 8819 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 8820 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 8821 * {@code >} to ensure the Browser Function has run to completion. 8822 */ 8823 public static Script<String, JsonObject, Ret0> setCacheDisabled(boolean cacheDisabled) 8824 { 8825 final int webSocketID = 30023000 + counter++; 8826 final boolean[] optionals = { false, }; 8827 8828 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 8829 String requestJSON = WriteJSON.get( 8830 parameterTypes.get("setCacheDisabled"), 8831 parameterNames.get("setCacheDisabled"), 8832 optionals, webSocketID, 8833 "Network.setCacheDisabled", 8834 cacheDisabled 8835 ); 8836 8837 // This Remote Command does not have a Return-Value. 8838 return new Script<> 8839 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 8840 } 8841 8842 /** 8843 * Sets a cookie with the given cookie data; may overwrite equivalent cookies if they exist. 8844 * 8845 * @param name Cookie name. 8846 * 8847 * @param value Cookie value. 8848 * 8849 * @param url 8850 * The request-URI to associate with the setting of the cookie. This value can affect the 8851 * default domain, path, source port, and source scheme values of the created cookie. 8852 * <BR /><B>OPTIONAL</B> 8853 * 8854 * @param domain Cookie domain. 8855 * <BR /><B>OPTIONAL</B> 8856 * 8857 * @param path Cookie path. 8858 * <BR /><B>OPTIONAL</B> 8859 * 8860 * @param secure True if cookie is secure. 8861 * <BR /><B>OPTIONAL</B> 8862 * 8863 * @param httpOnly True if cookie is http-only. 8864 * <BR /><B>OPTIONAL</B> 8865 * 8866 * @param sameSite Cookie SameSite type. 8867 * <BR /><B>OPTIONAL</B> 8868 * 8869 * @param expires Cookie expiration date, session cookie if not set 8870 * <BR /><B>OPTIONAL</B> 8871 * 8872 * @param priority Cookie Priority type. 8873 * <BR /><B>OPTIONAL</B> 8874 * <BR /><B>EXPERIMENTAL</B> 8875 * 8876 * @param sameParty True if cookie is SameParty. 8877 * <BR /><B>OPTIONAL</B> 8878 * <BR /><B>EXPERIMENTAL</B> 8879 * 8880 * @param sourceScheme Cookie source scheme type. 8881 * <BR /><B>OPTIONAL</B> 8882 * <BR /><B>EXPERIMENTAL</B> 8883 * 8884 * @param sourcePort 8885 * Cookie source port. Valid values are {-1, [1, 65535]}, -1 indicates an unspecified port. 8886 * An unspecified port value allows protocol clients to emulate legacy cookie scope for the port. 8887 * This is a temporary ability and it will be removed in the future. 8888 * <BR /><B>OPTIONAL</B> 8889 * <BR /><B>EXPERIMENTAL</B> 8890 * 8891 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 8892 * Boolean></CODE> 8893 * 8894 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 8895 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 8896 * Boolean></CODE> will be returned. 8897 * 8898 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 8899 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 8900 * may be retrieved.</I> 8901 * 8902 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 8903 * <BR /><BR /><UL CLASS=JDUL> 8904 * <LI><CODE>Boolean (<B>success</B></CODE>) 8905 * <BR />Always set to true. If an error occurs, the response indicates protocol error. 8906 * </LI> 8907 * </UL> */ 8908 public static Script<String, JsonObject, Boolean> setCookie( 8909 String name, String value, String url, String domain, String path, Boolean secure, 8910 Boolean httpOnly, String sameSite, Number expires, String priority, Boolean sameParty, 8911 String sourceScheme, Integer sourcePort 8912 ) 8913 { 8914 // Exception-Check(s) to ensure that if any parameters which are not declared as 8915 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 8916 8917 if (name == null) THROWS.throwNPE("name"); 8918 if (value == null) THROWS.throwNPE("value"); 8919 8920 // Exception-Check(s) to ensure that if any parameters which must adhere to a 8921 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 8922 8923 THROWS.checkIAE("sameSite", sameSite, "Network.CookieSameSite", Network.CookieSameSite); 8924 THROWS.checkIAE("priority", priority, "Network.CookiePriority", Network.CookiePriority); 8925 THROWS.checkIAE("sourceScheme", sourceScheme, "Network.CookieSourceScheme", Network.CookieSourceScheme); 8926 8927 final int webSocketID = 30024000 + counter++; 8928 final boolean[] optionals = { false, false, true, true, true, true, true, true, true, true, true, true, true, }; 8929 8930 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 8931 String requestJSON = WriteJSON.get( 8932 parameterTypes.get("setCookie"), 8933 parameterNames.get("setCookie"), 8934 optionals, webSocketID, 8935 "Network.setCookie", 8936 name, value, url, domain, path, secure, httpOnly, sameSite, expires, priority, 8937 sameParty, sourceScheme, sourcePort 8938 ); 8939 8940 // 'JSON Binding' ... Converts Browser Response-JSON to 'Boolean' 8941 Function<JsonObject, Boolean> responseProcessor = (JsonObject jo) -> 8942 ReadPrimJSON.getBoolean(jo, "success"); 8943 8944 return new Script<>(webSocketID, requestJSON, responseProcessor); 8945 } 8946 8947 /** 8948 * Sets given cookies. 8949 * 8950 * @param cookies Cookies to be set. 8951 * 8952 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 8953 * {@link Ret0}></CODE> 8954 * 8955 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 8956 * browser receives the invocation-request. 8957 * 8958 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 8959 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 8960 * {@code >} to ensure the Browser Function has run to completion. 8961 */ 8962 public static Script<String, JsonObject, Ret0> setCookies(Network.CookieParam[] cookies) 8963 { 8964 // Exception-Check(s) to ensure that if any parameters which are not declared as 8965 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 8966 8967 if (cookies == null) THROWS.throwNPE("cookies"); 8968 8969 final int webSocketID = 30025000 + counter++; 8970 final boolean[] optionals = { false, }; 8971 8972 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 8973 String requestJSON = WriteJSON.get( 8974 parameterTypes.get("setCookies"), 8975 parameterNames.get("setCookies"), 8976 optionals, webSocketID, 8977 "Network.setCookies", 8978 (Object) cookies 8979 ); 8980 8981 // This Remote Command does not have a Return-Value. 8982 return new Script<> 8983 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 8984 } 8985 8986 /** 8987 * Specifies whether to always send extra HTTP headers with the requests from this page. 8988 * 8989 * @param headers Map with extra HTTP headers. 8990 * 8991 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 8992 * {@link Ret0}></CODE> 8993 * 8994 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 8995 * browser receives the invocation-request. 8996 * 8997 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 8998 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 8999 * {@code >} to ensure the Browser Function has run to completion. 9000 */ 9001 public static Script<String, JsonObject, Ret0> setExtraHTTPHeaders(JsonObject headers) 9002 { 9003 // Exception-Check(s) to ensure that if any parameters which are not declared as 9004 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 9005 9006 if (headers == null) THROWS.throwNPE("headers"); 9007 9008 final int webSocketID = 30026000 + counter++; 9009 final boolean[] optionals = { false, }; 9010 9011 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 9012 String requestJSON = WriteJSON.get( 9013 parameterTypes.get("setExtraHTTPHeaders"), 9014 parameterNames.get("setExtraHTTPHeaders"), 9015 optionals, webSocketID, 9016 "Network.setExtraHTTPHeaders", 9017 headers 9018 ); 9019 9020 // This Remote Command does not have a Return-Value. 9021 return new Script<> 9022 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 9023 } 9024 9025 /** 9026 * Specifies whether to attach a page script stack id in requests 9027 * <BR /><B>EXPERIMENTAL</B> 9028 * 9029 * @param enabled Whether to attach a page script stack for debugging purpose. 9030 * 9031 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 9032 * {@link Ret0}></CODE> 9033 * 9034 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 9035 * browser receives the invocation-request. 9036 * 9037 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 9038 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 9039 * {@code >} to ensure the Browser Function has run to completion. 9040 */ 9041 public static Script<String, JsonObject, Ret0> setAttachDebugStack(boolean enabled) 9042 { 9043 final int webSocketID = 30027000 + counter++; 9044 final boolean[] optionals = { false, }; 9045 9046 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 9047 String requestJSON = WriteJSON.get( 9048 parameterTypes.get("setAttachDebugStack"), 9049 parameterNames.get("setAttachDebugStack"), 9050 optionals, webSocketID, 9051 "Network.setAttachDebugStack", 9052 enabled 9053 ); 9054 9055 // This Remote Command does not have a Return-Value. 9056 return new Script<> 9057 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 9058 } 9059 9060 /** 9061 * Sets the requests to intercept that match the provided patterns and optionally resource types. 9062 * Deprecated, please use Fetch.enable instead. 9063 * <BR /><B>EXPERIMENTAL</B> 9064 * <BR /><B>DEPRECATED</B> 9065 * 9066 * @param patterns 9067 * Requests matching any of these patterns will be forwarded and wait for the corresponding 9068 * continueInterceptedRequest call. 9069 * 9070 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 9071 * {@link Ret0}></CODE> 9072 * 9073 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 9074 * browser receives the invocation-request. 9075 * 9076 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 9077 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 9078 * {@code >} to ensure the Browser Function has run to completion. 9079 */ 9080 public static Script<String, JsonObject, Ret0> setRequestInterception 9081 (Network.RequestPattern[] patterns) 9082 { 9083 // Exception-Check(s) to ensure that if any parameters which are not declared as 9084 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 9085 9086 if (patterns == null) THROWS.throwNPE("patterns"); 9087 9088 final int webSocketID = 30028000 + counter++; 9089 final boolean[] optionals = { false, }; 9090 9091 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 9092 String requestJSON = WriteJSON.get( 9093 parameterTypes.get("setRequestInterception"), 9094 parameterNames.get("setRequestInterception"), 9095 optionals, webSocketID, 9096 "Network.setRequestInterception", 9097 (Object) patterns 9098 ); 9099 9100 // This Remote Command does not have a Return-Value. 9101 return new Script<> 9102 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 9103 } 9104 9105 /** 9106 * Allows overriding user agent with the given string. 9107 * 9108 * @param userAgent User agent to use. 9109 * 9110 * @param acceptLanguage Browser langugage to emulate. 9111 * <BR /><B>OPTIONAL</B> 9112 * 9113 * @param platform The platform navigator.platform should return. 9114 * <BR /><B>OPTIONAL</B> 9115 * 9116 * @param userAgentMetadata To be sent in Sec-CH-UA-* headers and returned in navigator.userAgentData 9117 * <BR /><B>OPTIONAL</B> 9118 * <BR /><B>EXPERIMENTAL</B> 9119 * 9120 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 9121 * {@link Ret0}></CODE> 9122 * 9123 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 9124 * browser receives the invocation-request. 9125 * 9126 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 9127 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 9128 * {@code >} to ensure the Browser Function has run to completion. 9129 */ 9130 public static Script<String, JsonObject, Ret0> setUserAgentOverride( 9131 String userAgent, String acceptLanguage, String platform, 9132 Emulation.UserAgentMetadata userAgentMetadata 9133 ) 9134 { 9135 // Exception-Check(s) to ensure that if any parameters which are not declared as 9136 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 9137 9138 if (userAgent == null) THROWS.throwNPE("userAgent"); 9139 9140 final int webSocketID = 30029000 + counter++; 9141 final boolean[] optionals = { false, true, true, true, }; 9142 9143 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 9144 String requestJSON = WriteJSON.get( 9145 parameterTypes.get("setUserAgentOverride"), 9146 parameterNames.get("setUserAgentOverride"), 9147 optionals, webSocketID, 9148 "Network.setUserAgentOverride", 9149 userAgent, acceptLanguage, platform, userAgentMetadata 9150 ); 9151 9152 // This Remote Command does not have a Return-Value. 9153 return new Script<> 9154 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 9155 } 9156 9157 /** 9158 * Returns information about the COEP/COOP isolation status. 9159 * <BR /><B>EXPERIMENTAL</B> 9160 * 9161 * @param frameId If no frameId is provided, the status of the target is provided. 9162 * <BR /><B>OPTIONAL</B> 9163 * 9164 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 9165 * {@link Network.SecurityIsolationStatus}></CODE> 9166 * 9167 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 9168 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 9169 * {@link Network.SecurityIsolationStatus}></CODE> will be returned. 9170 * 9171 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 9172 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 9173 * may be retrieved.</I> 9174 * 9175 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 9176 * <BR /><BR /><UL CLASS=JDUL> 9177 * <LI><CODE>{@link Network.SecurityIsolationStatus} (<B>status</B></CODE>) 9178 * <BR />- 9179 * </LI> 9180 * </UL> */ 9181 public static Script<String, JsonObject, Network.SecurityIsolationStatus> getSecurityIsolationStatus 9182 (String frameId) 9183 { 9184 final int webSocketID = 30030000 + counter++; 9185 final boolean[] optionals = { true, }; 9186 9187 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 9188 String requestJSON = WriteJSON.get( 9189 parameterTypes.get("getSecurityIsolationStatus"), 9190 parameterNames.get("getSecurityIsolationStatus"), 9191 optionals, webSocketID, 9192 "Network.getSecurityIsolationStatus", 9193 frameId 9194 ); 9195 9196 // 'JSON Binding' ... Converts Browser Response-JSON to 'Network.SecurityIsolationStatus' 9197 Function<JsonObject, Network.SecurityIsolationStatus> responseProcessor = (JsonObject jo) -> 9198 ReadJSON.getObject(jo, "status", Network.SecurityIsolationStatus.class, false, true); 9199 9200 return new Script<>(webSocketID, requestJSON, responseProcessor); 9201 } 9202 9203 /** 9204 * Enables tracking for the Reporting API, events generated by the Reporting API will now be delivered to the client. 9205 * Enabling triggers 'reportingApiReportAdded' for all existing reports. 9206 * <BR /><B>EXPERIMENTAL</B> 9207 * 9208 * @param enable Whether to enable or disable events for the Reporting API 9209 * 9210 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 9211 * {@link Ret0}></CODE> 9212 * 9213 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 9214 * browser receives the invocation-request. 9215 * 9216 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 9217 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 9218 * {@code >} to ensure the Browser Function has run to completion. 9219 */ 9220 public static Script<String, JsonObject, Ret0> enableReportingApi(boolean enable) 9221 { 9222 final int webSocketID = 30031000 + counter++; 9223 final boolean[] optionals = { false, }; 9224 9225 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 9226 String requestJSON = WriteJSON.get( 9227 parameterTypes.get("enableReportingApi"), 9228 parameterNames.get("enableReportingApi"), 9229 optionals, webSocketID, 9230 "Network.enableReportingApi", 9231 enable 9232 ); 9233 9234 // This Remote Command does not have a Return-Value. 9235 return new Script<> 9236 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 9237 } 9238 9239 /** 9240 * Fetches the resource and returns the content. 9241 * <BR /><B>EXPERIMENTAL</B> 9242 * 9243 * @param frameId 9244 * Frame id to get the resource for. Mandatory for frame targets, and 9245 * should be omitted for worker targets. 9246 * <BR /><B>OPTIONAL</B> 9247 * 9248 * @param url URL of the resource to get content for. 9249 * 9250 * @param options Options for the request. 9251 * 9252 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 9253 * {@link Network.LoadNetworkResourcePageResult}></CODE> 9254 * 9255 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 9256 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 9257 * {@link Network.LoadNetworkResourcePageResult}></CODE> will be returned. 9258 * 9259 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 9260 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 9261 * may be retrieved.</I> 9262 * 9263 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 9264 * <BR /><BR /><UL CLASS=JDUL> 9265 * <LI><CODE>{@link Network.LoadNetworkResourcePageResult} (<B>resource</B></CODE>) 9266 * <BR />- 9267 * </LI> 9268 * </UL> */ 9269 public static Script<String, JsonObject, Network.LoadNetworkResourcePageResult> loadNetworkResource 9270 (String frameId, String url, Network.LoadNetworkResourceOptions options) 9271 { 9272 // Exception-Check(s) to ensure that if any parameters which are not declared as 9273 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 9274 9275 if (url == null) THROWS.throwNPE("url"); 9276 if (options == null) THROWS.throwNPE("options"); 9277 9278 final int webSocketID = 30032000 + counter++; 9279 final boolean[] optionals = { true, false, false, }; 9280 9281 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 9282 String requestJSON = WriteJSON.get( 9283 parameterTypes.get("loadNetworkResource"), 9284 parameterNames.get("loadNetworkResource"), 9285 optionals, webSocketID, 9286 "Network.loadNetworkResource", 9287 frameId, url, options 9288 ); 9289 9290 // 'JSON Binding' ... Converts Browser Response-JSON to 'Network.LoadNetworkResourcePageResult' 9291 Function<JsonObject, Network.LoadNetworkResourcePageResult> responseProcessor = (JsonObject jo) -> 9292 ReadJSON.getObject(jo, "resource", Network.LoadNetworkResourcePageResult.class, false, true); 9293 9294 return new Script<>(webSocketID, requestJSON, responseProcessor); 9295 } 9296 9297}