OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.net; | 5 package org.chromium.net; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 import android.text.TextUtils; | 8 import android.text.TextUtils; |
9 | 9 |
10 import org.apache.http.HttpStatus; | 10 import org.apache.http.HttpStatus; |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 @Override | 469 @Override |
470 public long getContentLength() { | 470 public long getContentLength() { |
471 return mContentLength; | 471 return mContentLength; |
472 } | 472 } |
473 | 473 |
474 @Override | 474 @Override |
475 public String getContentType() { | 475 public String getContentType() { |
476 return mContentType; | 476 return mContentType; |
477 } | 477 } |
478 | 478 |
479 | |
480 @Override | 479 @Override |
481 public String getHeader(String name) { | 480 public String getHeader(String name) { |
482 if (mConnection == null) { | 481 if (mConnection == null) { |
483 throw new IllegalStateException("Response headers not available"); | 482 throw new IllegalStateException("Response headers not available"); |
484 } | 483 } |
485 Map<String, List<String>> headerFields = mConnection.getHeaderFields(); | 484 Map<String, List<String>> headerFields = mConnection.getHeaderFields(); |
486 if (headerFields != null) { | 485 if (headerFields != null) { |
487 List<String> headerValues = headerFields.get(name); | 486 List<String> headerValues = headerFields.get(name); |
488 if (headerValues != null) { | 487 if (headerValues != null) { |
489 return TextUtils.join(", ", headerValues); | 488 return TextUtils.join(", ", headerValues); |
490 } | 489 } |
491 } | 490 } |
492 return null; | 491 return null; |
493 } | 492 } |
494 | 493 |
| 494 @Override |
| 495 public Map<String, List<String>> getAllHeaders() { |
| 496 if (mConnection == null) { |
| 497 throw new IllegalStateException("Response headers not available"); |
| 498 } |
| 499 return mConnection.getHeaderFields(); |
| 500 } |
| 501 |
495 private void validateNotStarted() { | 502 private void validateNotStarted() { |
496 if (mStarted) { | 503 if (mStarted) { |
497 throw new IllegalStateException("Request already started"); | 504 throw new IllegalStateException("Request already started"); |
498 } | 505 } |
499 } | 506 } |
500 } | 507 } |
OLD | NEW |