Top Description Inners Fields Constructors Methods
org.springframework.web.servlet.function

pack-priv Class RouterFunctionBuilder

extends Object
implements Builder
Class Inheritance
All Implemented Interfaces
org.springframework.web.servlet.function.RouterFunctions.Builder
Imports
java.util.ArrayList, .List, .Map, .Optional, java.util.function.BiConsumer, .BiFunction, .Consumer, .Function, .Predicate, .Supplier, java.util.stream.Stream, org.springframework.core.io.Resource, org.springframework.http.HttpHeaders, .HttpMethod, org.springframework.util.Assert

Default implementation of RouterFunctions.Builder.
Authors
Arjen Poutsma, Sebastien Deleuze
Since
5.2

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
RouterFunctionBuilder.BuiltRouterFunction

Router function returned by build() that simply iterates over the registered routes.

Field Summary

Modifier and TypeField and Description
private final List<HandlerFilterFunction<ServerResponse, ServerResponse>>
private final List<HandlerFilterFunction<ServerResponse, ServerResponse>>
private final List<RouterFunction<ServerResponse>>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public RouterFunctions.Builder
add(RouterFunction<ServerResponse>
the router function to be added
routerFunction
)

Implements org.springframework.web.servlet.function.RouterFunctions.Builder.add.

Adds the given route to this builder.

private RouterFunctions.Builder
add(RequestPredicate predicate, HandlerFunction<ServerResponse> handlerFunction)

public RouterFunctions.Builder
after(BiFunction<ServerRequest, ServerResponse, ServerResponse>
a function that transforms the response
responseProcessor
)

Implements org.springframework.web.servlet.function.RouterFunctions.Builder.after.

Filter the response object for all routes created by this builder with the given response processing function.

public RouterFunctions.Builder
before(Function<ServerRequest, ServerRequest>
a function that transforms the request
requestProcessor
)

Implements org.springframework.web.servlet.function.RouterFunctions.Builder.before.

Filter the request object for all routes created by this builder with the given request processing function.

public RouterFunction<ServerResponse>
public RouterFunctions.Builder
DELETE(HandlerFunction<ServerResponse>
the handler function to handle all DELETE requests
handlerFunction
)

Implements org.springframework.web.servlet.function.RouterFunctions.Builder.DELETE.

Adds a route to the given handler function that handles HTTP DELETE requests.

public RouterFunctions.Builder
DELETE(RequestPredicate
predicate to match
predicate
,
HandlerFunction<ServerResponse>
the handler function to handle all DELETE requests that match predicate
handlerFunction
)

Implements org.springframework.web.servlet.function.RouterFunctions.Builder.DELETE.

Adds a route to the given handler function that handles all HTTP DELETE requests that match the given predicate.

public RouterFunctions.Builder
DELETE(String
the pattern to match to
pattern
,
HandlerFunction<ServerResponse>
the handler function to handle all DELETE requests that match pattern
handlerFunction
)

Implements org.springframework.web.servlet.function.RouterFunctions.Builder.DELETE.

Adds a route to the given handler function that handles all HTTP DELETE requests that match the given pattern.

public RouterFunctions.Builder
DELETE(String
the pattern to match to
pattern
,
RequestPredicate
additional predicate to match
predicate
,
HandlerFunction<ServerResponse>
the handler function to handle all DELETE requests that match pattern
handlerFunction
)

Implements org.springframework.web.servlet.function.RouterFunctions.Builder.DELETE.

Adds a route to the given handler function that handles all HTTP DELETE requests that match the given pattern and predicate.

public RouterFunctions.Builder
filter(HandlerFilterFunction<ServerResponse, ServerResponse>
the function to filter all routes built by this builder
filterFunction
)

Implements org.springframework.web.servlet.function.RouterFunctions.Builder.filter.

Filters all routes created by this builder with the given filter function.

public RouterFunctions.Builder
GET(HandlerFunction<ServerResponse>
the handler function to handle all GET requests
handlerFunction
)

Implements org.springframework.web.servlet.function.RouterFunctions.Builder.GET.

Adds a route to the given handler function that handles HTTP GET requests.

public RouterFunctions.Builder
GET(RequestPredicate
predicate to match
predicate
,
HandlerFunction<ServerResponse>
the handler function to handle all GET requests that match predicate
handlerFunction
)

Implements org.springframework.web.servlet.function.RouterFunctions.Builder.GET.

