接口的使用
org.springframework.web.servlet.function.ServerResponse
使用ServerResponse的程序包 程序包 说明 org.springframework.web.servlet.function Provides the types that make up Spring's functional web framework for Servlet environments.org.springframework.web.servlet.function中ServerResponse的使用
类型参数类型为ServerResponse的org.springframework.web.servlet.function中的类 修饰符和类型 接口 说明 interfaceHandlerFilterFunction<T extends ServerResponse,R extends ServerResponse>Represents a function that filters a handler function.interfaceHandlerFilterFunction<T extends ServerResponse,R extends ServerResponse>Represents a function that filters a handler function.interfaceHandlerFunction<T extends ServerResponse>Represents a function that handles a request.interfaceRouterFunction<T extends ServerResponse>Represents a function that routes to a handler function.org.springframework.web.servlet.function中ServerResponse的子接口 修饰符和类型 接口 说明 interfaceEntityResponse<T>Entity-specific subtype ofServerResponsethat exposes entity data.interfaceRenderingResponseRendering-specific subtype ofServerResponsethat exposes model and template data.类型参数类型为ServerResponse的org.springframework.web.servlet.function中的方法 修饰符和类型 方法 说明 default <S extends ServerResponse>
RouterFunction<S>RouterFunction. filter(HandlerFilterFunction<T,S> filterFunction)Filter all handler functions routed by this function with the given filter function.static <T extends ServerResponse>
RouterFunction<T>RouterFunctions. nest(RequestPredicate predicate, RouterFunction<T> routerFunction)Route to the given router function if the given request predicate applies.static <T extends ServerResponse>
HandlerFilterFunction<T,T>HandlerFilterFunction. ofErrorHandler(Predicate<Throwable> predicate, BiFunction<Throwable,ServerRequest,T> errorHandler)Adapt the given predicate and response provider function to a filter function that returns aServerResponseon a given exception.static <T extends ServerResponse>
HandlerFilterFunction<T,T>HandlerFilterFunction. ofRequestProcessor(Function<ServerRequest,ServerRequest> requestProcessor)Adapt the given request processor function to a filter function that only operates on theServerRequest.static <T extends ServerResponse,R extends ServerResponse>
HandlerFilterFunction<T,R>HandlerFilterFunction. ofResponseProcessor(BiFunction<ServerRequest,T,R> responseProcessor)Adapt the given response processor function to a filter function that only operates on theServerResponse.static <T extends ServerResponse,R extends ServerResponse>
HandlerFilterFunction<T,R>HandlerFilterFunction. ofResponseProcessor(BiFunction<ServerRequest,T,R> responseProcessor)Adapt the given response processor function to a filter function that only operates on theServerResponse.static <T extends ServerResponse>
RouterFunction<T>RouterFunctions. route(RequestPredicate predicate, HandlerFunction<T> handlerFunction)Route to the given handler function if the given request predicate applies.返回ServerResponse的org.springframework.web.servlet.function中的方法 修饰符和类型 方法 说明 ServerResponseServerResponse.BodyBuilder. body(Object body)Set the body of the response to the givenObjectand return it.<T> ServerResponseServerResponse.BodyBuilder. body(T body, ParameterizedTypeReference<T> bodyType)Set the body of the response to the givenObjectand return it.ServerResponseServerResponse.HeadersBuilder. build()Build the response entity with no body.ServerResponseServerResponse.HeadersBuilder. build(BiFunction<HttpServletRequest,HttpServletResponse,ModelAndView> writeFunction)Build the response entity with a custom write function.ServerResponseServerResponse.BodyBuilder. render(String name, Object... modelAttributes)Render the template with the givennameusing the givenmodelAttributes.ServerResponseServerResponse.BodyBuilder. render(String name, Map<String,?> model)Render the template with the givennameusing the givenmodel.返回变量类型为ServerResponse的类型的org.springframework.web.servlet.function中的方法 修饰符和类型 方法 说明 RouterFunction<ServerResponse>RouterFunctions.Builder. build()Builds theRouterFunction.default Optional<ServerResponse>ServerRequest. checkNotModified(String etag)Check whether the requested resource has been modified given the suppliedETag(entity tag), as determined by the application.default Optional<ServerResponse>ServerRequest. checkNotModified(Instant lastModified)Check whether the requested resource has been modified given the supplied last-modified timestamp (as determined by the application).default Optional<ServerResponse>ServerRequest. checkNotModified(Instant lastModified, String etag)Check whether the requested resource has been modified given the suppliedETag(entity tag) and last-modified timestamp, as determined by the application.static RouterFunction<ServerResponse>RouterFunctions. resources(String pattern, Resource location)Route requests that match the given pattern to resources relative to the given root location.static RouterFunction<ServerResponse>RouterFunctions. resources(Function<ServerRequest,Optional<Resource>> lookupFunction)Route to resources using the provided lookup function.参数类型为ServerResponse的org.springframework.web.servlet.function中的方法 修饰符和类型 方法 说明 static ServerResponse.BodyBuilderServerResponse. from(ServerResponse other)Create a builder with the status code and headers of the given response.类型变量类型为ServerResponse的org.springframework.web.servlet.function中的方法参数 修饰符和类型 方法 说明 RouterFunctions.BuilderRouterFunctions.Builder. add(RouterFunction<ServerResponse> routerFunction)Adds the given route to this builder.RouterFunctions.BuilderRouterFunctions.Builder. after(BiFunction<ServerRequest,ServerResponse,ServerResponse> responseProcessor)Filter the response object for all routes created by this builder with the given response processing function.RouterFunctions.BuilderRouterFunctions.Builder. after(BiFunction<ServerRequest,ServerResponse,ServerResponse> responseProcessor)Filter the response object for all routes created by this builder with the given response processing function.RouterFunctions.BuilderRouterFunctions.Builder. DELETE(String pattern, HandlerFunction<ServerResponse> handlerFunction)Adds a route to the given handler function that handles all HTTPDELETErequests that match the given pattern.RouterFunctions.BuilderRouterFunctions.Builder. DELETE(String pattern, RequestPredicate predicate, HandlerFunction<ServerResponse> handlerFunction)Adds a route to the given handler function that handles all HTTPDELETErequests that match the given pattern and predicate.RouterFunctions.BuilderRouterFunctions.Builder. filter(HandlerFilterFunction<ServerResponse,ServerResponse> filterFunction)Filters all routes created by this builder with the given filter function.RouterFunctions.BuilderRouterFunctions.Builder. filter(HandlerFilterFunction<ServerResponse,ServerResponse> filterFunction)Filters all routes created by this builder with the given filter function.RouterFunctions.BuilderRouterFunctions.Builder. GET(String pattern, HandlerFunction<ServerResponse> handlerFunction)Adds a route to the given handler function that handles all HTTPGETrequests that match the given pattern.RouterFunctions.BuilderRouterFunctions.Builder. GET(String pattern, RequestPredicate predicate, HandlerFunction<ServerResponse> handlerFunction)Adds a route to the given handler function that handles all HTTPGETrequests that match the given pattern and predicate.RouterFunctions.BuilderRouterFunctions.Builder. HEAD(String pattern, HandlerFunction<ServerResponse> handlerFunction)Adds a route to the given handler function that handles all HTTPHEADrequests that match the given pattern.RouterFunctions.BuilderRouterFunctions.Builder. HEAD(String pattern, RequestPredicate predicate, HandlerFunction<ServerResponse> handlerFunction)Adds a route to the given handler function that handles all HTTPHEADrequests that match the given pattern and predicate.RouterFunctions.BuilderRouterFunctions.Builder. nest(RequestPredicate predicate, Supplier<RouterFunction<ServerResponse>> routerFunctionSupplier)Route to the supplied router function if the given request predicate applies.RouterFunctions.BuilderRouterFunctions.Builder. onError(Class<? extends Throwable> exceptionType, BiFunction<Throwable,ServerRequest,ServerResponse> responseProvider)Filters all exceptions of the given type by applying the given response provider function.RouterFunctions.BuilderRouterFunctions.Builder. onError(Predicate<Throwable> predicate, BiFunction<Throwable,ServerRequest,ServerResponse> responseProvider)Filters all exceptions that match the predicate by applying the given response provider function.RouterFunctions.BuilderRouterFunctions.Builder. OPTIONS(String pattern, HandlerFunction<ServerResponse> handlerFunction)Adds a route to the given handler function that handles all HTTPOPTIONSrequests that match the given pattern.RouterFunctions.BuilderRouterFunctions.Builder. OPTIONS(String pattern, RequestPredicate predicate, HandlerFunction<ServerResponse> handlerFunction)Adds a route to the given handler function that handles all HTTPOPTIONSrequests that match the given pattern and predicate.RouterFunctions.BuilderRouterFunctions.Builder. PATCH(String pattern, HandlerFunction<ServerResponse> handlerFunction)Adds a route to the given handler function that handles all HTTPPATCHrequests that match the given pattern.RouterFunctions.BuilderRouterFunctions.Builder. PATCH(String pattern, RequestPredicate predicate, HandlerFunction<ServerResponse> handlerFunction)Adds a route to the given handler function that handles all HTTPPATCHrequests that match the given pattern and predicate.RouterFunctions.BuilderRouterFunctions.Builder. path(String pattern, Supplier<RouterFunction<ServerResponse>> routerFunctionSupplier)Route to the supplied router function if the given path prefix pattern applies.RouterFunctions.BuilderRouterFunctions.Builder. POST(String pattern, HandlerFunction<ServerResponse> handlerFunction)Adds a route to the given handler function that handles all HTTPPOSTrequests that match the given pattern.RouterFunctions.BuilderRouterFunctions.Builder. POST(String pattern, RequestPredicate predicate, HandlerFunction<ServerResponse> handlerFunction)Adds a route to the given handler function that handles all HTTPPOSTrequests that match the given pattern and predicate.RouterFunctions.BuilderRouterFunctions.Builder. PUT(String pattern, HandlerFunction<ServerResponse> handlerFunction)Adds a route to the given handler function that handles all HTTPPUTrequests that match the given pattern.RouterFunctions.BuilderRouterFunctions.Builder. PUT(String pattern, RequestPredicate predicate, HandlerFunction<ServerResponse> handlerFunction)Adds a route to the given handler function that handles all HTTPPUTrequests that match the given pattern and predicate.RouterFunctions.BuilderRouterFunctions.Builder. route(RequestPredicate predicate, HandlerFunction<ServerResponse> handlerFunction)Adds a route to the given handler function that handles all requests that match the given predicate.