WebHandler.java 1.5 KB
Newer Older
R
Rossen Stoyanchev 已提交
1
/*
2
 * Copyright 2002-2016 the original author or authors.
R
Rossen Stoyanchev 已提交
3 4 5 6 7 8 9 10 11 12 13 14 15
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
R
Rossen Stoyanchev 已提交
16

17
package org.springframework.web.server;
R
Rossen Stoyanchev 已提交
18

19
import reactor.core.publisher.Mono;
20

21
import org.springframework.web.server.adapter.HttpWebHandlerAdapter;
22
import org.springframework.web.server.adapter.WebHttpHandlerBuilder;
23

R
Rossen Stoyanchev 已提交
24
/**
25
 * Contract to handle a web request.
R
Rossen Stoyanchev 已提交
26
 *
27
 * <p>Use {@link HttpWebHandlerAdapter} to adapt a {@code WebHandler} to an
R
Rossen Stoyanchev 已提交
28
 * {@link org.springframework.http.server.reactive.HttpHandler HttpHandler}.
29
 * The {@link WebHttpHandlerBuilder} provides a convenient way to do that while
R
Rossen Stoyanchev 已提交
30
 * also optionally configuring one or more filters and/or exception handlers.
R
Rossen Stoyanchev 已提交
31
 *
R
Rossen Stoyanchev 已提交
32
 * @author Rossen Stoyanchev
33
 * @since 5.0
R
Rossen Stoyanchev 已提交
34
 */
R
Rossen Stoyanchev 已提交
35
public interface WebHandler {
R
Rossen Stoyanchev 已提交
36

R
Rossen Stoyanchev 已提交
37
	/**
R
Rossen Stoyanchev 已提交
38 39 40
	 * Handle the web server exchange.
	 * @param exchange the current server exchange
	 * @return {@code Mono<Void>} to indicate when request handling is complete
R
Rossen Stoyanchev 已提交
41
	 */
42
	Mono<Void> handle(ServerWebExchange exchange);
R
Rossen Stoyanchev 已提交
43 44

}