Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id EB3E1200B8F for ; Thu, 25 Aug 2016 20:25:15 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id E9B91160ACB; Thu, 25 Aug 2016 18:25:15 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 911D4160AC8 for ; Thu, 25 Aug 2016 20:25:14 +0200 (CEST) Received: (qmail 20263 invoked by uid 500); 25 Aug 2016 18:25:12 -0000 Mailing-List: contact commits-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hbase.apache.org Delivered-To: mailing list commits@hbase.apache.org Received: (qmail 19618 invoked by uid 99); 25 Aug 2016 18:25:12 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 25 Aug 2016 18:25:12 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 6ADCDDFF8E; Thu, 25 Aug 2016 18:25:12 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: misty@apache.org To: commits@hbase.apache.org Date: Thu, 25 Aug 2016 18:25:28 -0000 Message-Id: In-Reply-To: <92cfc475fdfb41bb906e7cf367e608c6@git.apache.org> References: <92cfc475fdfb41bb906e7cf367e608c6@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [18/51] [abbrv] [partial] hbase-site git commit: Published site at 44c9021d67b0e922e1d2f5f53908742aceab6c80. archived-at: Thu, 25 Aug 2016 18:25:16 -0000 http://git-wip-us.apache.org/repos/asf/hbase-site/blob/a16749a7/apidocs/src-html/org/apache/hadoop/hbase/rest/client/Response.html ---------------------------------------------------------------------- diff --git a/apidocs/src-html/org/apache/hadoop/hbase/rest/client/Response.html b/apidocs/src-html/org/apache/hadoop/hbase/rest/client/Response.html index b16fd23..21936c2 100644 --- a/apidocs/src-html/org/apache/hadoop/hbase/rest/client/Response.html +++ b/apidocs/src-html/org/apache/hadoop/hbase/rest/client/Response.html @@ -27,140 +27,153 @@ 019 020package org.apache.hadoop.hbase.rest.client; 021 -022import java.io.InputStream; -023 -024import org.apache.commons.httpclient.Header; -025import org.apache.hadoop.hbase.classification.InterfaceAudience; -026import org.apache.hadoop.hbase.classification.InterfaceStability; -027 -028/** -029 * The HTTP result code, response headers, and body of a HTTP response. -030 */ -031@InterfaceAudience.Public -032@InterfaceStability.Stable -033public class Response { -034 private int code; -035 private Header[] headers; -036 private byte[] body; -037 private InputStream stream; -038 -039 /** -040 * Constructor -041 * @param code the HTTP response code -042 */ -043 public Response(int code) { -044 this(code, null, null); -045 } -046 -047 /** -048 * Constructor -049 * @param code the HTTP response code -050 * @param headers the HTTP response headers -051 */ -052 public Response(int code, Header[] headers) { -053 this(code, headers, null); -054 } -055 -056 /** -057 * Constructor -058 * @param code the HTTP response code -059 * @param headers the HTTP response headers -060 * @param body the response body, can be null -061 */ -062 public Response(int code, Header[] headers, byte[] body) { -063 this.code = code; -064 this.headers = headers; -065 this.body = body; -066 } -067 -068 /** -069 * Constructor -070 * @param code the HTTP response code -071 * @param headers headers the HTTP response headers -072 * @param body the response body, can be null -073 * @param in Inputstream if the response had one. -074 */ -075 public Response(int code, Header[] headers, byte[] body, InputStream in) { -076 this.code = code; -077 this.headers = headers; -078 this.body = body; -079 this.stream = in; -080 } -081 -082 /** -083 * @return the HTTP response code -084 */ -085 public int getCode() { -086 return code; -087 } -088 -089 /** -090 * Gets the input stream instance. -091 * -092 * @return an instance of InputStream class. -093 */ -094 public InputStream getStream(){ -095 return this.stream; -096 } -097 -098 /** -099 * @return the HTTP response headers -100 */ -101 public Header[] getHeaders() { -102 return headers; -103 } -104 -105 public String getHeader(String key) { -106 for (Header header: headers) { -107 if (header.getName().equalsIgnoreCase(key)) { -108 return header.getValue(); -109 } -110 } -111 return null; -112 } -113 -114 /** -115 * @return the value of the Location header -116 */ -117 public String getLocation() { -118 return getHeader("Location"); -119 } -120 -121 /** -122 * @return true if a response body was sent -123 */ -124 public boolean hasBody() { -125 return body != null; -126 } -127 -128 /** -129 * @return the HTTP response body -130 */ -131 public byte[] getBody() { -132 return body; -133 } -134 -135 /** -136 * @param code the HTTP response code -137 */ -138 public void setCode(int code) { -139 this.code = code; -140 } -141 -142 /** -143 * @param headers the HTTP response headers -144 */ -145 public void setHeaders(Header[] headers) { -146 this.headers = headers; -147 } -148 -149 /** -150 * @param body the response body -151 */ -152 public void setBody(byte[] body) { -153 this.body = body; -154 } -155} +022import java.io.IOException; +023import java.io.InputStream; +024 +025import org.apache.http.Header; +026import org.apache.http.HttpResponse; +027import org.apache.hadoop.hbase.classification.InterfaceAudience; +028import org.apache.hadoop.hbase.classification.InterfaceStability; +029import org.mortbay.log.Log; +030 +031/** +032 * The HTTP result code, response headers, and body of a HTTP response. +033 */ +034@InterfaceAudience.Public +035@InterfaceStability.Stable +036public class Response { +037 private int code; +038 private Header[] headers; +039 private byte[] body; +040 private HttpResponse resp; +041 private InputStream stream; +042 +043 /** +044 * Constructor +045 * @param code the HTTP response code +046 */ +047 public Response(int code) { +048 this(code, null, null); +049 } +050 +051 /** +052 * Constructor +053 * @param code the HTTP response code +054 * @param headers the HTTP response headers +055 */ +056 public Response(int code, Header[] headers) { +057 this(code, headers, null); +058 } +059 +060 /** +061 * Constructor +062 * @param code the HTTP response code +063 * @param headers the HTTP response headers +064 * @param body the response body, can be null +065 */ +066 public Response(int code, Header[] headers, byte[] body) { +067 this.code = code; +068 this.headers = headers; +069 this.body = body; +070 } +071 +072 /** +073 * Constructor +074 * @param code the HTTP response code +075 * @param headers headers the HTTP response headers +076 * @param resp the response +077 * @param in Inputstream if the response had one. +078 * Note: this is not thread-safe +079 */ +080 public Response(int code, Header[] headers, HttpResponse resp, InputStream in) { +081 this.code = code; +082 this.headers = headers; +083 this.body = null; +084 this.resp = resp; +085 this.stream = in; +086 } +087 +088 /** +089 * @return the HTTP response code +090 */ +091 public int getCode() { +092 return code; +093 } +094 +095 /** +096 * Gets the input stream instance. +097 * +098 * @return an instance of InputStream class. +099 */ +100 public InputStream getStream(){ +101 return this.stream; +102 } +103 +104 /** +105 * @return the HTTP response headers +106 */ +107 public Header[] getHeaders() { +108 return headers; +109 } +110 +111 public String getHeader(String key) { +112 for (Header header: headers) { +113 if (header.getName().equalsIgnoreCase(key)) { +114 return header.getValue(); +115 } +116 } +117 return null; +118 } +119 +120 /** +121 * @return the value of the Location header +122 */ +123 public String getLocation() { +124 return getHeader("Location"); +125 } +126 +127 /** +128 * @return true if a response body was sent +129 */ +130 public boolean hasBody() { +131 return body != null; +132 } +133 +134 /** +135 * @return the HTTP response body +136 */ +137 public byte[] getBody() { +138 if (body == null) { +139 try { +140 body = Client.getResponseBody(resp); +141 } catch (IOException ioe) { +142 Log.debug("encountered ioe when obtaining body", ioe); +143 } +144 } +145 return body; +146 } +147 +148 /** +149 * @param code the HTTP response code +150 */ +151 public void setCode(int code) { +152 this.code = code; +153 } +154 +155 /** +156 * @param headers the HTTP response headers +157 */ +158 public void setHeaders(Header[] headers) { +159 this.headers = headers; +160 } +161 +162 /** +163 * @param body the response body +164 */ +165 public void setBody(byte[] body) { +166 this.body = body; +167 } +168}