| Package | Description |
|---|---|
| org.springframework.web.servlet.function |
Provides the types that make up Spring's functional web framework for Servlet environments.
|
| Modifier and Type | Interface and Description |
|---|---|
interface |
HandlerFilterFunction<T extends ServerResponse,R extends ServerResponse>
Represents a function that filters a handler function.
|
interface |
HandlerFilterFunction<T extends ServerResponse,R extends ServerResponse>
Represents a function that filters a handler function.
|
interface |
HandlerFunction<T extends ServerResponse>
Represents a function that handles a request.
|
interface |
RouterFunction<T extends ServerResponse>
Represents a function that routes to a handler function.
|
| Modifier and Type | Interface and Description |
|---|---|
interface |
AsyncServerResponse
Asynchronous subtype of
ServerResponse that exposes the future
response. |
interface |
EntityResponse<T>
Entity-specific subtype of
ServerResponse that exposes entity data. |
interface |
RenderingResponse
Rendering-specific subtype of
ServerResponse that exposes model and template data. |
| Modifier and Type | Method and Description |
|---|---|
static <T extends ServerResponse> |
RouterFunctions.changeParser(RouterFunction<T> routerFunction,
org.springframework.web.util.pattern.PathPatternParser parser)
Changes the
PathPatternParser on the given router function. |
default <S extends ServerResponse> |
RouterFunction.filter(HandlerFilterFunction<T,S> filterFunction)
Filter all handler functions routed by this function with the given
filter function.
|
static <T extends ServerResponse> |
RouterFunctions.nest(RequestPredicate predicate,
RouterFunction<T> routerFunction)
Route to the given router function if the given request predicate applies.
|
static <T extends ServerResponse> |
HandlerFilterFunction.ofErrorHandler(java.util.function.Predicate<java.lang.Throwable> predicate,
java.util.function.BiFunction<java.lang.Throwable,ServerRequest,T> errorHandler)
Adapt the given predicate and response provider function to a filter function that returns
a
ServerResponse on a given exception. |
static <T extends ServerResponse> |
HandlerFilterFunction.ofRequestProcessor(java.util.function.Function<ServerRequest,ServerRequest> requestProcessor)
Adapt the given request processor function to a filter function that only operates
on the
ServerRequest. |
static <T extends ServerResponse,R extends ServerResponse> |
HandlerFilterFunction.ofResponseProcessor(java.util.function.BiFunction<ServerRequest,T,R> responseProcessor)
Adapt the given response processor function to a filter function that only operates
on the
ServerResponse. |
static <T extends ServerResponse,R extends ServerResponse> |
HandlerFilterFunction.ofResponseProcessor(java.util.function.BiFunction<ServerRequest,T,R> responseProcessor)
Adapt the given response processor function to a filter function that only operates
on the
ServerResponse. |
static <T extends ServerResponse> |
RouterFunctions.route(RequestPredicate predicate,
HandlerFunction<T> handlerFunction)
Route to the given handler function if the given request predicate applies.
|
| Modifier and Type | Method and Description |
|---|---|
static ServerResponse |
ServerResponse.async(java.lang.Object asyncResponse)
Create a (built) response with the given asynchronous response.
|
static ServerResponse |
ServerResponse.async(java.lang.Object asyncResponse,
java.time.Duration timeout)
Create a (built) response with the given asynchronous response.
|
ServerResponse |
AsyncServerResponse.block()
Blocks indefinitely until the future response is obtained.
|
ServerResponse |
ServerResponse.BodyBuilder.body(java.lang.Object body)
Set the body of the response to the given
Object and return
it. |
<T> ServerResponse |
ServerResponse.BodyBuilder.body(T body,
org.springframework.core.ParameterizedTypeReference<T> bodyType)
Set the body of the response to the given
Object and return it. |
ServerResponse |
ServerResponse.HeadersBuilder.build()
Build the response entity with no body.
|
ServerResponse |
ServerResponse.HeadersBuilder.build(java.util.function.BiFunction<javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse,ModelAndView> writeFunction)
Build the response entity with a custom write function.
|
ServerResponse |
ServerResponse.BodyBuilder.render(java.lang.String name,
java.util.Map<java.lang.String,?> model)
Render the template with the given
name using the given model. |
ServerResponse |
ServerResponse.BodyBuilder.render(java.lang.String name,
java.lang.Object... modelAttributes)
Render the template with the given
name using the given modelAttributes. |
static ServerResponse |
ServerResponse.sse(java.util.function.Consumer<ServerResponse.SseBuilder> consumer)
Create a server-sent event response.
|
static ServerResponse |
ServerResponse.sse(java.util.function.Consumer<ServerResponse.SseBuilder> consumer,
java.time.Duration timeout)
Create a server-sent event response.
|
| Modifier and Type | Method and Description |
|---|---|
RouterFunction<ServerResponse> |
RouterFunctions.Builder.build()
Builds the
RouterFunction. |
default java.util.Optional<ServerResponse> |
ServerRequest.checkNotModified(java.time.Instant lastModified)
Check whether the requested resource has been modified given the
supplied last-modified timestamp (as determined by the application).
|
default java.util.Optional<ServerResponse> |
ServerRequest.checkNotModified(java.time.Instant lastModified,
java.lang.String etag)
Check whether the requested resource has been modified given the
supplied
ETag (entity tag) and last-modified timestamp,
as determined by the application. |
default java.util.Optional<ServerResponse> |
ServerRequest.checkNotModified(java.lang.String etag)
Check whether the requested resource has been modified given the
supplied
ETag (entity tag), as determined by the application. |
static RouterFunction<ServerResponse> |
RouterFunctions.resources(java.util.function.Function<ServerRequest,java.util.Optional<org.springframework.core.io.Resource>> lookupFunction)
Route to resources using the provided lookup function.
|
static RouterFunction<ServerResponse> |
RouterFunctions.resources(java.lang.String pattern,
org.springframework.core.io.Resource location)
Route requests that match the given pattern to resources relative to the given root location.
|
| Modifier and Type | Method and Description |
|---|---|
static ServerResponse.BodyBuilder |
ServerResponse.from(ServerResponse other)
Create a builder with the status code and headers of the given response.
|
| Modifier and Type | Method and Description |
|---|---|
RouterFunctions.Builder |
RouterFunctions.Builder.add(RouterFunction<ServerResponse> routerFunction)
Adds the given route to this builder.
|
RouterFunctions.Builder |
RouterFunctions.Builder.after(java.util.function.BiFunction<ServerRequest,ServerResponse,ServerResponse> responseProcessor)
Filter the response object for all routes created by this builder with the given response
processing function.
|
RouterFunctions.Builder |
RouterFunctions.Builder.after(java.util.function.BiFunction<ServerRequest,ServerResponse,ServerResponse> responseProcessor)
Filter the response object for all routes created by this builder with the given response
processing function.
|
RouterFunctions.Builder |
RouterFunctions.Builder.DELETE(HandlerFunction<ServerResponse> handlerFunction)
Adds a route to the given handler function that handles HTTP
DELETE requests. |
RouterFunctions.Builder |
RouterFunctions.Builder.DELETE(RequestPredicate predicate,
HandlerFunction<ServerResponse> handlerFunction)
Adds a route to the given handler function that handles all HTTP
DELETE requests
that match the given predicate. |
RouterFunctions.Builder |
RouterFunctions.Builder.DELETE(java.lang.String pattern,
HandlerFunction<ServerResponse> handlerFunction)
Adds a route to the given handler function that handles all HTTP
DELETE requests
that match the given pattern. |
RouterFunctions.Builder |
RouterFunctions.Builder.DELETE(java.lang.String pattern,
RequestPredicate predicate,
HandlerFunction<ServerResponse> handlerFunction)
Adds a route to the given handler function that handles all HTTP
DELETE requests
that match the given pattern and predicate. |
RouterFunctions.Builder |
RouterFunctions.Builder.filter(HandlerFilterFunction<ServerResponse,ServerResponse> filterFunction)
Filters all routes created by this builder with the given filter function.
|
RouterFunctions.Builder |
RouterFunctions.Builder.filter(HandlerFilterFunction<ServerResponse,ServerResponse> filterFunction)
Filters all routes created by this builder with the given filter function.
|
RouterFunctions.Builder |
RouterFunctions.Builder.GET(HandlerFunction<ServerResponse> handlerFunction)
Adds a route to the given handler function that handles HTTP
GET requests. |
RouterFunctions.Builder |
RouterFunctions.Builder.GET(RequestPredicate predicate,
HandlerFunction<ServerResponse> handlerFunction)
Adds a route to the given handler function that handles all HTTP
GET requests
that match the given predicate. |
RouterFunctions.Builder |
RouterFunctions.Builder.GET(java.lang.String pattern,
HandlerFunction<ServerResponse> handlerFunction)
Adds a route to the given handler function that handles all HTTP
GET requests
that match the given pattern. |
RouterFunctions.Builder |
RouterFunctions.Builder.GET(java.lang.String pattern,
RequestPredicate predicate,
HandlerFunction<ServerResponse> handlerFunction)
Adds a route to the given handler function that handles all HTTP
GET requests
that match the given pattern and predicate. |
RouterFunctions.Builder |
RouterFunctions.Builder.HEAD(HandlerFunction<ServerResponse> handlerFunction)
Adds a route to the given handler function that handles HTTP
HEAD requests. |
RouterFunctions.Builder |
RouterFunctions.Builder.HEAD(RequestPredicate predicate,
HandlerFunction<ServerResponse> handlerFunction)
Adds a route to the given handler function that handles all HTTP
HEAD requests
that match the given predicate. |
RouterFunctions.Builder |
RouterFunctions.Builder.HEAD(java.lang.String pattern,
HandlerFunction<ServerResponse> handlerFunction)
Adds a route to the given handler function that handles all HTTP
HEAD requests
that match the given pattern. |
RouterFunctions.Builder |
RouterFunctions.Builder.HEAD(java.lang.String pattern,
RequestPredicate predicate,
HandlerFunction<ServerResponse> handlerFunction)
Adds a route to the given handler function that handles all HTTP
HEAD requests
that match the given pattern and predicate. |
RouterFunctions.Builder |
RouterFunctions.Builder.nest(RequestPredicate predicate,
java.util.function.Supplier<RouterFunction<ServerResponse>> routerFunctionSupplier)
Route to the supplied router function if the given request predicate applies.
|
RouterFunctions.Builder |
RouterFunctions.Builder.onError(java.lang.Class<? extends java.lang.Throwable> exceptionType,
java.util.function.BiFunction<java.lang.Throwable,ServerRequest,ServerResponse> responseProvider)
Filters all exceptions of the given type by applying the given response provider
function.
|
RouterFunctions.Builder |
RouterFunctions.Builder.onError(java.util.function.Predicate<java.lang.Throwable> predicate,
java.util.function.BiFunction<java.lang.Throwable,ServerRequest,ServerResponse> responseProvider)
Filters all exceptions that match the predicate by applying the given response provider
function.
|
RouterFunctions.Builder |
RouterFunctions.Builder.OPTIONS(HandlerFunction<ServerResponse> handlerFunction)
Adds a route to the given handler function that handles HTTP
OPTIONS requests. |
RouterFunctions.Builder |
RouterFunctions.Builder.OPTIONS(RequestPredicate predicate,
HandlerFunction<ServerResponse> handlerFunction)
Adds a route to the given handler function that handles all HTTP
OPTIONS requests
that match the given predicate. |
RouterFunctions.Builder |
RouterFunctions.Builder.OPTIONS(java.lang.String pattern,
HandlerFunction<ServerResponse> handlerFunction)
Adds a route to the given handler function that handles all HTTP
OPTIONS requests
that match the given pattern. |
RouterFunctions.Builder |
RouterFunctions.Builder.OPTIONS(java.lang.String pattern,
RequestPredicate predicate,
HandlerFunction<ServerResponse> handlerFunction)
Adds a route to the given handler function that handles all HTTP
OPTIONS requests
that match the given pattern and predicate. |
RouterFunctions.Builder |
RouterFunctions.Builder.PATCH(HandlerFunction<ServerResponse> handlerFunction)
Adds a route to the given handler function that handles HTTP
PATCH requests. |
RouterFunctions.Builder |
RouterFunctions.Builder.PATCH(RequestPredicate predicate,
HandlerFunction<ServerResponse> handlerFunction)
Adds a route to the given handler function that handles all HTTP
PATCH requests
that match the given predicate. |
RouterFunctions.Builder |
RouterFunctions.Builder.PATCH(java.lang.String pattern,
HandlerFunction<ServerResponse> handlerFunction)
Adds a route to the given handler function that handles all HTTP
PATCH requests
that match the given pattern. |
RouterFunctions.Builder |
RouterFunctions.Builder.PATCH(java.lang.String pattern,
RequestPredicate predicate,
HandlerFunction<ServerResponse> handlerFunction)
Adds a route to the given handler function that handles all HTTP
PATCH requests
that match the given pattern and predicate. |
RouterFunctions.Builder |
RouterFunctions.Builder.path(java.lang.String pattern,
java.util.function.Supplier<RouterFunction<ServerResponse>> routerFunctionSupplier)
Route to the supplied router function if the given path prefix pattern applies.
|
RouterFunctions.Builder |
RouterFunctions.Builder.POST(HandlerFunction<ServerResponse> handlerFunction)
Adds a route to the given handler function that handles HTTP
POST requests. |
RouterFunctions.Builder |
RouterFunctions.Builder.POST(RequestPredicate predicate,
HandlerFunction<ServerResponse> handlerFunction)
Adds a route to the given handler function that handles all HTTP
POST requests
that match the given predicate. |
RouterFunctions.Builder |
RouterFunctions.Builder.POST(java.lang.String pattern,
HandlerFunction<ServerResponse> handlerFunction)
Adds a route to the given handler function that handles all HTTP
POST requests
that match the given pattern. |
RouterFunctions.Builder |
RouterFunctions.Builder.POST(java.lang.String pattern,
RequestPredicate predicate,
HandlerFunction<ServerResponse> handlerFunction)
Adds a route to the given handler function that handles all HTTP
POST requests
that match the given pattern and predicate. |
RouterFunctions.Builder |
RouterFunctions.Builder.PUT(HandlerFunction<ServerResponse> handlerFunction)
Adds a route to the given handler function that handles HTTP
PUT requests. |
RouterFunctions.Builder |
RouterFunctions.Builder.PUT(RequestPredicate predicate,
HandlerFunction<ServerResponse> handlerFunction)
Adds a route to the given handler function that handles all HTTP
PUT requests
that match the given predicate. |
RouterFunctions.Builder |
RouterFunctions.Builder.PUT(java.lang.String pattern,
HandlerFunction<ServerResponse> handlerFunction)
Adds a route to the given handler function that handles all HTTP
PUT requests
that match the given pattern. |
RouterFunctions.Builder |
RouterFunctions.Builder.PUT(java.lang.String pattern,
RequestPredicate predicate,
HandlerFunction<ServerResponse> handlerFunction)
Adds a route to the given handler function that handles all HTTP
PUT requests
that match the given pattern and predicate. |
RouterFunctions.Builder |
RouterFunctions.Builder.route(RequestPredicate predicate,
HandlerFunction<ServerResponse> handlerFunction)
Adds a route to the given handler function that handles all requests that match the
given predicate.
|