Java Code Examples for org.springframework.http.HttpStatus#is1xxInformational()
The following examples show how to use
org.springframework.http.HttpStatus#is1xxInformational() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MessageBodyClientHttpResponseWrapper.java From lams with GNU General Public License v2.0 | 6 votes |
/** * Indicates whether the response has a message body. * <p>Implementation returns {@code false} for: * <ul> * <li>a response status of {@code 1XX}, {@code 204} or {@code 304}</li> * <li>a {@code Content-Length} header of {@code 0}</li> * </ul> * @return {@code true} if the response has a message body, {@code false} otherwise * @throws IOException in case of I/O errors */ public boolean hasMessageBody() throws IOException { try { HttpStatus responseStatus = getStatusCode(); if (responseStatus.is1xxInformational() || responseStatus == HttpStatus.NO_CONTENT || responseStatus == HttpStatus.NOT_MODIFIED) { return false; } } catch (IllegalArgumentException ex) { // Ignore - unknown HTTP status code... } if (getHeaders().getContentLength() == 0) { return false; } return true; }
Example 2
Source File: MessageBodyClientHttpResponseWrapper.java From spring-analysis-note with MIT License | 5 votes |
/** * Indicates whether the response has a message body. * <p>Implementation returns {@code false} for: * <ul> * <li>a response status of {@code 1XX}, {@code 204} or {@code 304}</li> * <li>a {@code Content-Length} header of {@code 0}</li> * </ul> * @return {@code true} if the response has a message body, {@code false} otherwise * @throws IOException in case of I/O errors */ public boolean hasMessageBody() throws IOException { HttpStatus status = HttpStatus.resolve(getRawStatusCode()); if (status != null && (status.is1xxInformational() || status == HttpStatus.NO_CONTENT || status == HttpStatus.NOT_MODIFIED)) { return false; } if (getHeaders().getContentLength() == 0) { return false; } return true; }
Example 3
Source File: MessageBodyClientHttpResponseWrapper.java From java-technology-stack with MIT License | 5 votes |
/** * Indicates whether the response has a message body. * <p>Implementation returns {@code false} for: * <ul> * <li>a response status of {@code 1XX}, {@code 204} or {@code 304}</li> * <li>a {@code Content-Length} header of {@code 0}</li> * </ul> * @return {@code true} if the response has a message body, {@code false} otherwise * @throws IOException in case of I/O errors */ public boolean hasMessageBody() throws IOException { HttpStatus status = HttpStatus.resolve(getRawStatusCode()); if (status != null && (status.is1xxInformational() || status == HttpStatus.NO_CONTENT || status == HttpStatus.NOT_MODIFIED)) { return false; } if (getHeaders().getContentLength() == 0) { return false; } return true; }
Example 4
Source File: MessageBodyClientHttpResponseWrapper.java From spring4-understanding with Apache License 2.0 | 5 votes |
/** * Indicates whether the response has a message body. * <p>Implementation returns {@code false} for: * <ul> * <li>a response status of {@code 1XX}, {@code 204} or {@code 304}</li> * <li>a {@code Content-Length} header of {@code 0}</li> * </ul> * @return {@code true} if the response has a message body, {@code false} otherwise * @throws IOException in case of I/O errors */ public boolean hasMessageBody() throws IOException { HttpStatus responseStatus = this.getStatusCode(); if (responseStatus.is1xxInformational() || responseStatus == HttpStatus.NO_CONTENT || responseStatus == HttpStatus.NOT_MODIFIED) { return false; } else if (this.getHeaders().getContentLength() == 0) { return false; } return true; }