Class SecurityOrigin

java.lang.Object
org.javagi.base.ProxyInstance
org.webkitgtk.SecurityOrigin
All Implemented Interfaces:
Proxy

@Generated("org.javagi.JavaGI") public class SecurityOrigin extends ProxyInstance

A security boundary for websites.

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 Details

    • SecurityOrigin

      public SecurityOrigin(MemorySegment address)
      Create a SecurityOrigin proxy instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • SecurityOrigin

      public SecurityOrigin(String protocol, String host, short port)
      Create a new security origin from the provided protocol, host and port.
      Parameters:
      protocol - The protocol for the new origin
      host - The host for the new origin
      port - The port number for the new origin, or 0 to indicate the default port for protocol
      Since:
      2.16
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the SecurityOrigin class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • forUri

      public static SecurityOrigin forUri(String uri)

      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 created WebKitSecurityOrigin.

      Parameters:
      uri - The URI for the new origin
      Returns:
      A WebKitSecurityOrigin.
      Since:
      2.16
    • getHost

      public @Nullable String getHost()

      Gets the hostname of origin.

      It is reasonable for this to be null if its protocol does not require a host component.

      Returns:
      The host of the WebKitSecurityOrigin
      Since:
      2.16
    • getPort

      public short getPort()

      Gets the port of origin.

      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.
      Since:
      2.16
    • getProtocol

      public @Nullable String getProtocol()
      Gets the protocol of origin.
      Returns:
      The protocol of the WebKitSecurityOrigin
      Since:
      2.16
    • ref

      public SecurityOrigin 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

      public @Nullable String toString()

      Gets a string representation of origin.

      The string representation is a valid URI with only protocol, host, and port components, or null.

      Overrides:
      toString in class Object
      Returns:
      a URI representing origin.
      Since:
      2.16
    • 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.

      Since:
      2.16