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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Finish building theServer
object.Emitted when processing has failed for a message.Emitted when the server has finished writing a response to a request.onRequestRead
(Server.RequestReadCallback handler) Emitted when the server has successfully read a request.Emitted when the server has started reading a new request.setRawPaths
(boolean rawPaths) Iftrue
, percent-encoding in the Request-URI path will not be automatically decoded.setServerHeader
(String serverHeader) Server header.setTlsAuthMode
(TlsAuthenticationMode tlsAuthMode) AGio.TlsAuthenticationMode
for SSL/TLS client authentication.setTlsCertificate
(TlsCertificate tlsCertificate) Aorg.gnome.gio.TlsCertificate[
that has aGio.TlsCertificate:private-key
set.setTlsDatabase
(TlsDatabase tlsDatabase) ATlsDatabase
to use for validating SSL/TLS client certificates.Methods inherited from class org.gnome.gobject.GObject.Builder
onNotify
Methods inherited from class io.github.jwharm.javagi.gobject.Builder
addBuilderProperty, connect, connect, connectSignals, getArena, getNames, getValues
-
Constructor Details
-
Builder
protected Builder()Default constructor for aBuilder
object.
-
-
Method Details
-
build
Finish building theServer
object. This will callGObject.withProperties(org.gnome.glib.Type, java.lang.String[], org.gnome.gobject.Value[])
to create a new GObject instance, which is then cast toServer
.- Overrides:
build
in classGObject.Builder<B extends Server.Builder<B>>
- Returns:
- a new instance of
Server
with the properties that were set in the Builder object. - Throws:
UnsupportedPlatformException
- when run on an unsupported platform
-
setRawPaths
Iftrue
, percent-encoding in the Request-URI path will not be automatically decoded.- Parameters:
rawPaths
- the value for theraw-paths
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setServerHeader
Server header.If non-
null
, the value to use for the "Server" header onServerMessage
s 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 aServer:server-header
property that has trailing whitespace,SoupServer
will append its own product token (eg,libsoup/2.3.2
) to the end of the header for you.- Parameters:
serverHeader
- the value for theserver-header
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setTlsAuthMode
AGio.TlsAuthenticationMode
for SSL/TLS client authentication.- Parameters:
tlsAuthMode
- the value for thetls-auth-mode
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setTlsCertificate
Aorg.gnome.gio.TlsCertificate[
that has aGio.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 thetls-certificate
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setTlsDatabase
ATlsDatabase
to use for validating SSL/TLS client certificates.- Parameters:
tlsDatabase
- the value for thetls-database
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
onRequestAborted
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 (ifServer::request-read
has been emitted butServer::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 inServer::request-started
.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onRequestFinished
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
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'sstatus_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
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 aServer::request-finished
signal. If a network error occurs, the processing will instead end withServer::request-aborted
.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-