Class SecurityOrigin
- All Implemented Interfaces:
Proxy
WebKitSecurityOrigin is a representation of a security domain
defined by websites. A security origin consists of a protocol, a
hostname, and an optional port number.
Resources with the same security origin can generally access each
other for client-side scripting or database access. When comparing
origins, beware that if both protocol and host are null, the origins
should not be treated as equal.
- Since:
- 2.16
-
Constructor Summary
ConstructorsConstructorDescriptionSecurityOrigin(MemorySegment address) Create a SecurityOrigin proxy instance for the provided memory address.SecurityOrigin(String protocol, String host, short port) Create a new security origin from the provided protocol, host and port. -
Method Summary
Modifier and TypeMethodDescriptionstatic SecurityOriginCreate a new security origin from the provided.@Nullable StringgetHost()Gets the hostname oforigin.shortgetPort()Gets the port oforigin.@Nullable StringGets the protocol oforigin.static @Nullable TypegetType()Get the GType of the SecurityOrigin classref()Atomically increments the reference count of this SecurityOrigin by one.@Nullable StringtoString()Gets a string representation oforigin.voidunref()Atomically decrements the reference count of this SecurityOrigin by one.Methods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
SecurityOrigin
Create a SecurityOrigin proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
SecurityOrigin
Create a new security origin from the provided protocol, host and port.- Parameters:
protocol- The protocol for the new originhost- The host for the new originport- The port number for the new origin, or 0 to indicate the default port forprotocol- Since:
- 2.16
-
-
Method Details
-
getType
-
forUri
Create a new security origin from the provided.Create a new security origin from the provided URI. Components of
uriother than protocol, host, and port do not affect the createdWebKitSecurityOrigin.- Parameters:
uri- The URI for the new origin- Returns:
- A
WebKitSecurityOrigin. - Since:
- 2.16
-
getHost
Gets the hostname oforigin.It is reasonable for this to be
nullif its protocol does not require a host component.- Returns:
- The host of the
WebKitSecurityOrigin - Since:
- 2.16
-
getPort
public short getPort()Gets the port oforigin.This function will always return 0 if the port is the default port for the given protocol. For example, http://example.com has the same security origin as http://example.com:80, and this function will return 0 for a
WebKitSecurityOriginconstructed from either URI.- Returns:
- The port of the
WebKitSecurityOrigin. - Since:
- 2.16
-
getProtocol
Gets the protocol oforigin.- Returns:
- The protocol of the
WebKitSecurityOrigin - Since:
- 2.16
-
ref
Atomically increments the reference count of this SecurityOrigin by one.This function is MT-safe and may be called from any thread.
- Returns:
- The passed
WebKitSecurityOrigin - Since:
- 2.16
-
toString
-
unref
public void unref()Atomically decrements the reference count of this SecurityOrigin by one.If the reference count drops to 0, all memory allocated by
WebKitSecurityOriginis released. This function is MT-safe and may be called from any thread.- Since:
- 2.16
-