Package io.muserver
Interface MuServer
-
public interface MuServer
A web server handler. Create and start a web server by usingMuServerBuilder.httpsServer()
orMuServerBuilder.httpServer()
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.Set<HttpConnection>
activeConnections()
java.net.InetSocketAddress
address()
static java.lang.String
artifactVersion()
void
changeHttpsConfig(HttpsConfigBuilder newHttpsConfig)
Changes the HTTPS certificate.boolean
gzipEnabled()
Specifies whether GZIP is on or not.java.net.URI
httpsUri()
java.net.URI
httpUri()
int
maxRequestHeadersSize()
The maximum allowed size of request headers.long
maxRequestSize()
The maximum allowed size of a request body.int
maxUrlSize()
The maximum allowed size of the URI sent in a request line.java.util.Set<java.lang.String>
mimeTypesToGzip()
Specifies the mime-types that GZIP should be applied to.long
minimumGzipSize()
The size a response body must be before GZIP is enabled, ifgzipEnabled()
is true and the mime type is inmimeTypesToGzip()
java.util.List<RateLimiter>
rateLimiters()
long
requestIdleTimeoutMillis()
The maximum idle timeout for reading request bodies.SSLInfo
sslInfo()
Gets the SSL info of the server, or null if SSL is not enabled.MuStats
stats()
void
stop()
Shuts down the serverjava.net.URI
uri()
-
-
-
Method Detail
-
stop
void stop()
Shuts down the server
-
uri
java.net.URI uri()
- Returns:
- The HTTPS (or if unavailable the HTTP) URI of the web server.
-
httpUri
java.net.URI httpUri()
- Returns:
- The HTTP URI of the web server, if HTTP is supported; otherwise null
-
httpsUri
java.net.URI httpsUri()
- Returns:
- The HTTPS URI of the web server, if HTTPS is supported; otherwise null
-
stats
MuStats stats()
- Returns:
- Provides stats about the server
-
activeConnections
java.util.Set<HttpConnection> activeConnections()
- Returns:
- The current HTTP connections between this server and its clients.
-
address
java.net.InetSocketAddress address()
- Returns:
- The address of the server. To get the ip address, use
InetSocketAddress.getAddress()
and on that callInetAddress.getHostAddress()
. To get the hostname, useInetSocketAddress.getHostName()
orInetSocketAddress.getHostString()
.
-
artifactVersion
static java.lang.String artifactVersion()
- Returns:
- Returns the current version of MuServer, or 0.x if unknown
-
minimumGzipSize
long minimumGzipSize()
The size a response body must be before GZIP is enabled, ifgzipEnabled()
is true and the mime type is inmimeTypesToGzip()
This can only be set at point of server creation with
MuServerBuilder.withGzip(long, Set)
- Returns:
- Size in bytes.
-
maxRequestHeadersSize
int maxRequestHeadersSize()
The maximum allowed size of request headers.This can only be set at point of server creation with
MuServerBuilder.withMaxHeadersSize(int)
- Returns:
- Size in bytes.
-
requestIdleTimeoutMillis
long requestIdleTimeoutMillis()
The maximum idle timeout for reading request bodies.This can only be set at point of server creation with
MuServerBuilder.withIdleTimeout(long, TimeUnit)
- Returns:
- Timeout in milliseconds.
-
maxRequestSize
long maxRequestSize()
The maximum allowed size of a request body.This can only be set at point of server creation with
MuServerBuilder.withMaxRequestSize(long)
- Returns:
- Size in bytes.
-
maxUrlSize
int maxUrlSize()
The maximum allowed size of the URI sent in a request line.This can only be set at point of server creation with
MuServerBuilder.withMaxUrlSize(int)
- Returns:
- Length of allowed URI string.
-
gzipEnabled
boolean gzipEnabled()
Specifies whether GZIP is on or not.This can only be set at point of server creation with
MuServerBuilder.withGzipEnabled(boolean)
orMuServerBuilder.withGzip(long, Set)
- Returns:
- True if gzip is enabled for responses that match gzip criteria; otherwise false.
-
mimeTypesToGzip
java.util.Set<java.lang.String> mimeTypesToGzip()
Specifies the mime-types that GZIP should be applied to.This can only be set at point of server creation with
MuServerBuilder.withGzip(long, Set)
- Returns:
- A set of mime-types.
-
changeHttpsConfig
void changeHttpsConfig(HttpsConfigBuilder newHttpsConfig)
Changes the HTTPS certificate. This can be changed without restarting the server.- Parameters:
newHttpsConfig
- The new SSL Context to use.
-
sslInfo
SSLInfo sslInfo()
Gets the SSL info of the server, or null if SSL is not enabled.- Returns:
- A description of the actual SSL settings used, or null.
-
rateLimiters
java.util.List<RateLimiter> rateLimiters()
- Returns:
- The rate limiters added to the server with
MuServerBuilder.withRateLimiter(RateLimitSelector)
, in the order they are applied.
-
-