Adds a route to the given handler function that handles all HTTP GET requests that match the given predicate.

public RouterFunctions.Builder
GET(String
the pattern to match to
pattern
,
HandlerFunction<ServerResponse>
the handler function to handle all GET requests that match pattern
handlerFunction
)

Implements org.springframework.web.servlet.function.RouterFunctions.Builder.GET.

Adds a route to the given handler function that handles all HTTP GET requests that match the given pattern.

public RouterFunctions.Builder
GET(String
the pattern to match to
pattern
,
RequestPredicate
additional predicate to match
predicate
,
HandlerFunction<ServerResponse>
the handler function to handle all GET requests that match pattern and the predicate
handlerFunction
)

Implements org.springframework.web.servlet.function.RouterFunctions.Builder.GET.

Adds a route to the given handler function that handles all HTTP GET requests that match the given pattern and predicate.

public RouterFunctions.Builder
HEAD(HandlerFunction<ServerResponse>
the handler function to handle all HEAD requests
handlerFunction
)

Implements org.springframework.web.servlet.function.RouterFunctions.Builder.HEAD.

Adds a route to the given handler function that handles HTTP HEAD requests.

public RouterFunctions.Builder
HEAD(RequestPredicate
predicate to match
predicate
,
HandlerFunction<ServerResponse>
the handler function to handle all HEAD requests that match predicate
handlerFunction
)

Implements org.springframework.web.servlet.function.RouterFunctions.Builder.HEAD.

Adds a route to the given handler function that handles all HTTP HEAD requests that match the given predicate.

public RouterFunctions.Builder
HEAD(String
the pattern to match to
pattern
,
HandlerFunction<ServerResponse>
the handler function to handle all HEAD requests that match pattern
handlerFunction
)

Implements org.springframework.web.servlet.function.RouterFunctions.Builder.HEAD.

Adds a route to the given handler function that handles all HTTP HEAD requests that match the given pattern.

public RouterFunctions.Builder
HEAD(String
the pattern to match to
pattern
,
RequestPredicate
additional predicate to match
predicate
,
HandlerFunction<ServerResponse>
the handler function to handle all HEAD requests that match pattern
handlerFunction
)

Implements org.springframework.web.servlet.function.RouterFunctions.Builder.HEAD.

Adds a route to the given handler function that handles all HTTP HEAD requests that match the given pattern and predicate.

public RouterFunctions.Builder
nest(RequestPredicate
the predicate to test
predicate
,
Consumer<RouterFunctions.Builder>
consumer for a Builder that provides the nested router function
builderConsumer
)

Implements org.springframework.web.servlet.function.RouterFunctions.Builder.nest.

Route to a built router function if the given request predicate applies.

public RouterFunctions.Builder
nest(RequestPredicate
the predicate to test
predicate
,
Supplier<RouterFunction<ServerResponse>>
supplier for the nested router function to delegate to if the predicate applies
routerFunctionSupplier
)

Implements org.springframework.web.servlet.function.RouterFunctions.Builder.nest.

Route to the supplied router function if the given request predicate applies.

public RouterFunctions.Builder
onError(Predicate<Throwable>
the type of exception to filter
predicate
,
BiFunction<Throwable, ServerRequest, ServerResponse>
a function that creates a response
responseProvider
)

Implements org.springframework.web.servlet.function.RouterFunctions.Builder.onError.

Filters all exceptions that match the predicate by applying the given response provider function.

public RouterFunctions.Builder
onError(Class<? extends Throwable>
the type of exception to filter
exceptionType
,
BiFunction<Throwable, ServerRequest, ServerResponse>
a function that creates a response
responseProvider
)

Implements org.springframework.web.servlet.function.RouterFunctions.Builder.onError.

Filters all exceptions of the given type by applying the given response provider function.

public RouterFunctions.Builder
OPTIONS(HandlerFunction<ServerResponse>
the handler function to handle all OPTIONS requests
handlerFunction
)

Implements org.springframework.web.servlet.function.RouterFunctions.Builder.OPTIONS.

Adds a route to the given handler function that handles HTTP OPTIONS requests.

public RouterFunctions.Builder
OPTIONS(RequestPredicate
predicate to match
predicate
,
HandlerFunction<ServerResponse>
the handler function to handle all OPTIONS requests that match predicate
handlerFunction
)

Implements org.springframework.web.servlet.function.RouterFunctions.Builder.OPTIONS.

