File tree Expand file tree Collapse file tree 5 files changed +18
-14
lines changed
spring-web/src/main/java/org/springframework/http Expand file tree Collapse file tree 5 files changed +18
-14
lines changed Original file line number Diff line number Diff line change 11/*
2- * Copyright 2002-2010 the original author or authors.
2+ * Copyright 2002-2015 the original author or authors.
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
2323 * Represents an HTTP input message, consisting of {@linkplain #getHeaders() headers}
2424 * and a readable {@linkplain #getBody() body}.
2525 *
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.
2728 *
2829 * @author Arjen Poutsma
2930 * @since 3.0
@@ -32,7 +33,7 @@ public interface HttpInputMessage extends HttpMessage {
3233
3334 /**
3435 * 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})
3637 * @throws IOException in case of I/O Errors
3738 */
3839 InputStream getBody () throws IOException ;
Original file line number Diff line number Diff line change 11/*
2- * Copyright 2002-2009 the original author or authors.
2+ * Copyright 2002-2015 the original author or authors.
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
1717package org .springframework .http ;
1818
1919/**
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()}.
2222 *
2323 * @author Arjen Poutsma
2424 * @since 3.0
@@ -27,7 +27,7 @@ public interface HttpMessage {
2727
2828 /**
2929 * Return the headers of this message.
30- * @return a corresponding HttpHeaders object
30+ * @return a corresponding HttpHeaders object (never {@code null})
3131 */
3232 HttpHeaders getHeaders ();
3333
Original file line number Diff line number Diff line change 11/*
2- * Copyright 2002-2010 the original author or authors.
2+ * Copyright 2002-2015 the original author or authors.
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
2323 * Represents an HTTP output message, consisting of {@linkplain #getHeaders() headers}
2424 * and a writable {@linkplain #getBody() body}.
2525 *
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.
2728 *
2829 * @author Arjen Poutsma
2930 * @since 3.0
@@ -32,7 +33,7 @@ public interface HttpOutputMessage extends HttpMessage {
3233
3334 /**
3435 * 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})
3637 * @throws IOException in case of I/O Errors
3738 */
3839 OutputStream getBody () throws IOException ;
Original file line number Diff line number Diff line change 11/*
2- * Copyright 2002-2014 the original author or authors.
2+ * Copyright 2002-2015 the original author or authors.
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
1616
1717package org .springframework .http .client ;
1818
19+ import java .io .ByteArrayInputStream ;
1920import java .io .IOException ;
2021import java .io .InputStream ;
2122
@@ -72,7 +73,7 @@ public HttpHeaders getHeaders() {
7273 @ Override
7374 public InputStream getBody () throws IOException {
7475 HttpEntity entity = this .httpResponse .getEntity ();
75- return entity != null ? entity .getContent () : null ;
76+ return ( entity != null ? entity .getContent () : new ByteArrayInputStream ( new byte [ 0 ])) ;
7677 }
7778
7879 @ Override
Original file line number Diff line number Diff line change 11/*
2- * Copyright 2002-2014 the original author or authors.
2+ * Copyright 2002-2015 the original author or authors.
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
1616
1717package org .springframework .http .client ;
1818
19+ import java .io .ByteArrayInputStream ;
1920import java .io .IOException ;
2021import java .io .InputStream ;
2122
@@ -75,7 +76,7 @@ public HttpHeaders getHeaders() {
7576 @ Override
7677 public InputStream getBody () throws IOException {
7778 HttpEntity entity = this .httpResponse .getEntity ();
78- return (entity != null ? entity .getContent () : null );
79+ return (entity != null ? entity .getContent () : new ByteArrayInputStream ( new byte [ 0 ]) );
7980 }
8081
8182 @ Override
You can’t perform that action at this time.
0 commit comments