Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(401)

Side by Side Diff: components/cronet/android/java/src/org/chromium/net/HttpUrlConnectionUrlRequest.java

Issue 423163007: Add method getAllHeaders to HttpUrlRequest. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments. Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | components/cronet/android/java/src/org/chromium/net/HttpUrlRequest.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 }
OLDNEW
« no previous file with comments | « no previous file | components/cronet/android/java/src/org/chromium/net/HttpUrlRequest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698