Class ServerConfiguration
-
Field Summary
Fields inherited from class software.xdev.mockserver.configuration.Configuration
attemptToProxyIfNoMatchingExpectation, clientNioEventLoopThreadCount, forwardHttpProxy, forwardProxyAuthenticationPassword, forwardProxyAuthenticationUsername, forwardSocksProxy, maxFutureTimeoutInMillis, maxSocketTimeoutInMillis, maxWebSocketExpectations, socketConnectionTimeoutInMillis, webSocketClientEventLoopThreadCount -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionactionHandlerThreadCount(Integer actionHandlerThreadCount) Number of threads for the action handler thread poolalwaysCloseSocketConnections(Boolean alwaysCloseSocketConnections) If true socket connections will always be closed after a response is returned, if false connection is only closed if request header indicate connection should be closed.assumeAllRequestsAreHttp(Boolean assumeAllRequestsAreHttp) If false requests are assumed as binary if the method isn't one of "GET", "POST", "PUT", "HEAD", "OPTIONS", "PATCH", "DELETE", "TRACE" or "CONNECT"binaryProxyListener(BinaryProxyListener binaryProxyListener) Set a software.xdev.mockserver.model.BinaryProxyListener called when binary content is proxiedstatic ServerConfigurationcorsAllowCredentials(Boolean corsAllowCredentials) The value used for CORS in the access-control-allow-credentials header.corsAllowHeaders(String corsAllowHeaders) the value used for CORS in the access-control-allow-headers and access-control-expose-headers headers.corsAllowMethods(String corsAllowMethods) the value used for CORS in the access-control-allow-methods header.corsAllowOrigin(String corsAllowOrigin) the value used for CORS in the access-control-allow-origin header.corsMaxAgeInSeconds(Integer corsMaxAgeInSeconds) The value used for CORS in the access-control-max-age header.detailedMatchFailures(Boolean detailedMatchFailures) If true (the default) the log event recording that a request matcher did not match will include a detailed reason why each non-matching field did not match.enableCORSForAllResponses(Boolean enableCORSForAllResponses) Enable CORS for all responses from MockServer, including the REST API and expectation responsesenableCORSForAPI(Boolean enableCORSForAPI) Enable CORS for MockServer REST API so that the API can be used for javascript running in browsers, such as seleniumlivenessHttpGetPath(String livenessHttpGetPath) Path to support HTTP GET requests for status response (also available on PUT /mockserver/status).localBoundIP(String localBoundIP) The local IP address to bind to for accepting new socket connectionsmatchersFailFast(Boolean matchersFailFast) If true (the default) request matchers will fail on the first non-matching field, if false request matchers will compare all fields.maxChunkSize(Integer maxChunkSize) Maximum size of HTTP chunks in request or responsesmaxExpectations(Integer maxExpectations) Maximum number of expectations stored in memory.maxHeaderSize(Integer maxHeaderSize) Maximum size of HTTP request headersmaximumNumberOfRequestToReturnInVerificationFailure(Integer maximumNumberOfRequestToReturnInVerificationFailure) The maximum number of requests to return in verification failure result, if more expectations are found the failure result does not list them separatelymaxInitialLineLength(Integer maxInitialLineLength) Maximum size of the first line of an HTTP requestmaxLogEntries(Integer maxLogEntries) Maximum number of log entries stored in memory.nioEventLoopThreadCount(Integer nioEventLoopThreadCount) Netty worker thread pool size for handling requests and response.noProxyHosts(String noProxyHosts) The list of hostnames to not use the configured proxy.proxyAuthenticationPassword(String proxyAuthenticationPassword) The required password for proxy authentication to MockServerproxyAuthenticationRealm(String proxyAuthenticationRealm) The authentication realm for proxy authentication to MockServerproxyAuthenticationUsername(String proxyAuthenticationUsername) The required username for proxy authentication to MockServerintuseSemicolonAsQueryParameterSeparator(Boolean useSemicolonAsQueryParameterSeparator) If true semicolons are treated as a separator for a query parameter string, if false the semicolon is treated as a normal character that is part of a query parameter value.Methods inherited from class software.xdev.mockserver.configuration.Configuration
attemptToProxyIfNoMatchingExpectation, attemptToProxyIfNoMatchingExpectation, clientNioEventLoopThreadCount, clientNioEventLoopThreadCount, forwardBinaryRequestsWithoutWaitingForResponse, forwardBinaryRequestsWithoutWaitingForResponse, forwardHttpProxy, forwardHttpProxy, forwardProxyAuthenticationPassword, forwardProxyAuthenticationPassword, forwardProxyAuthenticationUsername, forwardProxyAuthenticationUsername, forwardSocksProxy, forwardSocksProxy, ifNullReturn, maxFutureTimeoutInMillis, maxFutureTimeoutInMillis, maxSocketTimeoutInMillis, maxSocketTimeoutInMillis, maxWebSocketExpectations, maxWebSocketExpectations, socketConnectionTimeoutInMillis, socketConnectionTimeoutInMillis, webSocketClientEventLoopThreadCount, webSocketClientEventLoopThreadCount
-
Constructor Details
-
ServerConfiguration
public ServerConfiguration()
-
-
Method Details
-
configuration
-
detailedMatchFailures
-
detailedMatchFailures
If true (the default) the log event recording that a request matcher did not match will include a detailed reason why each non-matching field did not match.- Parameters:
detailedMatchFailures- enabled detailed match failure log events
-
maxExpectations
-
maxExpectations
Maximum number of expectations stored in memory. Expectations are stored in a circular queue so once this limit is reach the oldest and lowest priority expectations are overwritten
The default maximum depends on the available memory in the JVM with an upper limit of 5000
- Parameters:
maxExpectations- maximum number of expectations to store
-
maxLogEntries
-
maxLogEntries
Maximum number of log entries stored in memory. Log entries are stored in a circular queue so once this limit is reach the oldest log entries are overwritten
The default maximum depends on the available memory in the JVM with an upper limit of 60000
- Parameters:
maxLogEntries- maximum number of expectations to store
-
nioEventLoopThreadCount
-
nioEventLoopThreadCount
Netty worker thread pool size for handling requests and response. These threads handle deserializing and serialising HTTP requests and responses and some other fast logic, long running tasks are done on the action handler thread pool.
- Parameters:
nioEventLoopThreadCount- Netty worker thread pool size
-
actionHandlerThreadCount
-
actionHandlerThreadCount
Number of threads for the action handler thread pool
These threads are used for handling actions such as:
- serialising and writing expectation or proxied responses
- handling response delays in a non-blocking way (i.e. using a scheduler)
- executing class callbacks
- handling method / closure callbacks (using web sockets)
Default is maximum of 5 or available processors count
- Parameters:
actionHandlerThreadCount- Netty worker thread pool size
-
matchersFailFast
-
matchersFailFast
If true (the default) request matchers will fail on the first non-matching field, if false request matchers will compare all fields. This is useful to see all mismatching fields in the log event recording that a request matcher did not match.- Parameters:
matchersFailFast- enabled request matchers failing fast
-
alwaysCloseSocketConnections
-
alwaysCloseSocketConnections
If true socket connections will always be closed after a response is returned, if false connection is only closed if request header indicate connection should be closed.
Default is false
- Parameters:
alwaysCloseSocketConnections- true socket connections will always be closed after a response is returned
-
localBoundIP
-
localBoundIP
The local IP address to bind to for accepting new socket connectionsDefault is 0.0.0.0
- Parameters:
localBoundIP- local IP address to bind to for accepting new socket connections
-
maxInitialLineLength
-
maxInitialLineLength
Maximum size of the first line of an HTTP requestThe default is Integer.MAX_VALUE
- Parameters:
maxInitialLineLength- maximum size of the first line of an HTTP request
-
maxHeaderSize
-
maxHeaderSize
Maximum size of HTTP request headersThe default is Integer.MAX_VALUE
- Parameters:
maxHeaderSize- maximum size of HTTP request headers
-
maxChunkSize
-
maxChunkSize
Maximum size of HTTP chunks in request or responsesThe default is Integer.MAX_VALUE
- Parameters:
maxChunkSize- maximum size of HTTP chunks in request or responses
-
useSemicolonAsQueryParameterSeparator
-
useSemicolonAsQueryParameterSeparator
public ServerConfiguration useSemicolonAsQueryParameterSeparator(Boolean useSemicolonAsQueryParameterSeparator) If true semicolons are treated as a separator for a query parameter string, if false the semicolon is treated as a normal character that is part of a query parameter value.The default is true
- Parameters:
useSemicolonAsQueryParameterSeparator- if true semicolons are treated as a separator for a query parameter string
-
assumeAllRequestsAreHttp
-
assumeAllRequestsAreHttp
If false requests are assumed as binary if the method isn't one of "GET", "POST", "PUT", "HEAD", "OPTIONS", "PATCH", "DELETE", "TRACE" or "CONNECT"The default is false
- Parameters:
assumeAllRequestsAreHttp- if false requests are assumed as binary if the method isn't one of "GET", "POST", "PUT", "HEAD", "OPTIONS", "PATCH", "DELETE", "TRACE" or "CONNECT"
-
binaryProxyListener
-
binaryProxyListener
Set a software.xdev.mockserver.model.BinaryProxyListener called when binary content is proxied- Parameters:
binaryProxyListener- a BinaryProxyListener called when binary content is proxied
-
enableCORSForAPI
-
enableCORSForAPI
Enable CORS for MockServer REST API so that the API can be used for javascript running in browsers, such as seleniumThe default is false
- Parameters:
enableCORSForAPI- CORS for MockServer REST API
-
enableCORSForAllResponses
-
enableCORSForAllResponses
Enable CORS for all responses from MockServer, including the REST API and expectation responsesThe default is false
- Parameters:
enableCORSForAllResponses- CORS for all responses from MockServer
-
corsAllowOrigin
-
corsAllowOrigin
the value used for CORS in the access-control-allow-origin header.
The default is ""
- Parameters:
corsAllowOrigin- the value used for CORS in the access-control-allow-methods header
-
corsAllowMethods
-
corsAllowMethods
the value used for CORS in the access-control-allow-methods header.
The default is ""
- Parameters:
corsAllowMethods- the value used for CORS in the access-control-allow-methods header
-
corsAllowHeaders
-
corsAllowHeaders
the value used for CORS in the access-control-allow-headers and access-control-expose-headers headers.
In addition to this default value any headers specified in the request header access-control-request-headers also get added to access-control-allow-headers and access-control-expose-headers headers in a CORS response.
The default is ""
- Parameters:
corsAllowHeaders- the value used for CORS in the access-control-allow-headers and access-control-expose-headers headers
-
corsAllowCredentials
-
corsAllowCredentials
The value used for CORS in the access-control-allow-credentials header.The default is false
- Parameters:
corsAllowCredentials- the value used for CORS in the access-control-allow-credentials header
-
corsMaxAgeInSeconds
-
corsMaxAgeInSeconds
The value used for CORS in the access-control-max-age header.The default is 0
- Parameters:
corsMaxAgeInSeconds- the value used for CORS in the access-control-max-age header.
-
maximumNumberOfRequestToReturnInVerificationFailure
-
maximumNumberOfRequestToReturnInVerificationFailure
public ServerConfiguration maximumNumberOfRequestToReturnInVerificationFailure(Integer maximumNumberOfRequestToReturnInVerificationFailure) The maximum number of requests to return in verification failure result, if more expectations are found the failure result does not list them separately- Parameters:
maximumNumberOfRequestToReturnInVerificationFailure- maximum number of expectations to return in verification failure result
-
proxyAuthenticationRealm
-
proxyAuthenticationRealm
The authentication realm for proxy authentication to MockServer- Parameters:
proxyAuthenticationRealm- the authentication realm for proxy authentication
-
proxyAuthenticationUsername
-
proxyAuthenticationUsername
The required username for proxy authentication to MockServer
Note: 8u111 Update Release Notes state that the Basic authentication scheme has been deactivated when setting up an HTTPS tunnel. To resolve this clear or set to an empty string the following system properties:
jdk.http.auth.tunneling.disabledSchemesandjdk.http.auth.proxying.disabledSchemes.The default is ""
- Parameters:
proxyAuthenticationUsername- required username for proxy authentication to MockServer
-
proxyAuthenticationPassword
-
proxyAuthenticationPassword
The required password for proxy authentication to MockServer
Note: 8u111 Update Release Notes state that the Basic authentication scheme has been deactivated when setting up an HTTPS tunnel. To resolve this clear or set to an empty string the following system properties:
jdk.http.auth.tunneling.disabledSchemesandjdk.http.auth.proxying.disabledSchemes.The default is ""
- Parameters:
proxyAuthenticationPassword- required password for proxy authentication to MockServer
-
noProxyHosts
-
noProxyHosts
The list of hostnames to not use the configured proxy. Several values may be present, seperated by comma (,)
The default is ""- Parameters:
noProxyHosts- Comma-seperated list of hosts to not be proxied.
-
livenessHttpGetPath
-
livenessHttpGetPath
Path to support HTTP GET requests for status response (also available on PUT /mockserver/status).If this value is not modified then only PUT /mockserver/status but is a none blank value is provided for this value then GET requests to this path will return the 200 Ok status response showing the MockServer version and bound ports.
A GET request to this path will be matched before any expectation matching or proxying of requests.
The default is ""
- Parameters:
livenessHttpGetPath- path to support HTTP GET requests for status response
-
ringBufferSize
public int ringBufferSize()
-