host

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

Creates a route to match a request's 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 a request host and port into call parameters by the HostRouteSelector.HostNameParameter and HostRouteSelector.PortParameter keys.

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

Creates a route to match a 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 a request host and port into call parameters by the HostRouteSelector.HostNameParameter and HostRouteSelector.PortParameter keys.

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

Creates a route to match a 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 the HostRouteSelector.HostNameParameter and HostRouteSelector.PortParameter keys.

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

Creates a route to match s 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 the HostRouteSelector.HostNameParameter and HostRouteSelector.PortParameter keys.

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