org.openqa.selenium.devtools.v90.network.model.CookieParam Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of selenium-devtools-v90 Show documentation
Show all versions of selenium-devtools-v90 Show documentation
Selenium automates browsers. That's it! What you do with that power is entirely up to you.
package org.openqa.selenium.devtools.v90.network.model;
import org.openqa.selenium.Beta;
import org.openqa.selenium.json.JsonInput;
/**
* Cookie parameter object
*/
public class CookieParam {
private final java.lang.String name;
private final java.lang.String value;
private final java.util.Optional url;
private final java.util.Optional domain;
private final java.util.Optional path;
private final java.util.Optional secure;
private final java.util.Optional httpOnly;
private final java.util.Optional sameSite;
private final java.util.Optional expires;
private final java.util.Optional priority;
private final java.util.Optional sameParty;
private final java.util.Optional sourceScheme;
private final java.util.Optional sourcePort;
public CookieParam(java.lang.String name, java.lang.String value, java.util.Optional url, java.util.Optional domain, java.util.Optional path, java.util.Optional secure, java.util.Optional httpOnly, java.util.Optional sameSite, java.util.Optional expires, java.util.Optional priority, java.util.Optional sameParty, java.util.Optional sourceScheme, java.util.Optional sourcePort) {
this.name = java.util.Objects.requireNonNull(name, "name is required");
this.value = java.util.Objects.requireNonNull(value, "value is required");
this.url = url;
this.domain = domain;
this.path = path;
this.secure = secure;
this.httpOnly = httpOnly;
this.sameSite = sameSite;
this.expires = expires;
this.priority = priority;
this.sameParty = sameParty;
this.sourceScheme = sourceScheme;
this.sourcePort = sourcePort;
}
/**
* Cookie name.
*/
public java.lang.String getName() {
return name;
}
/**
* Cookie value.
*/
public java.lang.String getValue() {
return value;
}
/**
* The request-URI to associate with the setting of the cookie. This value can affect the
* default domain, path, source port, and source scheme values of the created cookie.
*/
public java.util.Optional getUrl() {
return url;
}
/**
* Cookie domain.
*/
public java.util.Optional getDomain() {
return domain;
}
/**
* Cookie path.
*/
public java.util.Optional getPath() {
return path;
}
/**
* True if cookie is secure.
*/
public java.util.Optional getSecure() {
return secure;
}
/**
* True if cookie is http-only.
*/
public java.util.Optional getHttpOnly() {
return httpOnly;
}
/**
* Cookie SameSite type.
*/
public java.util.Optional getSameSite() {
return sameSite;
}
/**
* Cookie expiration date, session cookie if not set
*/
public java.util.Optional getExpires() {
return expires;
}
/**
* Cookie Priority.
*/
@Beta()
public java.util.Optional getPriority() {
return priority;
}
/**
* True if cookie is SameParty.
*/
@Beta()
public java.util.Optional getSameParty() {
return sameParty;
}
/**
* Cookie source scheme type.
*/
@Beta()
public java.util.Optional getSourceScheme() {
return sourceScheme;
}
/**
* Cookie source port. Valid values are {-1, [1, 65535]}, -1 indicates an unspecified port.
* An unspecified port value allows protocol clients to emulate legacy cookie scope for the port.
* This is a temporary ability and it will be removed in the future.
*/
@Beta()
public java.util.Optional getSourcePort() {
return sourcePort;
}
private static CookieParam fromJson(JsonInput input) {
java.lang.String name = null;
java.lang.String value = null;
java.util.Optional url = java.util.Optional.empty();
java.util.Optional domain = java.util.Optional.empty();
java.util.Optional path = java.util.Optional.empty();
java.util.Optional secure = java.util.Optional.empty();
java.util.Optional httpOnly = java.util.Optional.empty();
java.util.Optional sameSite = java.util.Optional.empty();
java.util.Optional expires = java.util.Optional.empty();
java.util.Optional priority = java.util.Optional.empty();
java.util.Optional sameParty = java.util.Optional.empty();
java.util.Optional sourceScheme = java.util.Optional.empty();
java.util.Optional sourcePort = java.util.Optional.empty();
input.beginObject();
while (input.hasNext()) {
switch(input.nextName()) {
case "name":
name = input.nextString();
break;
case "value":
value = input.nextString();
break;
case "url":
url = java.util.Optional.ofNullable(input.nextString());
break;
case "domain":
domain = java.util.Optional.ofNullable(input.nextString());
break;
case "path":
path = java.util.Optional.ofNullable(input.nextString());
break;
case "secure":
secure = java.util.Optional.ofNullable(input.nextBoolean());
break;
case "httpOnly":
httpOnly = java.util.Optional.ofNullable(input.nextBoolean());
break;
case "sameSite":
sameSite = java.util.Optional.ofNullable(input.read(org.openqa.selenium.devtools.v90.network.model.CookieSameSite.class));
break;
case "expires":
expires = java.util.Optional.ofNullable(input.read(org.openqa.selenium.devtools.v90.network.model.TimeSinceEpoch.class));
break;
case "priority":
priority = java.util.Optional.ofNullable(input.read(org.openqa.selenium.devtools.v90.network.model.CookiePriority.class));
break;
case "sameParty":
sameParty = java.util.Optional.ofNullable(input.nextBoolean());
break;
case "sourceScheme":
sourceScheme = java.util.Optional.ofNullable(input.read(org.openqa.selenium.devtools.v90.network.model.CookieSourceScheme.class));
break;
case "sourcePort":
sourcePort = java.util.Optional.ofNullable(input.nextNumber().intValue());
break;
default:
input.skipValue();
break;
}
}
input.endObject();
return new CookieParam(name, value, url, domain, path, secure, httpOnly, sameSite, expires, priority, sameParty, sourceScheme, sourcePort);
}
}