001/* 002 * Copyright 2002-2018 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * https://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.springframework.http.server.reactive; 018 019import reactor.core.publisher.Mono; 020 021/** 022 * Lowest level contract for reactive HTTP request handling that serves as a 023 * common denominator across different runtimes. 024 * 025 * <p>Higher-level, but still generic, building blocks for applications such as 026 * {@code WebFilter}, {@code WebSession}, {@code ServerWebExchange}, and others 027 * are available in the {@code org.springframework.web.server} package. 028 * 029 * <p>Application level programming models such as annotated controllers and 030 * functional handlers are available in the {@code spring-webflux} module. 031 * 032 * <p>Typically an {@link HttpHandler} represents an entire application with 033 * higher-level programming models bridged via 034 * {@link org.springframework.web.server.adapter.WebHttpHandlerBuilder}. 035 * Multiple applications at unique context paths can be plugged in with the 036 * help of the {@link ContextPathCompositeHandler}. 037 * 038 * @author Arjen Poutsma 039 * @author Rossen Stoyanchev 040 * @since 5.0 041 * @see ContextPathCompositeHandler 042 */ 043public interface HttpHandler { 044 045 /** 046 * Handle the given request and write to the response. 047 * @param request current request 048 * @param response current response 049 * @return indicates completion of request handling 050 */ 051 Mono<Void> handle(ServerHttpRequest request, ServerHttpResponse response); 052 053}