Adds a route to the given handler function that handles all HTTP OPTIONS requests that match the given predicate.

public RouterFunctions.Builder
OPTIONS(String
the pattern to match to
pattern
,
HandlerFunction<ServerResponse>
the handler function to handle all OPTIONS requests that match pattern
handlerFunction
)

Implements org.springframework.web.servlet.function.RouterFunctions.Builder.OPTIONS.

Adds a route to the given handler function that handles all HTTP OPTIONS requests that match the given pattern.

public RouterFunctions.Builder
OPTIONS(String
the pattern to match to
pattern
,
RequestPredicate
additional predicate to match
predicate
,
HandlerFunction<ServerResponse>
the handler function to handle all OPTIONS requests that match pattern
handlerFunction
)

Implements org.springframework.web.servlet.function.RouterFunctions.Builder.OPTIONS.

Adds a route to the given handler function that handles all HTTP OPTIONS requests that match the given pattern and predicate.

public RouterFunctions.Builder
PATCH(HandlerFunction<ServerResponse>
the handler function to handle all PATCH requests
handlerFunction
)

Implements org.springframework.web.servlet.function.RouterFunctions.Builder.PATCH.

Adds a route to the given handler function that handles HTTP PATCH requests.

public RouterFunctions.Builder
PATCH(RequestPredicate
predicate to match
predicate
,
HandlerFunction<ServerResponse>
the handler function to handle all PATCH requests that match predicate
handlerFunction
)

Implements org.springframework.web.servlet.function.RouterFunctions.Builder.PATCH.

Adds a route to the given handler function that handles all HTTP PATCH requests that match the given predicate.

public RouterFunctions.Builder
PATCH(String
the pattern to match to
pattern
,
HandlerFunction<ServerResponse>
the handler function to handle all PATCH requests that match pattern
handlerFunction
)

Implements org.springframework.web.servlet.function.RouterFunctions.Builder.PATCH.

Adds a route to the given handler function that handles all HTTP PATCH requests that match the given pattern.

public RouterFunctions.Builder
PATCH(String
the pattern to match to
pattern
,
RequestPredicate
additional predicate to match
predicate
,
HandlerFunction<ServerResponse>
the handler function to handle all PATCH requests that match pattern
handlerFunction
)

Implements org.springframework.web.servlet.function.RouterFunctions.Builder.PATCH.

Adds a route to the given handler function that handles all HTTP PATCH requests that match the given pattern and predicate.

public RouterFunctions.Builder
path(String
the pattern to match to
pattern
,
Consumer<RouterFunctions.Builder>
consumer for a Builder that provides the nested router function
builderConsumer
)

Implements org.springframework.web.servlet.function.RouterFunctions.Builder.path.

Route to a built router function if the given path prefix pattern applies.

public RouterFunctions.Builder
path(String
the pattern to match to
pattern
,
Supplier<RouterFunction<ServerResponse>>
supplier for the nested router function to delegate to if the pattern matches
routerFunctionSupplier
)

Implements org.springframework.web.servlet.function.RouterFunctions.Builder.path.

Route to the supplied router function if the given path prefix pattern applies.

public RouterFunctions.Builder
POST(HandlerFunction<ServerResponse>
the handler function to handle all POST requests
handlerFunction
)

Implements org.springframework.web.servlet.function.RouterFunctions.Builder.POST.

Adds a route to the given handler function that handles HTTP POST requests.

public RouterFunctions.Builder
POST(RequestPredicate
predicate to match
predicate
,
HandlerFunction<ServerResponse>
the handler function to handle all POST requests that match predicate
handlerFunction
)

Implements org.springframework.web.servlet.function.RouterFunctions.Builder.POST.

Adds a route to the given handler function that handles all HTTP POST requests that match the given predicate.

public RouterFunctions.Builder
POST(String
the pattern to match to
pattern
,
HandlerFunction<ServerResponse>
the handler function to handle all POST requests that match pattern
handlerFunction
)

Implements org.springframework.web.servlet.function.RouterFunctions.Builder.POST.

Adds a route to the given handler function that handles all HTTP POST requests that match the given pattern.

public RouterFunctions.Builder
POST(String
the pattern to match to
pattern
,
RequestPredicate
additional predicate to match
predicate
,
HandlerFunction<ServerResponse>
the handler function to handle all POST requests that match pattern
handlerFunction
)

Implements org.springframework.web.servlet.function.RouterFunctions.Builder.POST.

