File tree Expand file tree Collapse file tree 4 files changed +15
-12
lines changed
spring-web/src/main/java/org/springframework/http Expand file tree Collapse file tree 4 files changed +15
-12
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2002-2010 the original author or authors.
2
+ * Copyright 2002-2015 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
23
23
* Represents an HTTP input message, consisting of {@linkplain #getHeaders() headers}
24
24
* and a readable {@linkplain #getBody() body}.
25
25
*
26
- * <p>Typically implemented by an HTTP request on the server-side, or a response on the client-side.
26
+ * <p>Typically implemented by an HTTP request handle on the server side,
27
+ * or an HTTP response handle on the client side.
27
28
*
28
29
* @author Arjen Poutsma
29
30
* @since 3.0
@@ -32,7 +33,7 @@ public interface HttpInputMessage extends HttpMessage {
32
33
33
34
/**
34
35
* Return the body of the message as an input stream.
35
- * @return the input stream body
36
+ * @return the input stream body (never {@code null})
36
37
* @throws IOException in case of I/O Errors
37
38
*/
38
39
InputStream getBody () throws IOException ;
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2002-2009 the original author or authors.
2
+ * Copyright 2002-2015 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
17
17
package org .springframework .http ;
18
18
19
19
/**
20
- * Represents the base interface for HTTP request and response messages. Consists of {@link HttpHeaders}, retrievable
21
- * via {@link #getHeaders()}.
20
+ * Represents the base interface for HTTP request and response messages.
21
+ * Consists of {@link HttpHeaders}, retrievable via {@link #getHeaders()}.
22
22
*
23
23
* @author Arjen Poutsma
24
24
* @since 3.0
@@ -27,7 +27,7 @@ public interface HttpMessage {
27
27
28
28
/**
29
29
* Return the headers of this message.
30
- * @return a corresponding HttpHeaders object
30
+ * @return a corresponding HttpHeaders object (never {@code null})
31
31
*/
32
32
HttpHeaders getHeaders ();
33
33
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2002-2010 the original author or authors.
2
+ * Copyright 2002-2015 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
23
23
* Represents an HTTP output message, consisting of {@linkplain #getHeaders() headers}
24
24
* and a writable {@linkplain #getBody() body}.
25
25
*
26
- * <p>Typically implemented by an HTTP request on the client-side, or a response on the server-side.
26
+ * <p>Typically implemented by an HTTP request handle on the client side,
27
+ * or an HTTP response handle on the server side.
27
28
*
28
29
* @author Arjen Poutsma
29
30
* @since 3.0
@@ -32,7 +33,7 @@ public interface HttpOutputMessage extends HttpMessage {
32
33
33
34
/**
34
35
* Return the body of the message as an output stream.
35
- * @return the output stream body
36
+ * @return the output stream body (never {@code null})
36
37
* @throws IOException in case of I/O Errors
37
38
*/
38
39
OutputStream getBody () throws IOException ;
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2002-2012 the original author or authors.
2
+ * Copyright 2002-2015 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
16
16
17
17
package org .springframework .http .client ;
18
18
19
+ import java .io .ByteArrayInputStream ;
19
20
import java .io .IOException ;
20
21
import java .io .InputStream ;
21
22
@@ -69,7 +70,7 @@ public HttpHeaders getHeaders() {
69
70
70
71
public InputStream getBody () throws IOException {
71
72
HttpEntity entity = this .httpResponse .getEntity ();
72
- return entity != null ? entity .getContent () : null ;
73
+ return ( entity != null ? entity .getContent () : new ByteArrayInputStream ( new byte [ 0 ])) ;
73
74
}
74
75
75
76
public void close () {
You can’t perform that action at this time.
0 commit comments