Browse Source
This commit introduces "reactive" sub-interfaces of the HttpMessage interface found in the Spring Framework.pull/1111/head
32 changed files with 310 additions and 153 deletions
@ -0,0 +1,41 @@
@@ -0,0 +1,41 @@
|
||||
/* |
||||
* Copyright 2002-2015 the original author or authors. |
||||
* |
||||
* 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. |
||||
*/ |
||||
|
||||
package org.springframework.http; |
||||
|
||||
import java.nio.ByteBuffer; |
||||
|
||||
import org.reactivestreams.Publisher; |
||||
|
||||
/** |
||||
* Represents a "reactive" HTTP output message, consisting of {@linkplain #getHeaders() headers} |
||||
* and the capability to add a {@linkplain #addBody(Publisher) body}. |
||||
* |
||||
* <p>Typically implemented by an HTTP request on the client-side, or a response on the server-side. |
||||
* |
||||
* @author Arjen Poutsma |
||||
*/ |
||||
public interface ReactiveHttpOutputMessage extends HttpMessage { |
||||
|
||||
/** |
||||
* Adds the given publisher of {@link ByteBuffer}s as a body. A HTTP/1.1 message has |
||||
* one body, but HTTP/1.2 supports multiple bodies. |
||||
* @param body the body to add |
||||
* @return a publisher that indicates completion |
||||
*/ |
||||
Publisher<Void> addBody(Publisher<ByteBuffer> body); |
||||
|
||||
} |
||||
@ -0,0 +1,59 @@
@@ -0,0 +1,59 @@
|
||||
/* |
||||
* Copyright 2002-2015 the original author or authors. |
||||
* |
||||
* 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. |
||||
*/ |
||||
|
||||
package org.springframework.http.client; |
||||
|
||||
import java.io.Closeable; |
||||
import java.io.IOException; |
||||
|
||||
import org.springframework.http.HttpStatus; |
||||
import org.springframework.http.ReactiveHttpInputMessage; |
||||
|
||||
/** |
||||
* Represents a "reactive" client-side HTTP response. |
||||
* |
||||
* @author Arjen Poutsma |
||||
*/ |
||||
public interface ReactiveClientHttpResponse extends ReactiveHttpInputMessage, Closeable { |
||||
|
||||
/** |
||||
* Return the HTTP status code of the response. |
||||
* @return the HTTP status as an HttpStatus enum value |
||||
* @throws IOException in case of I/O errors |
||||
*/ |
||||
HttpStatus getStatusCode() throws IOException; |
||||
|
||||
/** |
||||
* Return the HTTP status code of the response as integer |
||||
* @return the HTTP status as an integer |
||||
* @throws IOException in case of I/O errors |
||||
*/ |
||||
int getRawStatusCode() throws IOException; |
||||
|
||||
/** |
||||
* Return the HTTP status text of the response. |
||||
* @return the HTTP status text |
||||
* @throws IOException in case of I/O errors |
||||
*/ |
||||
String getStatusText() throws IOException; |
||||
|
||||
/** |
||||
* Close this response, freeing any resources created. |
||||
*/ |
||||
@Override |
||||
void close(); |
||||
|
||||
} |
||||
Loading…
Reference in new issue