hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r607592 - in /lucene/hadoop/trunk/src/contrib/hbase: CHANGES.txt src/java/org/apache/hadoop/hbase/rest/TableHandler.java
Date Sun, 30 Dec 2007 21:40:52 GMT
Author: stack
Date: Sun Dec 30 13:40:50 2007
New Revision: 607592

URL: http://svn.apache.org/viewvc?rev=607592&view=rev
Log:
HADOOP-2503 REST Insert / Select encoding issues

Modified:
    lucene/hadoop/trunk/src/contrib/hbase/CHANGES.txt
    lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/rest/TableHandler.java

Modified: lucene/hadoop/trunk/src/contrib/hbase/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/hbase/CHANGES.txt?rev=607592&r1=607591&r2=607592&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/contrib/hbase/CHANGES.txt (original)
+++ lucene/hadoop/trunk/src/contrib/hbase/CHANGES.txt Sun Dec 30 13:40:50 2007
@@ -93,6 +93,8 @@
                deleted
    HADOOP-2468 TestRegionServerExit failed in Hadoop-Nightly #338
    HADOOP-2467 scanner truncates resultset when > 1 column families
+   HADOOP-2503 REST Insert / Select encoding issue
+               (Bryan Duxbury via Stack)
    
   IMPROVEMENTS
    HADOOP-2401 Add convenience put method that takes writable

Modified: lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/rest/TableHandler.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/rest/TableHandler.java?rev=607592&r1=607591&r2=607592&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/rest/TableHandler.java
(original)
+++ lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/rest/TableHandler.java
Sun Dec 30 13:40:50 2007
@@ -245,10 +245,13 @@
     final HttpServletResponse response, final String [] pathSegments)
   throws IOException, ServletException {
     HTable table = getTable(pathSegments[0]);
+
+    // pull the row key out of the path
+    String row = URLDecoder.decode(pathSegments[2], HConstants.UTF8_ENCODING);
     
     switch(ContentType.getContentType(request.getHeader(CONTENT_TYPE))) {
       case XML:
-        putRowXml(table, request, response, pathSegments);
+        putRowXml(table, row, request, response, pathSegments);
         break;
       case MIME:
         doNotAcceptable(response, "Don't support multipart/related yet...");
@@ -265,8 +268,9 @@
    * @param pathSegments
    * Decode supplied XML and do a put to Hbase.
    */
-  private void putRowXml(HTable table, final HttpServletRequest request,
-    final HttpServletResponse response, final String [] pathSegments)
+  private void putRowXml(HTable table, String row, 
+    final HttpServletRequest request, final HttpServletResponse response, 
+    final String [] pathSegments)
   throws IOException, ServletException{
 
     DocumentBuilderFactory docBuilderFactory 
@@ -292,7 +296,7 @@
     
     try{
       // start an update
-      Text key = new Text(pathSegments[2]);
+      Text key = new Text(row);
       lock_id = table.startUpdate(key);
 
       // set the columns from the xml
@@ -457,7 +461,10 @@
     // grab the table we're operating on
     HTable table = getTable(getTableName(pathSegments));
     
-    Text key = new Text(pathSegments[2]);
+    // pull the row key out of the path
+    String row = URLDecoder.decode(pathSegments[2], HConstants.UTF8_ENCODING);
+    
+    Text key = new Text(row);
 
     String[] columns = request.getParameterValues(COLUMN);
         



Mime
View raw message