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.Builderany(Handler... requestHandlers)Routes all requests to provided handler(s).Routing.Builderany(PathMatcher pathMatcher, Handler... requestHandlers)Routes all requests with corresponding path to provided handler(s).Routing.Builderany(String pathPattern, Handler... requestHandlers)Routes all requests with corresponding path to provided handler(s).Routing.BuilderanyOf(Iterable<Http.RequestMethod> methods, Handler... requestHandlers)Routes requests any specified method to provided handler(s).Routing.BuilderanyOf(Iterable<Http.RequestMethod> methods, PathMatcher pathMatcher, Handler... requestHandlers)Routes requests with any specified method and corresponding path to provided handler(s).Routing.BuilderanyOf(Iterable<Http.RequestMethod> methods, String pathPattern, Handler... requestHandlers)Routes requests with any specified method and corresponding path to provided handler(s).Routingbuild()Builds a new routing instance.WebServercreateServer()Creates newWebServerinstance with this routing and default configuration.WebServercreateServer(ServerConfiguration configuration)Creates newWebServerinstance with provided configuration and this routing.WebServercreateServer(ServerConfiguration.Builder configurationBuilder)Creates newWebServerinstance with provided configuration and this routing.Routing.Builderdelete(Handler... requestHandlers)Routes all DELETE requests to provided handler(s).Routing.Builderdelete(PathMatcher pathMatcher, Handler... requestHandlers)Routes DELETE requests with corresponding path to provided handler(s).Routing.Builderdelete(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.Builderget(Handler... requestHandlers)Routes all GET requests to provided handler(s).Routing.Builderget(PathMatcher pathMatcher, Handler... requestHandlers)Routes GET requests with corresponding path to provided handler(s).Routing.Builderget(String pathPattern, Handler... requestHandlers)Routes GET requests with corresponding path to provided handler(s).Routing.Builderhead(Handler... requestHandlers)Routes all HEAD requests to provided handler(s).Routing.Builderhead(PathMatcher pathMatcher, Handler... requestHandlers)Routes HEAD requests with corresponding path to provided handler(s).Routing.Builderhead(String pathPattern, Handler... requestHandlers)Routes HEAD requests with corresponding path to provided handler(s).Routing.BuilderonNewWebServer(Consumer<WebServer> webServerConsumer)Registers callback on created newWebServerinstance with this routing.Routing.Builderoptions(Handler... requestHandlers)Routes all OPTIONS requests to provided handler(s).Routing.Builderoptions(PathMatcher pathMatcher, Handler... requestHandlers)Routes OPTIONS requests with corresponding path to provided handler(s).Routing.Builderoptions(String pathPattern, Handler... requestHandlers)Routes OPTIONS requests with corresponding path to provided handler(s).Routing.Builderpost(Handler... requestHandlers)Routes all POST requests to provided handler(s).Routing.Builderpost(PathMatcher pathMatcher, Handler... requestHandlers)Routes POST requests with corresponding path to provided handler(s).Routing.Builderpost(String pathPattern, Handler... requestHandlers)Routes POST requests with corresponding path to provided handler(s).Routing.Builderput(Handler... requestHandlers)Routes all PUT requests to provided handler(s).Routing.Builderput(PathMatcher pathMatcher, Handler... requestHandlers)Routes PUT requests with corresponding path to provided handler(s).Routing.Builderput(String pathPattern, Handler... requestHandlers)Routes PUT requests with corresponding path to provided handler(s).Routing.Builderregister(Service... services)Registers builder consumer.Routing.Builderregister(WebTracingConfig webTracingConfig)Configuration of tracing for this routing.Routing.Builderregister(String pathPattern, Service... services)Registers builder consumer.Routing.Builderregister(String pathPattern, Supplier<? extends Service>... serviceBuilders)Registers builder consumer.Routing.Builderregister(Supplier<? extends Service>... serviceBuilders)Registers builder consumer.Routing.Buildertrace(Handler... requestHandlers)Routes all TRACE requests to provided handler(s).Routing.Buildertrace(PathMatcher pathMatcher, Handler... requestHandlers)Routes TRACE requests with corresponding path to provided handler(s).Routing.Buildertrace(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.RulesConfiguration 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:
registerin 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.RulesRegisters builder consumer. It enables to separate complex routing definitions to dedicated classes.- Specified by:
registerin 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.RulesRegisters builder consumer. It enables to separate complex routing definitions to dedicated classes.- Specified by:
registerin 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.RulesRegisters builder consumer. It enables to separate complex routing definitions to dedicated classes.- Specified by:
registerin interfaceRouting.Rules- Parameters:
pathPattern- a URI path pattern. SeePathMatcherfor 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.RulesRegisters builder consumer. It enables to separate complex routing definitions to dedicated classes.- Specified by:
registerin interfaceRouting.Rules- Parameters:
pathPattern- a URI path pattern. SeePathMatcherfor 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.RulesRoutes all GET requests to provided handler(s). Request handler can callServerRequest.next()to continue processing on the next registered handler.- Specified by:
getin 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.RulesRoutes GET requests with corresponding path to provided handler(s). Request handler can callServerRequest.next()to continue processing on the next registered handler.- Specified by:
getin interfaceRouting.Rules- Parameters:
pathPattern- a URI path pattern. SeePathMatcherfor 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.RulesRoutes GET requests with corresponding path to provided handler(s). Request handler can callServerRequest.next()to continue processing on the next registered handler.- Specified by:
getin interfaceRouting.Rules- Parameters:
pathMatcher- a URI path pattern. SeePathMatcherfor 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.RulesRoutes all PUT requests to provided handler(s). Request handler can callServerRequest.next()to continue processing on the next registered handler.- Specified by:
putin 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.RulesRoutes PUT requests with corresponding path to provided handler(s). Request handler can callServerRequest.next()to continue processing on the next registered handler.- Specified by:
putin interfaceRouting.Rules- Parameters:
pathPattern- a URI path pattern. SeePathMatcherfor 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.RulesRoutes PUT requests with corresponding path to provided handler(s). Request handler can callServerRequest.next()to continue processing on the next registered handler.- Specified by:
putin 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.RulesRoutes all POST requests to provided handler(s). Request handler can callServerRequest.next()to continue processing on the next registered handler.- Specified by:
postin 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.RulesRoutes POST requests with corresponding path to provided handler(s). Request handler can callServerRequest.next()to continue processing on the next registered handler.- Specified by:
postin interfaceRouting.Rules- Parameters:
pathPattern- a URI path pattern. SeePathMatcherfor 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.RulesRoutes POST requests with corresponding path to provided handler(s). Request handler can callServerRequest.next()to continue processing on the next registered handler.- Specified by:
postin 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.RulesRoutes all DELETE requests to provided handler(s). Request handler can callServerRequest.next()to continue processing on the next registered handler.- Specified by:
deletein 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.RulesRoutes DELETE requests with corresponding path to provided handler(s). Request handler can callServerRequest.next()to continue processing on the next registered handler.- Specified by:
deletein interfaceRouting.Rules- Parameters:
pathPattern- a URI path pattern. SeePathMatcherfor 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.RulesRoutes DELETE requests with corresponding path to provided handler(s). Request handler can callServerRequest.next()to continue processing on the next registered handler.- Specified by:
deletein 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.RulesRoutes all OPTIONS requests to provided handler(s). Request handler can callServerRequest.next()to continue processing on the next registered handler.- Specified by:
optionsin 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.RulesRoutes OPTIONS requests with corresponding path to provided handler(s). Request handler can callServerRequest.next()to continue processing on the next registered handler.- Specified by:
optionsin interfaceRouting.Rules- Parameters:
pathPattern- a URI path pattern. SeePathMatcherfor 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.RulesRoutes OPTIONS requests with corresponding path to provided handler(s). Request handler can callServerRequest.next()to continue processing on the next registered handler.- Specified by:
optionsin 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.RulesRoutes all HEAD requests to provided handler(s). Request handler can callServerRequest.next()to continue processing on the next registered handler.- Specified by:
headin 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.RulesRoutes HEAD requests with corresponding path to provided handler(s). Request handler can callServerRequest.next()to continue processing on the next registered handler.- Specified by:
headin interfaceRouting.Rules- Parameters:
pathPattern- a URI path pattern. SeePathMatcherfor 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.RulesRoutes HEAD requests with corresponding path to provided handler(s). Request handler can callServerRequest.next()to continue processing on the next registered handler.- Specified by:
headin 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.RulesRoutes all TRACE requests to provided handler(s). Request handler can callServerRequest.next()to continue processing on the next registered handler.- Specified by:
tracein 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.RulesRoutes TRACE requests with corresponding path to provided handler(s). Request handler can callServerRequest.next()to continue processing on the next registered handler.- Specified by:
tracein interfaceRouting.Rules- Parameters:
pathPattern- a URI path pattern. SeePathMatcherfor 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.RulesRoutes TRACE requests with corresponding path to provided handler(s). Request handler can callServerRequest.next()to continue processing on the next registered handler.- Specified by:
tracein 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.RulesRoutes all requests to provided handler(s). Request handler can callServerRequest.next()to continue processing on the next registered handler.- Specified by:
anyin 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.RulesRoutes all requests with corresponding path to provided handler(s). Request handler can callServerRequest.next()to continue processing on the next registered handler.- Specified by:
anyin interfaceRouting.Rules- Parameters:
pathPattern- a URI path pattern. SeePathMatcherfor 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.RulesRoutes all requests with corresponding path to provided handler(s). Request handler can callServerRequest.next()to continue processing on the next registered handler.- Specified by:
anyin 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.RulesRoutes requests any specified method to provided handler(s). Request handler can callServerRequest.next()to continue processing on the next registered handler.- Specified by:
anyOfin 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.RulesRoutes 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:
anyOfin interfaceRouting.Rules- Parameters:
methods- HTTP methodspathPattern- a URI path pattern. SeePathMatcherfor 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.RulesRoutes 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:
anyOfin 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.RulesRegisters callback on created newWebServerinstance with this routing.- Specified by:
onNewWebServerin 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 newWebServerinstance with provided configuration and this routing.- Parameters:
configuration- a web server configuration- Returns:
- new
WebServerinstance - Throws:
IllegalStateException- if none SPI implementation found
-
createServer
public WebServer createServer(ServerConfiguration.Builder configurationBuilder)
Creates newWebServerinstance with provided configuration and this routing.- Parameters:
configurationBuilder- a web server configuration builder- Returns:
- new
WebServerinstance - Throws:
IllegalStateException- if none SPI implementation found
-
createServer
public WebServer createServer()
Creates newWebServerinstance with this routing and default configuration.- Returns:
- new
WebServerinstance - Throws:
IllegalStateException- if none SPI implementation found
-
-