--- a/src/java.net.http/share/classes/java/net/http/HttpResponse.java Fri Feb 16 15:06:29 2018 +0000
+++ b/src/java.net.http/share/classes/java/net/http/HttpResponse.java Fri Feb 16 16:09:14 2018 +0000
@@ -77,19 +77,15 @@
*
* @since 11
*/
-public abstract class HttpResponse<T> {
+public interface HttpResponse<T> {
- /**
- * Creates an HttpResponse.
- */
- protected HttpResponse() { }
/**
* Returns the status code for this response.
*
* @return the response code
*/
- public abstract int statusCode();
+ public int statusCode();
/**
* Returns the {@link HttpRequest} corresponding to this response.
@@ -101,7 +97,7 @@
*
* @return the request
*/
- public abstract HttpRequest request();
+ public HttpRequest request();
/**
* Returns an {@code Optional} containing the previous intermediate response
@@ -111,14 +107,14 @@
*
* @return an Optional containing the HttpResponse, if any.
*/
- public abstract Optional<HttpResponse<T>> previousResponse();
+ public Optional<HttpResponse<T>> previousResponse();
/**
* Returns the received response headers.
*
* @return the response headers
*/
- public abstract HttpHeaders headers();
+ public HttpHeaders headers();
/**
* Returns the body. Depending on the type of {@code T}, the returned body
@@ -131,7 +127,7 @@
*
* @return the body
*/
- public abstract T body();
+ public T body();
/**
* Returns an {@link Optional} containing the {@link SSLSession} in effect
@@ -141,7 +137,7 @@
* @return an {@code Optional} containing the {@code SSLSession} associated
* with the response
*/
- public abstract Optional<SSLSession> sslSession();
+ public Optional<SSLSession> sslSession();
/**
* Returns the {@code URI} that the response was received from. This may be
@@ -149,14 +145,14 @@
*
* @return the URI of the response
*/
- public abstract URI uri();
+ public URI uri();
/**
* Returns the HTTP protocol version that was used for this response.
*
* @return HTTP protocol version
*/
- public abstract HttpClient.Version version();
+ public HttpClient.Version version();
private static String pathForSecurityCheck(Path path) {
--- a/src/java.net.http/share/classes/jdk/internal/net/http/HttpResponseImpl.java Fri Feb 16 15:06:29 2018 +0000
+++ b/src/java.net.http/share/classes/jdk/internal/net/http/HttpResponseImpl.java Fri Feb 16 16:09:14 2018 +0000
@@ -41,7 +41,7 @@
/**
* The implementation class for HttpResponse
*/
-class HttpResponseImpl<T> extends HttpResponse<T> implements RawChannel.Provider {
+class HttpResponseImpl<T> implements HttpResponse<T>, RawChannel.Provider {
final int responseCode;
final Exchange<T> exchange;
--- a/test/jdk/java/net/httpclient/ManyRequestsLegacy.java Fri Feb 16 15:06:29 2018 +0000
+++ b/test/jdk/java/net/httpclient/ManyRequestsLegacy.java Fri Feb 16 16:09:14 2018 +0000
@@ -116,7 +116,7 @@
static final boolean XFIXED = Boolean.getBoolean("test.XFixed");
static class LegacyHttpClient {
- static final class LegacyHttpResponse extends HttpResponse<byte[]> {
+ static final class LegacyHttpResponse implements HttpResponse<byte[]> {
final HttpRequest request;
final byte[] response;
final int statusCode;
--- a/test/jdk/java/net/httpclient/offline/FixedHttpResponse.java Fri Feb 16 15:06:29 2018 +0000
+++ b/test/jdk/java/net/httpclient/offline/FixedHttpResponse.java Fri Feb 16 16:09:14 2018 +0000
@@ -32,7 +32,7 @@
/**
* An HttpResponse consisting of the given state.
*/
-public class FixedHttpResponse<T> extends HttpResponse<T> {
+public class FixedHttpResponse<T> implements HttpResponse<T> {
private final int statusCode;
private final HttpRequest request;