Package com.codingchili.core.listener
Class ListenerSettings
java.lang.Object
com.codingchili.core.listener.ListenerSettings
Settings for transport listeners.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addListenPort(int port)
addMapping(String route, Endpoint endpoint)
Adds a new mapping from the request target to another endpoint.getApi()
static ListenerSettings
io.vertx.core.http.HttpServerOptions
int
int
getPort()
int
getType()
boolean
isAlpn()
boolean
boolean
isSecure()
void
setAlpn(boolean alpn)
void
setBasePath(String basePath)
setBinaryWebsockets(boolean binaryWebsockets)
setDefaultTarget(String defaultTarget)
setHttpOptions(io.vertx.core.http.HttpServerOptions httpOptions)
setKeystore(String keystore)
setMaxRequestBytes(int maxRequestBytes)
setPort(int port)
setSecure(boolean secure)
setTimeout(int timeout)
-
Field Details
-
DEFAULT_TIMEOUT
public static final int DEFAULT_TIMEOUT- See Also:
- Constant Field Values
-
DEFAULT_MAX_REQUEST_BYTES
public static final int DEFAULT_MAX_REQUEST_BYTES- See Also:
- Constant Field Values
-
-
Constructor Details
-
ListenerSettings
public ListenerSettings()
-
-
Method Details
-
getTimeout
public int getTimeout()- Returns:
- timeout in MS after the router times out the request.
-
setTimeout
- Parameters:
timeout
- the timeout in MS which the router times out the request.- Returns:
- fluent
-
getKeystore
- Returns:
- the name of the keystore to use if security is enabled.
-
setKeystore
- Parameters:
keystore
- the name of the keystore to use, sets secure to true when called. The certificate must be added using #SecuritySettings.addKeystore()
before it is available. if not added will throw an exception.- Returns:
- fluent.
-
isBinaryWebsockets
public boolean isBinaryWebsockets()- Returns:
- if true indicates that websocket frames should be written as binary.
-
setBinaryWebsockets
- Parameters:
binaryWebsockets
- set to true to write websocket frames as binary, otherwise writes a text frame.- Returns:
- fluent.
-
isSecure
public boolean isSecure()- Returns:
- true if TLS security is enabled on listeners that supports it. Security options are set on the default httpClientOptions.
-
setSecure
- Parameters:
secure
- if set to false disables transport security for the listeners that supports it.- Returns:
- fluent
-
getMaxRequestBytes
public int getMaxRequestBytes()- Returns:
- the maximum number of bytes in a request.
-
setMaxRequestBytes
- Parameters:
maxRequestBytes
- sets the maximum number of bytes in a single request.- Returns:
- fluent
-
getType
- Returns:
- the type of the listener, for example tcp or udp.
-
setType
- Parameters:
type
- the type to set for the listener.- Returns:
- fluent
-
getPort
public int getPort()- Returns:
- the port the listener is to be activated on.
-
setPort
- Parameters:
port
- the port the listener is to be activated on.- Returns:
- fluent
-
getApi
- Returns:
- api mappings for this listener
-
setApi
- Parameters:
api
- the api mappings to set for the listener- Returns:
- fluent
-
addApi
- Parameters:
route
- the handler of the route/identity/target to mapapi
- the endpoint the request is mapped to.- Returns:
- fluent
-
isAlpn
public boolean isAlpn()- Returns:
- true if ALPN is enabled - this is required to support HTTP/2.
-
setAlpn
public void setAlpn(boolean alpn)- Parameters:
alpn
- if true attempt to use ALPN - also requires that secure is set to true.
-
getHttpOptions
public io.vertx.core.http.HttpServerOptions getHttpOptions()- Returns:
- HttpOptions created from the listeners settings.
-
setHttpOptions
- Parameters:
httpOptions
- sets the HttpOptions for the listener if applicable- Returns:
- fluent
-
addMapping
Adds a new mapping from the request target to another endpoint.- Parameters:
route
- the request target to match for this mapping to applyendpoint
- the endpoint to set the request to- Returns:
- fluent
-
addListenPort
public void addListenPort(int port)- Parameters:
port
- adds a port that the server is listening to. useful if the port is set to 0.
-
getListenPorts
- Returns:
- a list of ports the listener is listening to. this list contains all ports that are being listened to for the configuration, which may differ from the requested listening port.
-
getDefaultTarget
- Returns:
- get the default target to use if unspecified.
-
setDefaultTarget
- Parameters:
defaultTarget
- sets the default target where target is unspecified.- Returns:
- fluent
-
getDefaultSettings
- Returns:
- static supplier of the default settings; used to avoid instantiating a new settings object on every read of setting properties in listeners where no settings has been configured.
-
getBasePath
- Returns:
- a regex that matches the basePath for received calls. When using
#
RestRequest
the basePath will not be considered when mapping the URL to target/route.
-
setBasePath
- Parameters:
basePath
- see #getBasePath()
-