HADOOP-2507 REST servlet does not properly base64 row keys and column names

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk/src/contrib/hbase@608762 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2008-01-04 06:56:28 +00:00
parent 13239f413e
commit 07eb878e5a
3 changed files with 10 additions and 3 deletions

View File

@ -101,6 +101,8 @@ Trunk (unreleased changes)
HADOOP-2505 formatter classes missing apache license
HADOOP-2504 REST servlet method for deleting a scanner was not properly
mapped (Bryan Duxbury via Stack)
HADOOP-2507 REST servlet does not properly base64 row keys and column names
(Bryan Duxbury via Stack)
IMPROVEMENTS
HADOOP-2401 Add convenience put method that takes writable

View File

@ -231,7 +231,9 @@ public abstract class GenericHandler {
throws IllegalStateException, IllegalArgumentException, IOException {
for (Map.Entry<Text, byte[]> e: m.entrySet()) {
outputter.startTag(COLUMN);
doElement(outputter, "name", e.getKey().toString());
doElement(outputter, "name",
org.apache.hadoop.hbase.util.Base64.encodeBytes(
e.getKey().getBytes()));
// We don't know String from binary data so we always base64 encode.
doElement(outputter, "value",
org.apache.hadoop.hbase.util.Base64.encodeBytes(e.getValue()));

View File

@ -180,12 +180,15 @@ public class ScannerHandler extends GenericHandler {
outputter.startTag(ROW);
// write the row key
doElement(outputter, "name", key.getRow().toString());
doElement(outputter, "name",
org.apache.hadoop.hbase.util.Base64.encodeBytes(key.getRow().getBytes()));
// Normally no column is supplied when scanning.
if (key.getColumn() != null &&
key.getColumn().getLength() > 0) {
doElement(outputter, "key-column", key.getColumn().toString());
doElement(outputter, "key-column",
org.apache.hadoop.hbase.util.Base64.encodeBytes(
key.getColumn().getBytes()));
}
doElement(outputter, "timestamp", Long.toString(key.getTimestamp()));