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.
-
Constructor Summary
ConstructorDescriptionSecurityOrigin
(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 SecurityOrigin
Create a new security origin from the provided.getHost()
Gets the hostname of this SecurityOrigin.short
getPort()
Gets the port of this SecurityOrigin.Gets the protocol of this SecurityOrigin.static Type
getType()
Get the GType of the SecurityOrigin classref()
Atomically increments the reference count of this SecurityOrigin by one.toString()
Gets a string representation of this SecurityOrigin.void
unref()
Atomically decrements the reference count of this SecurityOrigin by one.Methods inherited from class io.github.jwharm.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
- Throws:
UnsupportedPlatformException
- when run on a platform other than linux
-
-
Method Details
-
getType
-
forUri
Create a new security origin from the provided.Create a new security origin from the provided URI. Components of
uri
other than protocol, host, and port do not affect the createdWebKitSecurityOrigin
.- Parameters:
uri
- The URI for the new origin- Returns:
- A
WebKitSecurityOrigin
. - Throws:
UnsupportedPlatformException
- when run on a platform other than linux
-
getHost
Gets the hostname of this SecurityOrigin.It is reasonable for this to be
null
if its protocol does not require a host component.- Returns:
- The host of the
WebKitSecurityOrigin
-
getPort
public short getPort()Gets the port of this SecurityOrigin.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
WebKitSecurityOrigin
constructed from either URI.- Returns:
- The port of the
WebKitSecurityOrigin
.
-
getProtocol
Gets the protocol of this SecurityOrigin.- Returns:
- The protocol of the
WebKitSecurityOrigin
-
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
-
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
WebKitSecurityOrigin
is released. This function is MT-safe and may be called from any thread.
-