Adds a route to the given handler function that handles all HTTP POST requests that match the given pattern and predicate.

public RouterFunctions.Builder
PUT(HandlerFunction<ServerResponse>
the handler function to handle all PUT requests
handlerFunction
)

Implements org.springframework.web.servlet.function.RouterFunctions.Builder.PUT.

Adds a route to the given handler function that handles HTTP PUT requests.

public RouterFunctions.Builder
PUT(RequestPredicate
predicate to match
predicate
,
HandlerFunction<ServerResponse>
the handler function to handle all PUT requests that match predicate
handlerFunction
)

Implements org.springframework.web.servlet.function.RouterFunctions.Builder.PUT.

Adds a route to the given handler function that handles all HTTP PUT requests that match the given predicate.

public RouterFunctions.Builder
PUT(String
the pattern to match to
pattern
,
HandlerFunction<ServerResponse>
the handler function to handle all PUT requests that match pattern
handlerFunction
)

Implements org.springframework.web.servlet.function.RouterFunctions.Builder.PUT.

Adds a route to the given handler function that handles all HTTP PUT requests that match the given pattern.

public RouterFunctions.Builder
PUT(String
the pattern to match to
pattern
,
RequestPredicate
additional predicate to match
predicate
,
HandlerFunction<ServerResponse>
the handler function to handle all PUT requests that match pattern
handlerFunction
)

Implements org.springframework.web.servlet.function.RouterFunctions.Builder.PUT.

Adds a route to the given handler function that handles all HTTP PUT requests that match the given pattern and predicate.

public RouterFunctions.Builder
resource(RequestPredicate
predicate to match
predicate
,
Resource
the resources to serve
resource
)

Implements org.springframework.web.servlet.function.RouterFunctions.Builder.resource.

Route requests that match the given predicate to the given resource.

public RouterFunctions.Builder
resource(RequestPredicate
predicate to match
predicate
,
Resource
the resources to serve
resource
,
BiConsumer<Resource, HttpHeaders>
provides access to the HTTP headers for served resources
headersConsumer
)

Implements org.springframework.web.servlet.function.RouterFunctions.Builder.resource.

Route requests that match the given predicate to the given resource.

public RouterFunctions.Builder
resources(String
the pattern to match
pattern
,
Resource
the location directory relative to which resources should be resolved
location
)

Implements org.springframework.web.servlet.function.RouterFunctions.Builder.resources.

Route requests that match the given pattern to resources relative to the given root location.

public RouterFunctions.Builder
resources(String
the pattern to match
pattern
,
Resource
the location directory relative to which resources should be resolved
location
,
BiConsumer<Resource, HttpHeaders>
provides access to the HTTP headers for served resources
headersConsumer
)

Implements org.springframework.web.servlet.function.RouterFunctions.Builder.resources.

Route requests that match the given pattern to resources relative to the given root location.

public RouterFunctions.Builder
resources(Function<ServerRequest, Optional<Resource>>
the function to provide a Resource given the ServerRequest
lookupFunction
)

Implements org.springframework.web.servlet.function.RouterFunctions.Builder.resources.

Route to resources using the provided lookup function.

public RouterFunctions.Builder
resources(Function<ServerRequest, Optional<Resource>>
the function to provide a Resource given the ServerRequest
lookupFunction
,
BiConsumer<Resource, HttpHeaders>
provides access to the HTTP headers for served resources
headersConsumer
)

Implements org.springframework.web.servlet.function.RouterFunctions.Builder.resources.

Route to resources using the provided lookup function.

public RouterFunctions.Builder
route(RequestPredicate
the request predicate to match
predicate
,
HandlerFunction<ServerResponse>
the handler function to handle all requests that match the predicate
handlerFunction
)

Implements org.springframework.web.servlet.function.RouterFunctions.Builder.route.

Adds a route to the given handler function that handles all requests that match the given predicate.

public RouterFunctions.Builder
withAttribute(String
the attribute name
name
,
Object
the attribute value
value
)

Implements org.springframework.web.servlet.function.RouterFunctions.Builder.withAttribute.

Add an attribute with the given name and value to the last route built with this builder.

public RouterFunctions.Builder
withAttributes(Consumer<Map<String, Object>>
a function that consumes the attributes map
attributesConsumer
)

Implements org.springframework.web.servlet.function.RouterFunctions.Builder.withAttributes.

Manipulate the attributes of the last route built with the given consumer.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait