host

fun Route.host(host: String, port: Int = 0, build: Route.() -> Unit): Route

Create a route to match request host and port. There are no any host resolutions/transformations applied to a host: a request host is treated as a string.

When passes it puts request host and port into call parameters by keys HostRouteSelector.HostNameParameter and HostRouteSelector.PortParameter

Parameters

host

exact host name that is treated literally

port

to be tested or 0 to pass all ports


fun Route.host(hostPattern: Regex, port: Int = 0, build: Route.() -> Unit): Route

Create a route to match request host and port. There are no any host resolutions/transformations applied to a host: a request host is treated as a string.

When passes it puts request host and port into call parameters by keys HostRouteSelector.HostNameParameter and HostRouteSelector.PortParameter

Parameters

hostPattern

is a regular expression to match request host

port

to be tested or 0 to pass all ports


fun Route.host(hosts: List<String>, ports: List<Int> = emptyList(), build: Route.() -> Unit): Route

Create a route to match request host and port. There are no any host resolutions/transformations applied to a host: a request host is treated as a string.

When passes it puts request host and port into call parameters by keys HostRouteSelector.HostNameParameter and HostRouteSelector.PortParameter

Parameters

hosts

a list of exact host names that are treated literally

ports

a list of ports to be passed or empty to pass all ports

Throws

when no constraints were applied in hosts and ports


fun Route.host(hosts: List<String>, hostPatterns: List<Regex>, ports: List<Int> = emptyList(), build: Route.() -> Unit): Route

Create a route to match request host and port. There are no any host resolutions/transformations applied to a host: a request host is treated as a string.

When passes it puts request host and port into call parameters by keys HostRouteSelector.HostNameParameter and HostRouteSelector.PortParameter

Parameters

hosts

a list of exact host names that are treated literally

hostPatterns

a list of regular expressions to match request host

ports

a list of ports to be passed or empty to pass all ports

Throws

when no constraints were applied in host, hostPatterns and ports