@ConfigurationProperties(value="micronaut.server", cliPrefix="") public class HttpServerConfiguration extends Object
A base ConfigurationProperties
for servers.
Modifier and Type | Class and Description |
---|---|
static class |
HttpServerConfiguration.CorsConfiguration
Configuration for CORS.
|
static class |
HttpServerConfiguration.MultipartConfiguration
Configuration for multipart handling.
|
Modifier and Type | Field and Description |
---|---|
static boolean |
DEFAULT_DATEHEADER
The default date header.
|
static long |
DEFAULT_IDLE_TIME_MINUTES
The default idle time.
|
static boolean |
DEFAULT_LOG_HANDLED_EXCEPTIONS
The default value for log handled exceptions.
|
static long |
DEFAULT_MAX_REQUEST_SIZE
The default max request size.
|
static int |
DEFAULT_PORT
The default port value.
|
static int |
DEFAULT_RANDOM_PORT
The default value random port.
|
static long |
DEFAULT_READ_IDLE_TIME_MINUTES
The default read idle time in minutes.
|
static long |
DEFAULT_WRITE_IDLE_TIME_MINUTES
The default write idle time in minutes.
|
static String |
PREFIX
The prefix used for configuration.
|
Constructor and Description |
---|
HttpServerConfiguration()
Default constructor.
|
HttpServerConfiguration(ApplicationConfiguration applicationConfiguration) |
Modifier and Type | Method and Description |
---|---|
ApplicationConfiguration |
getApplicationConfiguration() |
HttpServerConfiguration.CorsConfiguration |
getCors() |
Charset |
getDefaultCharset() |
Optional<String> |
getHost() |
Duration |
getIdleTimeout() |
long |
getMaxRequestSize() |
HttpServerConfiguration.MultipartConfiguration |
getMultipart() |
Optional<Integer> |
getPort() |
Duration |
getReadIdleTimeout() |
Optional<Integer> |
getReadTimeout() |
Optional<String> |
getServerHeader() |
Duration |
getWriteIdleTimeout() |
boolean |
isDateHeader() |
boolean |
isLogHandledExceptions() |
void |
setCors(HttpServerConfiguration.CorsConfiguration cors)
Sets the cors configuration.
|
void |
setDateHeader(boolean dateHeader)
Sets whether a date header should be sent back.
|
void |
setDefaultCharset(Charset defaultCharset) |
void |
setHost(String host)
Sets the host to bind to.
|
void |
setIdleTimeout(Duration idleTimeout)
Sets the idle time of connections for the server.
|
void |
setLogHandledExceptions(boolean logHandledExceptions)
Sets whether exceptions handled by either an error route or exception handler
should still be logged.
|
void |
setMaxRequestSize(long maxRequestSize)
Sets the maximum request size.
|
void |
setMultipart(HttpServerConfiguration.MultipartConfiguration multipart)
Sets the multipart configuration.
|
void |
setPort(int port)
Sets the port to bind to.
|
void |
setReadIdleTimeout(Duration readIdleTimeout)
Sets the amount of time a connection can remain idle without any reads occurring.
|
void |
setReadTimeout(Integer readTimeout)
Sets the default read timeout.
|
void |
setServerHeader(String serverHeader)
Sets the name of the server header.
|
void |
setWriteIdleTimeout(Duration writeIdleTimeout)
Sets the amount of time a connection can remain idle without any writes occurring.
|
public static final int DEFAULT_PORT
public static final String PREFIX
public static final int DEFAULT_RANDOM_PORT
public static final long DEFAULT_MAX_REQUEST_SIZE
public static final long DEFAULT_READ_IDLE_TIME_MINUTES
public static final long DEFAULT_WRITE_IDLE_TIME_MINUTES
public static final boolean DEFAULT_DATEHEADER
public static final long DEFAULT_IDLE_TIME_MINUTES
public static final boolean DEFAULT_LOG_HANDLED_EXCEPTIONS
public HttpServerConfiguration()
@Inject public HttpServerConfiguration(ApplicationConfiguration applicationConfiguration)
applicationConfiguration
- The application configurationpublic ApplicationConfiguration getApplicationConfiguration()
public Charset getDefaultCharset()
public void setDefaultCharset(Charset defaultCharset)
defaultCharset
- The default charset to usepublic Optional<Integer> getReadTimeout()
public HttpServerConfiguration.MultipartConfiguration getMultipart()
public HttpServerConfiguration.CorsConfiguration getCors()
public long getMaxRequestSize()
public Duration getReadIdleTimeout()
public Duration getWriteIdleTimeout()
public Duration getIdleTimeout()
public boolean isDateHeader()
public boolean isLogHandledExceptions()
public void setPort(int port)
port
- The portpublic void setHost(String host)
host
- The hostpublic void setReadTimeout(Integer readTimeout)
readTimeout
- The read timeoutpublic void setServerHeader(String serverHeader)
serverHeader
- The server headerpublic void setMaxRequestSize(@ReadableBytes long maxRequestSize)
maxRequestSize
- The max request sizepublic void setReadIdleTimeout(Duration readIdleTimeout)
readIdleTimeout
- The read idle timepublic void setWriteIdleTimeout(Duration writeIdleTimeout)
writeIdleTimeout
- The write idle timepublic void setIdleTimeout(Duration idleTimeout)
idleTimeout
- The idle timepublic void setMultipart(HttpServerConfiguration.MultipartConfiguration multipart)
multipart
- The multipart configurationpublic void setCors(HttpServerConfiguration.CorsConfiguration cors)
cors
- The cors configurationpublic void setDateHeader(boolean dateHeader)
dateHeader
- True if a date header should be sent.public void setLogHandledExceptions(boolean logHandledExceptions)
logHandledExceptions
- True if exceptions should be logged