Class Server.Builder<B extends Server.Builder<B>>

Type Parameters:
B - the type of the Builder that is returned
All Implemented Interfaces:
BuilderInterface
Enclosing class:
Server

public static class Server.Builder<B extends Server.Builder<B>> extends GObject.Builder<B>
Inner class implementing a builder pattern to construct a GObject with properties.
  • Constructor Details

    • Builder

      protected Builder()
      Default constructor for a Builder object.
  • Method Details

    • build

      public Server build()
      Finish building the Server object. This will call GObject.withProperties(Type, String[], Value[]) to create a new GObject instance, which is then cast to Server.
      Overrides:
      build in class GObject.Builder<B extends Server.Builder<B>>
      Returns:
      a new instance of Server with the properties that were set in the Builder object.
    • setRawPaths

      public B setRawPaths(boolean rawPaths)
      If true, percent-encoding in the Request-URI path will not be automatically decoded.
      Parameters:
      rawPaths - the value for the raw-paths property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setServerHeader

      public B setServerHeader(String serverHeader)

      Server header.

      If non-null, the value to use for the "Server" header on ServerMessages processed by this server.

      The Server header is the server equivalent of the User-Agent header, and provides information about the server and its components. It contains a list of one or more product tokens, separated by whitespace, with the most significant product token coming first. The tokens must be brief, ASCII, and mostly alphanumeric (although "-", "_", and "." are also allowed), and may optionally include a "/" followed by a version string. You may also put comments, enclosed in parentheses, between or after the tokens.

      Some HTTP server implementations intentionally do not use version numbers in their Server header, so that installations running older versions of the server don't end up advertising their vulnerability to specific security holes.

      As with Session:user_agent, if you set a Server:server-header property that has trailing whitespace, Server will append its own product token (eg, libsoup/2.3.2) to the end of the header for you.

      Parameters:
      serverHeader - the value for the server-header property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setTlsAuthMode

      public B setTlsAuthMode(TlsAuthenticationMode tlsAuthMode)
      A Gio.TlsAuthenticationMode for SSL/TLS client authentication.
      Parameters:
      tlsAuthMode - the value for the tls-auth-mode property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setTlsCertificate

      public B setTlsCertificate(TlsCertificate tlsCertificate)

      A org.gnome.gio.TlsCertificate[ that has a Gio.TlsCertificate:private-key set.

      If this is set, then the server will be able to speak https in addition to (or instead of) plain http.

      Parameters:
      tlsCertificate - the value for the tls-certificate property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setTlsDatabase

      public B setTlsDatabase(TlsDatabase tlsDatabase)
      A TlsDatabase to use for validating SSL/TLS client certificates.
      Parameters:
      tlsDatabase - the value for the tls-database property
      Returns:
      the Builder instance is returned, to allow method chaining
    • onRequestAborted

      public B onRequestAborted(Server.RequestAbortedCallback handler)

      Emitted when processing has failed for a message.

      This could mean either that it could not be read (if Server::request-read has not been emitted for it yet), or that the response could not be written back (if Server::request-read has been emitted but Server::request-finished has not been).

      message is in an undefined state when this signal is emitted; the signal exists primarily to allow the server to free any state that it may have allocated in Server::request-started.

      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      See Also:
    • onRequestFinished

      public B onRequestFinished(Server.RequestFinishedCallback handler)
      Emitted when the server has finished writing a response to a request.
      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      See Also:
    • onRequestRead

      public B onRequestRead(Server.RequestReadCallback handler)

      Emitted when the server has successfully read a request.

      message will have all of its request-side information filled in, and if the message was authenticated, client will have information about that. This signal is emitted before any (non-early) handlers are called for the message, and if it sets the message's status_code, then normal handler processing will be skipped.

      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      See Also:
    • onRequestStarted

      public B onRequestStarted(Server.RequestStartedCallback handler)

      Emitted when the server has started reading a new request.

      message will be completely blank; not even the Request-Line will have been read yet. About the only thing you can usefully do with it is connect to its signals.

      If the request is read successfully, this will eventually be followed by a Server::request_read signal. If a response is then sent, the request processing will end with a Server::request-finished signal. If a network error occurs, the processing will instead end with Server::request-aborted.

      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      See Also: