Package io.helidon.webserver
Class Routing.Builder
- java.lang.Object
-
- io.helidon.webserver.Routing.Builder
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Routing.Builder
any(Handler... requestHandlers)
Routes all requests to provided handler(s).Routing.Builder
any(PathMatcher pathMatcher, Handler... requestHandlers)
Routes all requests with corresponding path to provided handler(s).Routing.Builder
any(String pathPattern, Handler... requestHandlers)
Routes all requests with corresponding path to provided handler(s).Routing.Builder
anyOf(Iterable<Http.RequestMethod> methods, Handler... requestHandlers)
Routes requests any specified method to provided handler(s).Routing.Builder
anyOf(Iterable<Http.RequestMethod> methods, PathMatcher pathMatcher, Handler... requestHandlers)
Routes requests with any specified method and corresponding path to provided handler(s).Routing.Builder
anyOf(Iterable<Http.RequestMethod> methods, String pathPattern, Handler... requestHandlers)
Routes requests with any specified method and corresponding path to provided handler(s).Routing
build()
Builds a new routing instance.WebServer
createServer()
Creates newWebServer
instance with this routing and default configuration.WebServer
createServer(ServerConfiguration configuration)
Creates newWebServer
instance with provided configuration and this routing.WebServer
createServer(ServerConfiguration.Builder configurationBuilder)
Creates newWebServer
instance with provided configuration and this routing.Routing.Builder
delete(Handler... requestHandlers)
Routes all DELETE requests to provided handler(s).Routing.Builder
delete(PathMatcher pathMatcher, Handler... requestHandlers)
Routes DELETE requests with corresponding path to provided handler(s).Routing.Builder
delete(String pathPattern, Handler... requestHandlers)
Routes DELETE requests with corresponding path to provided handler(s).<T extends Throwable>
Routing.Buildererror(Class<T> exceptionClass, ErrorHandler<T> errorHandler)
Registers an error handler that handles the given type of exceptions.Routing.Builder
get(Handler... requestHandlers)
Routes all GET requests to provided handler(s).Routing.Builder
get(PathMatcher pathMatcher, Handler... requestHandlers)
Routes GET requests with corresponding path to provided handler(s).Routing.Builder
get(String pathPattern, Handler... requestHandlers)
Routes GET requests with corresponding path to provided handler(s).Routing.Builder
head(Handler... requestHandlers)
Routes all HEAD requests to provided handler(s).Routing.Builder
head(PathMatcher pathMatcher, Handler... requestHandlers)
Routes HEAD requests with corresponding path to provided handler(s).Routing.Builder
head(String pathPattern, Handler... requestHandlers)
Routes HEAD requests with corresponding path to provided handler(s).Routing.Builder
onNewWebServer(Consumer<WebServer> webServerConsumer)
Registers callback on created newWebServer
instance with this routing.Routing.Builder
options(Handler... requestHandlers)
Routes all OPTIONS requests to provided handler(s).Routing.Builder
options(PathMatcher pathMatcher, Handler... requestHandlers)
Routes OPTIONS requests with corresponding path to provided handler(s).Routing.Builder
options(String pathPattern, Handler... requestHandlers)
Routes OPTIONS requests with corresponding path to provided handler(s).Routing.Builder
post(Handler... requestHandlers)
Routes all POST requests to provided handler(s).Routing.Builder
post(PathMatcher pathMatcher, Handler... requestHandlers)
Routes POST requests with corresponding path to provided handler(s).Routing.Builder
post(String pathPattern, Handler... requestHandlers)
Routes POST requests with corresponding path to provided handler(s).Routing.Builder
put(Handler... requestHandlers)
Routes all PUT requests to provided handler(s).Routing.Builder
put(PathMatcher pathMatcher, Handler... requestHandlers)
Routes PUT requests with corresponding path to provided handler(s).Routing.Builder
put(String pathPattern, Handler... requestHandlers)
Routes PUT requests with corresponding path to provided handler(s).Routing.Builder
register(Service... services)
Registers builder consumer.Routing.Builder
register(WebTracingConfig webTracingConfig)
Configuration of tracing for this routing.Routing.Builder
register(String pathPattern, Service... services)
Registers builder consumer.Routing.Builder
register(String pathPattern, Supplier<? extends Service>... serviceBuilders)
Registers builder consumer.Routing.Builder
register(Supplier<? extends Service>... serviceBuilders)
Registers builder consumer.Routing.Builder
trace(Handler... requestHandlers)
Routes all TRACE requests to provided handler(s).Routing.Builder
trace(PathMatcher pathMatcher, Handler... requestHandlers)
Routes TRACE requests with corresponding path to provided handler(s).Routing.Builder
trace(String pathPattern, Handler... requestHandlers)
Routes TRACE requests with corresponding path to provided handler(s).
-
-
-
Method Detail
-
register
public Routing.Builder register(WebTracingConfig webTracingConfig)
Description copied from interface:Routing.Rules
Configuration of tracing for this routing. The configuration may control whether to log specific components, spans and span logs, either globally, or for a specific path and method combinations.- Specified by:
register
in interfaceRouting.Rules
- Parameters:
webTracingConfig
- WebServer tracing configuration- Returns:
- Updated routing configuration
-
register
public Routing.Builder register(Supplier<? extends Service>... serviceBuilders)
Description copied from interface:Routing.Rules
Registers builder consumer. It enables to separate complex routing definitions to dedicated classes.- Specified by:
register
in interfaceRouting.Rules
- Parameters:
serviceBuilders
- service builder to register; they will be built as a first step of this method execution- Returns:
- Updated routing configuration
-
register
public Routing.Builder register(Service... services)
Description copied from interface:Routing.Rules
Registers builder consumer. It enables to separate complex routing definitions to dedicated classes.- Specified by:
register
in interfaceRouting.Rules
- Parameters:
services
- services to register- Returns:
- Updated routing configuration
-
register
public Routing.Builder register(String pathPattern, Service... services)
Description copied from interface:Routing.Rules
Registers builder consumer. It enables to separate complex routing definitions to dedicated classes.- Specified by:
register
in interfaceRouting.Rules
- Parameters:
pathPattern
- a URI path pattern. SeePathMatcher
for pattern syntax reference.services
- services to register- Returns:
- Updated routing configuration
-
register
public Routing.Builder register(String pathPattern, Supplier<? extends Service>... serviceBuilders)
Description copied from interface:Routing.Rules
Registers builder consumer. It enables to separate complex routing definitions to dedicated classes.- Specified by:
register
in interfaceRouting.Rules
- Parameters:
pathPattern
- a URI path pattern. SeePathMatcher
for pattern syntax reference.serviceBuilders
- service builder to register; they will be built as a first step of this method execution- Returns:
- an updated routing configuration
-
get
public Routing.Builder get(Handler... requestHandlers)
Description copied from interface:Routing.Rules
Routes all GET requests to provided handler(s). Request handler can callServerRequest.next()
to continue processing on the next registered handler.- Specified by:
get
in interfaceRouting.Rules
- Parameters:
requestHandlers
- handlers to tryProcess HTTP request- Returns:
- an updated routing configuration
-
get
public Routing.Builder get(String pathPattern, Handler... requestHandlers)
Description copied from interface:Routing.Rules
Routes GET requests with corresponding path to provided handler(s). Request handler can callServerRequest.next()
to continue processing on the next registered handler.- Specified by:
get
in interfaceRouting.Rules
- Parameters:
pathPattern
- a URI path pattern. SeePathMatcher
for pattern syntax reference.requestHandlers
- handlers to tryProcess HTTP request- Returns:
- an updated routing configuration
-
get
public Routing.Builder get(PathMatcher pathMatcher, Handler... requestHandlers)
Description copied from interface:Routing.Rules
Routes GET requests with corresponding path to provided handler(s). Request handler can callServerRequest.next()
to continue processing on the next registered handler.- Specified by:
get
in interfaceRouting.Rules
- Parameters:
pathMatcher
- a URI path pattern. SeePathMatcher
for pattern syntax reference.requestHandlers
- handlers to tryProcess HTTP request- Returns:
- an updated routing configuration
-
put
public Routing.Builder put(Handler... requestHandlers)
Description copied from interface:Routing.Rules
Routes all PUT requests to provided handler(s). Request handler can callServerRequest.next()
to continue processing on the next registered handler.- Specified by:
put
in interfaceRouting.Rules
- Parameters:
requestHandlers
- handlers to tryProcess HTTP request- Returns:
- an updated routing configuration
-
put
public Routing.Builder put(String pathPattern, Handler... requestHandlers)
Description copied from interface:Routing.Rules
Routes PUT requests with corresponding path to provided handler(s). Request handler can callServerRequest.next()
to continue processing on the next registered handler.- Specified by:
put
in interfaceRouting.Rules
- Parameters:
pathPattern
- a URI path pattern. SeePathMatcher
for pattern syntax reference.requestHandlers
- handlers to tryProcess HTTP request- Returns:
- an updated routing configuration
-
put
public Routing.Builder put(PathMatcher pathMatcher, Handler... requestHandlers)
Description copied from interface:Routing.Rules
Routes PUT requests with corresponding path to provided handler(s). Request handler can callServerRequest.next()
to continue processing on the next registered handler.- Specified by:
put
in interfaceRouting.Rules
- Parameters:
pathMatcher
- define path for a registered routerrequestHandlers
- handlers to tryProcess HTTP request- Returns:
- an updated routing configuration
-
post
public Routing.Builder post(Handler... requestHandlers)
Description copied from interface:Routing.Rules
Routes all POST requests to provided handler(s). Request handler can callServerRequest.next()
to continue processing on the next registered handler.- Specified by:
post
in interfaceRouting.Rules
- Parameters:
requestHandlers
- handlers to tryProcess HTTP request- Returns:
- an updated routing configuration
-
post
public Routing.Builder post(String pathPattern, Handler... requestHandlers)
Description copied from interface:Routing.Rules
Routes POST requests with corresponding path to provided handler(s). Request handler can callServerRequest.next()
to continue processing on the next registered handler.- Specified by:
post
in interfaceRouting.Rules
- Parameters:
pathPattern
- a URI path pattern. SeePathMatcher
for pattern syntax reference.requestHandlers
- handlers to tryProcess HTTP request- Returns:
- an updated routing configuration
-
post
public Routing.Builder post(PathMatcher pathMatcher, Handler... requestHandlers)
Description copied from interface:Routing.Rules
Routes POST requests with corresponding path to provided handler(s). Request handler can callServerRequest.next()
to continue processing on the next registered handler.- Specified by:
post
in interfaceRouting.Rules
- Parameters:
pathMatcher
- define path for registered routerrequestHandlers
- handlers to tryProcess HTTP request- Returns:
- an updated routing configuration
-
delete
public Routing.Builder delete(Handler... requestHandlers)
Description copied from interface:Routing.Rules
Routes all DELETE requests to provided handler(s). Request handler can callServerRequest.next()
to continue processing on the next registered handler.- Specified by:
delete
in interfaceRouting.Rules
- Parameters:
requestHandlers
- handlers to tryProcess HTTP request- Returns:
- an updated routing configuration
-
delete
public Routing.Builder delete(String pathPattern, Handler... requestHandlers)
Description copied from interface:Routing.Rules
Routes DELETE requests with corresponding path to provided handler(s). Request handler can callServerRequest.next()
to continue processing on the next registered handler.- Specified by:
delete
in interfaceRouting.Rules
- Parameters:
pathPattern
- a URI path pattern. SeePathMatcher
for pattern syntax reference.requestHandlers
- handlers to tryProcess HTTP request- Returns:
- an updated routing configuration
-
delete
public Routing.Builder delete(PathMatcher pathMatcher, Handler... requestHandlers)
Description copied from interface:Routing.Rules
Routes DELETE requests with corresponding path to provided handler(s). Request handler can callServerRequest.next()
to continue processing on the next registered handler.- Specified by:
delete
in interfaceRouting.Rules
- Parameters:
pathMatcher
- define path for registered routerrequestHandlers
- handlers to tryProcess HTTP request- Returns:
- an updated routing configuration
-
options
public Routing.Builder options(Handler... requestHandlers)
Description copied from interface:Routing.Rules
Routes all OPTIONS requests to provided handler(s). Request handler can callServerRequest.next()
to continue processing on the next registered handler.- Specified by:
options
in interfaceRouting.Rules
- Parameters:
requestHandlers
- handlers to tryProcess HTTP request- Returns:
- an updated routing configuration
-
options
public Routing.Builder options(String pathPattern, Handler... requestHandlers)
Description copied from interface:Routing.Rules
Routes OPTIONS requests with corresponding path to provided handler(s). Request handler can callServerRequest.next()
to continue processing on the next registered handler.- Specified by:
options
in interfaceRouting.Rules
- Parameters:
pathPattern
- a URI path pattern. SeePathMatcher
for pattern syntax reference.requestHandlers
- handlers to tryProcess HTTP request- Returns:
- an updated routing configuration
-
options
public Routing.Builder options(PathMatcher pathMatcher, Handler... requestHandlers)
Description copied from interface:Routing.Rules
Routes OPTIONS requests with corresponding path to provided handler(s). Request handler can callServerRequest.next()
to continue processing on the next registered handler.- Specified by:
options
in interfaceRouting.Rules
- Parameters:
pathMatcher
- define path for registered routerrequestHandlers
- handlers to tryProcess HTTP request- Returns:
- an updated routing configuration
-
head
public Routing.Builder head(Handler... requestHandlers)
Description copied from interface:Routing.Rules
Routes all HEAD requests to provided handler(s). Request handler can callServerRequest.next()
to continue processing on the next registered handler.- Specified by:
head
in interfaceRouting.Rules
- Parameters:
requestHandlers
- handlers to tryProcess HTTP request- Returns:
- an updated routing configuration
-
head
public Routing.Builder head(String pathPattern, Handler... requestHandlers)
Description copied from interface:Routing.Rules
Routes HEAD requests with corresponding path to provided handler(s). Request handler can callServerRequest.next()
to continue processing on the next registered handler.- Specified by:
head
in interfaceRouting.Rules
- Parameters:
pathPattern
- a URI path pattern. SeePathMatcher
for pattern syntax reference.requestHandlers
- handlers to tryProcess HTTP request- Returns:
- an updated routing configuration
-
head
public Routing.Builder head(PathMatcher pathMatcher, Handler... requestHandlers)
Description copied from interface:Routing.Rules
Routes HEAD requests with corresponding path to provided handler(s). Request handler can callServerRequest.next()
to continue processing on the next registered handler.- Specified by:
head
in interfaceRouting.Rules
- Parameters:
pathMatcher
- define path for registered routerrequestHandlers
- handlers to tryProcess HTTP request- Returns:
- an updated routing configuration
-
trace
public Routing.Builder trace(Handler... requestHandlers)
Description copied from interface:Routing.Rules
Routes all TRACE requests to provided handler(s). Request handler can callServerRequest.next()
to continue processing on the next registered handler.- Specified by:
trace
in interfaceRouting.Rules
- Parameters:
requestHandlers
- handlers to tryProcess HTTP request- Returns:
- an updated routing configuration
-
trace
public Routing.Builder trace(String pathPattern, Handler... requestHandlers)
Description copied from interface:Routing.Rules
Routes TRACE requests with corresponding path to provided handler(s). Request handler can callServerRequest.next()
to continue processing on the next registered handler.- Specified by:
trace
in interfaceRouting.Rules
- Parameters:
pathPattern
- a URI path pattern. SeePathMatcher
for pattern syntax reference.requestHandlers
- handlers to tryProcess HTTP request- Returns:
- an updated routing configuration
-
trace
public Routing.Builder trace(PathMatcher pathMatcher, Handler... requestHandlers)
Description copied from interface:Routing.Rules
Routes TRACE requests with corresponding path to provided handler(s). Request handler can callServerRequest.next()
to continue processing on the next registered handler.- Specified by:
trace
in interfaceRouting.Rules
- Parameters:
pathMatcher
- define path for registered routerrequestHandlers
- handlers to tryProcess HTTP request- Returns:
- an updated routing configuration
-
any
public Routing.Builder any(Handler... requestHandlers)
Description copied from interface:Routing.Rules
Routes all requests to provided handler(s). Request handler can callServerRequest.next()
to continue processing on the next registered handler.- Specified by:
any
in interfaceRouting.Rules
- Parameters:
requestHandlers
- handlers to tryProcess HTTP request- Returns:
- an updated routing configuration
-
any
public Routing.Builder any(String pathPattern, Handler... requestHandlers)
Description copied from interface:Routing.Rules
Routes all requests with corresponding path to provided handler(s). Request handler can callServerRequest.next()
to continue processing on the next registered handler.- Specified by:
any
in interfaceRouting.Rules
- Parameters:
pathPattern
- a URI path pattern. SeePathMatcher
for pattern syntax reference.requestHandlers
- handlers to tryProcess HTTP request- Returns:
- an updated routing configuration
-
any
public Routing.Builder any(PathMatcher pathMatcher, Handler... requestHandlers)
Description copied from interface:Routing.Rules
Routes all requests with corresponding path to provided handler(s). Request handler can callServerRequest.next()
to continue processing on the next registered handler.- Specified by:
any
in interfaceRouting.Rules
- Parameters:
pathMatcher
- define path for registered routerrequestHandlers
- handlers to tryProcess HTTP request- Returns:
- an updated routing configuration
-
anyOf
public Routing.Builder anyOf(Iterable<Http.RequestMethod> methods, Handler... requestHandlers)
Description copied from interface:Routing.Rules
Routes requests any specified method to provided handler(s). Request handler can callServerRequest.next()
to continue processing on the next registered handler.- Specified by:
anyOf
in interfaceRouting.Rules
- Parameters:
methods
- HTTP methodsrequestHandlers
- handlers to tryProcess HTTP request- Returns:
- an updated routing configuration
-
anyOf
public Routing.Builder anyOf(Iterable<Http.RequestMethod> methods, String pathPattern, Handler... requestHandlers)
Description copied from interface:Routing.Rules
Routes requests with any specified method and corresponding path to provided handler(s). Request handler can callServerRequest.next()
to continue processing on the next registered handler.- Specified by:
anyOf
in interfaceRouting.Rules
- Parameters:
methods
- HTTP methodspathPattern
- a URI path pattern. SeePathMatcher
for pattern syntax reference.requestHandlers
- handlers to tryProcess HTTP request- Returns:
- an updated routing configuration
-
anyOf
public Routing.Builder anyOf(Iterable<Http.RequestMethod> methods, PathMatcher pathMatcher, Handler... requestHandlers)
Description copied from interface:Routing.Rules
Routes requests with any specified method and corresponding path to provided handler(s). Request handler can callServerRequest.next()
to continue processing on the next registered handler.- Specified by:
anyOf
in interfaceRouting.Rules
- Parameters:
methods
- HTTP methodspathMatcher
- define path for registered routerrequestHandlers
- handlers to tryProcess HTTP request- Returns:
- an updated routing configuration
-
onNewWebServer
public Routing.Builder onNewWebServer(Consumer<WebServer> webServerConsumer)
Description copied from interface:Routing.Rules
Registers callback on created newWebServer
instance with this routing.- Specified by:
onNewWebServer
in interfaceRouting.Rules
- Parameters:
webServerConsumer
- a WebServer creation callback- Returns:
- updated routing configuration
-
error
public <T extends Throwable> Routing.Builder error(Class<T> exceptionClass, ErrorHandler<T> errorHandler)
Registers an error handler that handles the given type of exceptions.- Type Parameters:
T
- an error handler type- Parameters:
exceptionClass
- the type of exception to handle by this handlererrorHandler
- the error handler- Returns:
- an updated builder
-
build
public Routing build()
Builds a new routing instance.
-
createServer
public WebServer createServer(ServerConfiguration configuration)
Creates newWebServer
instance with provided configuration and this routing.- Parameters:
configuration
- a web server configuration- Returns:
- new
WebServer
instance - Throws:
IllegalStateException
- if none SPI implementation found
-
createServer
public WebServer createServer(ServerConfiguration.Builder configurationBuilder)
Creates newWebServer
instance with provided configuration and this routing.- Parameters:
configurationBuilder
- a web server configuration builder- Returns:
- new
WebServer
instance - Throws:
IllegalStateException
- if none SPI implementation found
-
createServer
public WebServer createServer()
Creates newWebServer
instance with this routing and default configuration.- Returns:
- new
WebServer
instance - Throws:
IllegalStateException
- if none SPI implementation found
-
-