< prev index next >

src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Response.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -23,10 +23,12 @@
  * questions.
  */
 
 package jdk.incubator.http;
 
+import java.net.URI;
+
 /**
  * Response headers and status code.
  */
 class Response {
     final HttpHeaders headers;

@@ -57,13 +59,28 @@
 
     HttpHeaders headers() {
         return headers;
     }
 
-    Exchange<?> exchange() {
-        return exchange;
-    }
+//    Exchange<?> exchange() {
+//        return exchange;
+//    }
 
     int statusCode() {
         return statusCode;
     }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        String method = request().method();
+        URI uri = request().uri();
+        String uristring = uri == null ? "" : uri.toString();
+        sb.append('(')
+          .append(method)
+          .append(" ")
+          .append(uristring)
+          .append(") ")
+          .append(statusCode());
+        return sb.toString();
+    }
 }
< prev index next >