Class URISchemeResponse

All Implemented Interfaces:
Proxy

@Generated("org.javagi.JavaGI") public final class URISchemeResponse extends GObject

Represents a URI scheme response.

If you register a particular URI scheme in a WebKitWebContext, using webkit_web_context_register_uri_scheme(), you have to provide a WebKitURISchemeRequestCallback. After that, when a URI response is made with that particular scheme, your callback will be called. There you will be able to provide more response parameters when the methods and properties of a WebKitURISchemeRequest is not enough.

When you finished setting up your WebKitURISchemeResponse, call webkit_uri_request_finish_with_response() with it to return the response.

  • Constructor Details

    • URISchemeResponse

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

      public URISchemeResponse(InputStream inputStream, long streamLength)
      Create a new WebKitURISchemeResponse
      Parameters:
      inputStream - a GInputStream to read the contents of the request
      streamLength - the length of the stream or -1 if not known
      Since:
      2.36
    • URISchemeResponse

      public URISchemeResponse()
      Create a new URISchemeResponse.
  • Method Details

    • getType

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

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

      protected URISchemeResponse asParent()
      Return this instance as if it were its parent type. Comparable to the Java super keyword, but ensures the parent typeclass is also used in native code.
      Overrides:
      asParent in class GObject
      Returns:
      the instance as if it were its parent type
    • setContentType

      public void setContentType(String contentType)
      Sets the content type for the this URISchemeResponse
      Parameters:
      contentType - the content type of the stream
      Since:
      2.36
    • setHttpHeaders

      public void setHttpHeaders(MessageHeaders headers)

      Assign the provided SoupMessageHeaders to the response.

      headers need to be of the type MessageHeadersType.RESPONSE. Any existing headers will be overwritten.

      Parameters:
      headers - the HTTP headers to be set
      Since:
      2.36
    • setStatus

      public void setStatus(int statusCode, @Nullable String reasonPhrase)

      Sets the status code and reason phrase for the response.

      If statusCode is a known value and reasonPhrase is null, the reasonPhrase will be set automatically.

      Parameters:
      statusCode - the HTTP status code to be returned
      reasonPhrase - a reason phrase
      Since:
      2.36
    • builder

      public static URISchemeResponse.Builder<? extends URISchemeResponse.Builder> builder()
      A URISchemeResponse.Builder object constructs a URISchemeResponse with the specified properties. Use the various set...() methods to set properties, and finish construction with URISchemeResponse.Builder.build().
      Returns:
      the builder object